当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.STOCK_EDIT属性代码示例

本文整理汇总了Python中gi.repository.Gtk.STOCK_EDIT属性的典型用法代码示例。如果您正苦于以下问题:Python Gtk.STOCK_EDIT属性的具体用法?Python Gtk.STOCK_EDIT怎么用?Python Gtk.STOCK_EDIT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gi.repository.Gtk的用法示例。


在下文中一共展示了Gtk.STOCK_EDIT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_view

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_EDIT [as 别名]
def get_view(self):
        """It's called from Preference. It creates the view and returns it"""
        vbox = Gtk.VBox(False, 3)
        # create columns
        renderer = Gtk.CellRendererText()
        renderer.set_property('editable', False)
        column = Gtk.TreeViewColumn(_('Sensor'), renderer, text=0)
        self._tree_view.append_column(column)

        renderer = Gtk.CellRendererText()
        renderer.set_property('editable', False)
        column = Gtk.TreeViewColumn(_('Description'), renderer, text=1)
        self._tree_view.append_column(column)

        self._tree_view.expand_all()
        sw = Gtk.ScrolledWindow()
        sw.add_with_viewport(self._tree_view)
        vbox.pack_start(sw, True, True, 0)

        # add buttons
        hbox = Gtk.HBox()
        new_button = Gtk.Button.new_from_stock(Gtk.STOCK_NEW)
        new_button.connect('clicked', self._on_edit_sensor)
        hbox.pack_start(new_button, False, False, 0)

        edit_button = Gtk.Button.new_from_stock(Gtk.STOCK_EDIT)
        edit_button.connect('clicked', self._on_edit_sensor, False)
        hbox.pack_start(edit_button, False, False, 1)

        del_button = Gtk.Button.new_from_stock(Gtk.STOCK_DELETE)
        del_button.connect('clicked', self._on_del_sensor)
        hbox.pack_start(del_button, False, False, 2)

        add_button = Gtk.Button.new_from_stock(Gtk.STOCK_ADD)
        add_button.connect('clicked', self._on_add_sensor)
        hbox.pack_end(add_button, False, False, 3)
        vbox.pack_end(hbox, False, False, 1)

        frame = Gtk.Frame.new(_('Sensors'))
        frame.add(vbox)
        return frame 
开发者ID:fossfreedom,项目名称:indicator-sysmonitor,代码行数:43,代码来源:preferences.py

示例2: on_rename

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_EDIT [as 别名]
def on_rename(self, widget, data=None):
        selection = self.treeView.get_selection()
        theModel, selectedPaths = selection.get_selected_rows()
        selection.unselect_all()
        self.treeView.set_cursor(selectedPaths[0], self.treeView.get_column(0), False)
        selectedObject = self.__getTreeSelection()[0]
        if isinstance(selectedObject, model.Folder):
            oldName = selectedObject.title
        else:

            oldName = selectedObject.description

        dlg = RenameDialog(self.ui, oldName, False)
        dlg.set_image(Gtk.STOCK_EDIT)

        if dlg.run() == 1:
            newText = dlg.get_name()
            if dialogs.validate(not dialogs.EMPTY_FIELD_REGEX.match(newText), _("The name can't be empty"),
                             None, self.ui):
                self.__getCurrentPage().set_item_title(newText)

                self.app.monitor.suspend()

                if dlg.get_update_fs():
                    self.__getCurrentPage().rebuild_item_path()

                persistGlobal = self.__getCurrentPage().save()
                self.refresh_tree()
                self.app.monitor.unsuspend()
                self.app.config_altered(persistGlobal)

        dlg.destroy() 
开发者ID:autokey,项目名称:autokey,代码行数:34,代码来源:configwindow.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_EDIT [as 别名]
def __init__(self, parent):
		Dialog.__init__(self, parent, _('Custom Tools'), buttons=Gtk.ButtonsType.CLOSE) # T: Dialog title
		self.set_help(':Help:Custom Tools')
		self.manager = CustomToolManager()

		self.add_help_text(_(
			'You can configure custom tools that will appear\n'
			'in the tool menu and in the tool bar or context menus.'
		)) # T: help text in "Custom Tools" dialog

		hbox = Gtk.HBox(spacing=5)
		self.vbox.pack_start(hbox, True, True, 0)

		self.listview = CustomToolList(self.manager)
		hbox.pack_start(self.listview, True, True, 0)

		vbox = Gtk.VBox(spacing=5)
		hbox.pack_start(vbox, False, True, 0)

		for stock, handler, data in (
			(Gtk.STOCK_ADD, self.__class__.on_add, None),
			(Gtk.STOCK_EDIT, self.__class__.on_edit, None),
			(Gtk.STOCK_DELETE, self.__class__.on_delete, None),
			(Gtk.STOCK_GO_UP, self.__class__.on_move, -1),
			(Gtk.STOCK_GO_DOWN, self.__class__.on_move, 1),
		):
			button = IconButton(stock) # TODO tooltips for icon button
			if data:
				button.connect_object('clicked', handler, self, data)
			else:
				button.connect_object('clicked', handler, self)
			vbox.pack_start(button, False, True, 0) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:34,代码来源:customtools.py

示例4: _get_context_menu

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_EDIT [as 别名]
def _get_context_menu(self):
        context_menu_xml = """
        <ui>
        <popup action="ContextMenu">
            <menuitem action="ChangeEntry"/>
            <menuitem action="AddEntry"/>
            <menuitem action="Delete"/>
        </popup>
        </ui>"""

        uimanager = self.main_window.uimanager

        # Create an ActionGroup
        actiongroup = Gtk.ActionGroup("ContextMenuActionGroup")

        # Create actions
        actiongroup.add_actions(
            [
                (
                    "ChangeEntry",
                    Gtk.STOCK_EDIT,
                    _("Change this text"),
                    None,
                    None,
                    self._on_change_entry_clicked,
                ),
                (
                    "AddEntry",
                    None,
                    _("Add a new entry"),
                    None,
                    None,
                    self._on_add_entry_clicked,
                ),
                (
                    "Delete",
                    Gtk.STOCK_DELETE,
                    _("Delete this entry"),
                    None,
                    None,
                    self._on_delete_entry_clicked,
                ),
            ]
        )

        # Add the actiongroup to the uimanager
        uimanager.insert_action_group(actiongroup, 0)

        # Add a UI description
        uimanager.add_ui_from_string(context_menu_xml)

        # Create a Menu
        menu = uimanager.get_widget("/ContextMenu")
        return menu 
开发者ID:jendrikseipp,项目名称:rednotebook,代码行数:56,代码来源:categories.py


注:本文中的gi.repository.Gtk.STOCK_EDIT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。