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


Python Gtk.AccelGroup方法代码示例

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


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

示例1: __set_callbacks

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def __set_callbacks(self):
        """Define the widget callbacks"""
        # Set the callbacks
        self.ti_bt.connect('clicked', self.on_ti_bt_clicked)
        self.tis_selection_changed_hid = \
            self.tag_icon_selector.connect('selection-changed', self.on_tis_selection_changed)
        self.tn_entry_clicked_hid = \
            self.tn_entry.connect('changed', self.on_tn_entry_changed)
        self.tn_cb_clicked_hid = \
            self.tn_cb.connect('clicked', self.on_tn_cb_clicked)
        # FIXME
        self.tc_cc_colsel.connect('color-changed', self.on_tc_colsel_changed)
        self.tc_cc_colsel.connect('color-added', self.on_tc_colsel_added)
        # self.tc_cc_colsel.connect('color-activated',
        #                           self.on_tc_colsel_activated)
        self.connect('delete-event', self.on_close)

        # allow fast closing by Escape key
        agr = Gtk.AccelGroup()
        self.add_accel_group(agr)
        key, modifier = Gtk.accelerator_parse('Escape')
        agr.connect(key, modifier, Gtk.AccelFlags.VISIBLE, self.on_close) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:24,代码来源:tag_editor.py

示例2: _setup_accels

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def _setup_accels(self):
        """Setup accels."""
        self._accels = Gtk.AccelGroup()
        self.add_accel_group(self._accels)

        key, mod = Gtk.accelerator_parse("Escape")
        self._accels.connect(key, mod, Gtk.AccelFlags.VISIBLE,
                             self._close_window)

        key, mod = Gtk.accelerator_parse("Return")
        self._accels.connect(key, mod, Gtk.AccelFlags.VISIBLE,
                             self._do_select)

        key, mod = Gtk.accelerator_parse("<Control>F")
        self._accels.connect(key, mod, Gtk.AccelFlags.VISIBLE,
                             self._toggle_search) 
开发者ID:bilelmoussaoui,项目名称:nautilus-folder-icons,代码行数:18,代码来源:widgets.py

示例3: set_window_accel_groups

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def set_window_accel_groups(self):
    group = Gtk.AccelGroup()
    ctrl  = Gdk.ModifierType.CONTROL_MASK

    group.connect(Gdk.keyval_from_name('f'), ctrl, 0, self.on_revealer_accel_pressed)

    group.connect(Gdk.keyval_from_name('KP_Subtract'), ctrl, 0, self.on_zoom_decrease_accel_pressed)
    group.connect(Gdk.keyval_from_name('minus'), ctrl, 0, self.on_zoom_decrease_accel_pressed)

    group.connect(Gdk.keyval_from_name('KP_Add'), ctrl, 0, self.on_zoom_increase_accel_pressed)
    group.connect(Gdk.keyval_from_name('plus'), ctrl, 0, self.on_zoom_increase_accel_pressed)

    group.connect(Gdk.keyval_from_name('KP_0'), ctrl, 0, self.on_zoom_reset_accel_pressed)
    group.connect(Gdk.keyval_from_name('0'), ctrl, 0, self.on_zoom_reset_accel_pressed)

    self.window.add_accel_group(group) 
开发者ID:hardpixel,项目名称:devdocs-desktop,代码行数:18,代码来源:devdocs_desktop.py

示例4: do_preferences_changed

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def do_preferences_changed(self, *a):
		if self._switch_focus_accelgroup:
			self.remove_accel_group(self._switch_focus_accelgroup)

		space = Gdk.unicode_to_keyval(ord(' '))
		group = Gtk.AccelGroup()

		self.preferences.setdefault('toggle_on_altspace', False)
		if self.preferences['toggle_on_altspace']:
			# Hidden param, disabled because it causes problems with
			# several international layouts (space mistaken for alt-space,
			# see bug lp:620315)
			group.connect( # <Alt><Space>
				space, Gdk.ModifierType.MOD1_MASK, Gtk.AccelFlags.VISIBLE,
				self.toggle_sidepane_focus)

		# Toggled by preference menu, also causes issues with international
		# layouts - esp. when switching input method on Meta-Space
		if self.preferences['toggle_on_ctrlspace']:
			group.connect( # <Primary><Space>
				space, PRIMARY_MODIFIER_MASK, Gtk.AccelFlags.VISIBLE,
				self.toggle_sidepane_focus)

		self.add_accel_group(group)
		self._switch_focus_accelgroup = group 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:27,代码来源:mainwindow.py

