Python gi.repository.Gtk 模块,AccelGroup() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用gi.repository.Gtk.AccelGroup()

项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self, parent, window, account):
        # Read default values
        self.window = window
        self.parent = parent
        self.account = account
        # Create needed widgets
        self.code_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.revealer = Gtk.Revealer()
        self.checkbox = Gtk.CheckButton()
        self.application_name = Gtk.Label(xalign=0)
        self.code_label = Gtk.Label(xalign=0)
        self.timer_label = Gtk.Label(xalign=0)
        self.accel = Gtk.AccelGroup()
        self.window.add_accel_group(self.accel)
        self.accel.connect(Gdk.keyval_from_name('C'), Gdk.ModifierType.CONTROL_MASK, 0, self.copy_code)
        self.accel.connect(Gdk.keyval_from_name("Enter"), Gdk.ModifierType.META_MASK, 0, self.toggle_code)
项目:nautilus-folder-icons    作者:bil-elmoussaoui    | 项目源码 | 文件源码
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)
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self, window, accounts):
        self.accounts = accounts
        self.window = window
        self.generate()
        self.accel = Gtk.AccelGroup()
        self.window.add_accel_group(self.accel)
        self.connect("row-activated", self.activate_row)
        self.connect("row-selected", self.selected_row)
        self.accel.connect(Gdk.keyval_from_name('Up'), Gdk.ModifierType.META_MASK, 0, self.navigate)
        self.accel.connect(Gdk.keyval_from_name('Down'), Gdk.ModifierType.META_MASK, 0, self.navigate)
项目:cozy    作者:geigi    | 项目源码 | 文件源码
def __init_actions(self):
        """
        Init all app actions.
        """
        self.accel = Gtk.AccelGroup()

        #menu = self.menu_builder.get_object("app_menu")
        # self.app.set_app_menu(menu)

        help_action = Gio.SimpleAction.new("help", None)
        help_action.connect("activate", self.help)
        self.app.add_action(help_action)

        about_action = Gio.SimpleAction.new("about", None)
        about_action.connect("activate", self.about)
        self.app.add_action(about_action)

        quit_action = Gio.SimpleAction.new("quit", None)
        quit_action.connect("activate", self.quit)
        self.app.add_action(quit_action)
        self.app.set_accels_for_action(
            "app.quit", ["<Control>q", "<Control>w"])

        pref_action = Gio.SimpleAction.new("prefs", None)
        pref_action.connect("activate", self.show_prefs)
        self.app.add_action(pref_action)
        self.app.set_accels_for_action("app.prefs", ["<Control>comma"])

        self.scan_action = Gio.SimpleAction.new("scan", None)
        self.scan_action.connect("activate", self.scan)
        self.app.add_action(self.scan_action)