示例5: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def __init__(self, text, title="Epoptes", markup=True,
                 icon_name="dialog-information"):
        super().__init__(title=title, icon_name=icon_name)
        self.set_position(Gtk.WindowPosition.CENTER)

        grid = Gtk.Grid(column_spacing=10, row_spacing=10, margin=10)
        self.add(grid)

        image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
        grid.add(image)

        # Always load the plain text first in case the markup parsing fails
        label = Gtk.Label(
            label=text, selectable=True, hexpand=True, vexpand=True,
            halign=Gtk.Align.START, valign=Gtk.Align.START)
        if markup:
            label.set_markup(text)
        grid.add(label)

        button = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)
        button.set_hexpand(False)
        button.set_halign(Gtk.Align.END)
        button.connect("clicked", Gtk.main_quit)
        grid.attach(button, 1, 1, 2, 1)
        self.set_focus_child(button)

        accelgroup = Gtk.AccelGroup()
        key, modifier = Gtk.accelerator_parse('Escape')
        accelgroup.connect(
            key, modifier, Gtk.AccelFlags.VISIBLE, Gtk.main_quit)
        self.add_accel_group(accelgroup) 
开发者ID:epoptes,项目名称:epoptes,代码行数:33,代码来源:message.py

示例6: _create_accel_group

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def _create_accel_group(self):
        self._accel_group = Gtk.AccelGroup()
        shortcut = self._gsettings.get_string(GSETTINGS_KEYBINDINGS)
        key, mod = Gtk.accelerator_parse(shortcut)
        self._accel_group.connect(key, mod, Gtk.AccelFlags.VISIBLE,
                                  self._open_terminal) 
开发者ID:Stunkymonkey,项目名称:nautilus-open-any-terminal,代码行数:8,代码来源:open_any_terminal_extension.py

示例7: _close_window

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def _close_window(self, *args):
        """Handle the destroy/delete-event signal."""
        # Hide the search bar when the user hits Escape
        is_cancel_btn = not isinstance(args[0], Gtk.AccelGroup)
        if self._search_bar.get_search_mode() and not is_cancel_btn:
            self._search_bar.set_search_mode(False)
        else:
            self.destroy() 
开发者ID:bilelmoussaoui,项目名称:nautilus-folder-icons,代码行数:10,代码来源:widgets.py

示例8: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def __init__(self, state_machine_manager_model=None):
        if state_machine_manager_model is None:
            from rafcon.gui.singleton import state_machine_manager_model
        self.state_machine_manager_model = state_machine_manager_model
        from rafcon.gui.singleton import main_window_controller
        shortcut_manager = main_window_controller.shortcut_manager
        self.shortcut_manager = shortcut_manager
        self.accel_group = Gtk.AccelGroup() 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:10,代码来源:state.py

示例9: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def __init__(self, window):
        # Setup window to listen for accelerators
        self.main_window = window
        self.accel_group = Gtk.AccelGroup()
        self.main_window.add_accel_group(self.accel_group)

        self.__action_to_callbacks = {}
        self.__action_to_shortcuts = global_gui_config.get_config_value('SHORTCUTS', {})
        self.register_shortcuts()
        self.__controller_action_callbacks = {} 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:12,代码来源:shortcut_manager.py

示例10: do_activate

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import AccelGroup [as 别名]
def do_activate(self):
        self.connection_manager = ConnectionManager(self)
        self.config = config.load()
        self.config.connect('notify::ui-dark-theme', self.on_use_dark_theme)
        self.on_use_dark_theme()
        self.action_groups = {}
        accel_group = Gtk.AccelGroup()
        commands = self.config.get_commands()
        for group_key in commands:
            group = Gio.SimpleActionGroup()
            self.action_groups[group_key] = group
            data = commands[group_key]
            for action_key in data['actions']:
                action_data = data['actions'][action_key]
                action = Gio.SimpleAction.new(
                    '{}_{}'.format(group_key, action_key), None)
                callback = partial(self._generic_callback,
                                   group_key, action_data['callback'],
                                   action_data.get('args', ()))
                action.connect('activate', callback)
                group.insert(action)
                key, mod = Gtk.accelerator_parse(action_data['shortcut'])
                accel_group.connect(key, mod, Gtk.AccelFlags.VISIBLE, callback)
                self.add_action(action)

        if self.win is None:
            self.win = MainWindow(self)
            statefile = os.path.join(
                xdg.BaseDirectory.save_config_path('runsqlrun'), 'state')
            if os.path.isfile(statefile):
                with open(statefile) as f:
                    state = json.load(f)
                self.win.restore_state(state)
        self.win.add_accel_group(accel_group)
        self.win.present() 
开发者ID:andialbrecht,项目名称:runsqlrun,代码行数:37,代码来源:app.py


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