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


Python Keybinder.unbind方法代码示例

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


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

示例1: bind_key

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
def bind_key(keystr, keybinding_target=KEYBINDING_DEFAULT):
    """
    Bind @keystr, unbinding any previous key for @keybinding_target.
    If @keystr is a false value, any previous key will be unbound.
    """
    keybinding_target = int(keybinding_target)

    if Keybinder is None:
        return False

    def callback(keystr):
        return GetKeyboundObject()._keybinding(keybinding_target)

    if not _is_sane_keybinding(keystr):
        pretty.print_error(__name__, "Refusing to bind key", repr(keystr))
        return False

    succ = True
    if keystr:
        try:
            succ = Keybinder.bind(keystr, callback)
            pretty.print_debug(__name__, "binding", repr(keystr))
            GetKeyboundObject().emit_bound_key_changed(keystr, True)
        except KeyError as exc:
            pretty.print_error(__name__, exc)
            succ = False
    if succ:
        old_keystr = get_currently_bound_key(keybinding_target)
        if old_keystr and old_keystr != keystr:
            Keybinder.unbind(old_keystr)
            pretty.print_debug(__name__, "unbinding", repr(old_keystr))
            GetKeyboundObject().emit_bound_key_changed(old_keystr, False)
        _register_bound_key(keystr, keybinding_target)
    return succ
开发者ID:engla,项目名称:kupfer,代码行数:36,代码来源:keybindings.py

示例2: cancel

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
 def cancel(self):
     if not self._callback:
         return
     for keystring in self._worked:
         Keybinder.unbind(keystring)
     del self._worked[:]
     self._callback = None
开发者ID:zsau,项目名称:quodlibet,代码行数:9,代码来源:keybinder.py

示例3: unbinder

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
 def unbinder(self, items):
     for keystring in items:
         try:
             Keybinder.unbind(items[keystring])
         except:
             pass
     HotKeysConfig.binded = False
开发者ID:zablotski,项目名称:foobnix,代码行数:9,代码来源:hotkey_conf.py

示例4: rebind_key

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
def rebind_key(keystring, is_bound):
    if is_bound:
        print("binding", keystring)
        keybinder.bind(keystring, relay_key, keystring)
    else:
        print("unbinding", keystring)
        keybinder.unbind(keystring)
开发者ID:engla,项目名称:kupfer,代码行数:9,代码来源:keyrelay.py

示例5: bind_key

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
 def bind_key(cls):
     Keybinder.init()
     shortcut = MetaData.get_snapshoot_shortcut()
     if Keybinder.bind(shortcut,cls.callback,""):
         if cls.old_key_shortcut is not None:
             Keybinder.unbind(cls.old_key_shortcut)
         cls.old_key_shortcut = shortcut
     else:
         logging.error("Bind shortcut key failed ")
开发者ID:ChanningBJ,项目名称:ElsaClipper,代码行数:11,代码来源:main_ui.py

示例6: bind

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
def bind(binding, func, *args, **kwargs):
    """Wrapper for keybinder.bind() allowing kwargs."""

    def run(_, __): func(*args, **kwargs)
    try:
        Keybinder.unbind(binding)
    except:
        pass
    success = Keybinder.bind(binding, run, None)
    if not success:
        print "Error binding '%s'" % binding
开发者ID:mntnoe,项目名称:wmbinder,代码行数:13,代码来源:commands.py

示例7: set_app_show

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
 def set_app_show(self, new):
     '''
     This is a specific method to set just the show accelerator.
     We use the value from gsettings to first unbind the current
     key, so in the process of changing the hotkey, we expect the
     API user to first call this method and later change gsettings.
     '''
     if platform.system() == 'Windows':
         self.app.set_hotkey(new)
     else:
         Keybinder.unbind(self.shortcuts['app-show'])
         Keybinder.bind(new, self.app.on_show)
开发者ID:gbtami,项目名称:passman,代码行数:14,代码来源:dialogs.py

示例8: bind_show_app_hotkey

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
    def bind_show_app_hotkey(self, accel_name):
        if is_wayland_compatibility_on():
            return

        if self._current_accel_name == accel_name:
            return

        if self._current_accel_name:
            Keybinder.unbind(self._current_accel_name)
            self._current_accel_name = None

        logger.info("Trying to bind app hotkey: %s" % accel_name)
        Keybinder.bind(accel_name, self.toggle_window)
        self._current_accel_name = accel_name
        self.notify_hotkey_change(accel_name)
开发者ID:Ulauncher,项目名称:Ulauncher,代码行数:17,代码来源:UlauncherWindow.py

示例9: bind_tab

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
    def bind_tab(self, bind=True):
        if bind:
            Keybinder.bind(self.super + 'Tab', self.tab_key, False)
            Keybinder.bind(self.super + '<Shift>Tab', self.tab_key, True)

            for i, key in enumerate(self.monkeys):
                Keybinder.bind(self.super + '<Ctrl>' + key,
                               self.tab_key, False, i)
                Keybinder.bind(self.super + '<Ctrl><Shift>' + key,
                               self.tab_key, False, i)
        else:
            Keybinder.unbind(self.super + 'Tab')
            Keybinder.unbind(self.super + '<Shift>Tab')

            for i, key in enumerate(self.monkeys):
                Keybinder.unbind(self.super + '<Ctrl>' + key)
                Keybinder.unbind(self.super + '<Ctrl><Shift>' + key)
开发者ID:rabinv,项目名称:montab,代码行数:19,代码来源:montab.py

示例10: teardown

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
 def teardown(self, exaile):
     for k in KEYS:
         Keybinder.unbind(k)
开发者ID:exaile,项目名称:exaile,代码行数:5,代码来源:__init__.py

示例11: _unbind

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
 def _unbind(self, hotkey):
     Keybinder.unbind(self._gtk_hotkey(hotkey))
开发者ID:Gordon01,项目名称:smarthome,代码行数:4,代码来源:x11.py

示例12: disable

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
def disable(exaile):
    for k in KEYS:
        Keybinder.unbind(k)
开发者ID:BlubberHarpoonist,项目名称:exaile,代码行数:5,代码来源:__init__.py

示例13: set_app_show

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
 def set_app_show(self, new):
     """
     We expect gsettings hasn't been changed yet.
     """
     Keybinder.unbind(self.shortcuts["app-show"])
     Keybinder.bind(new, self.app.on_show)
开发者ID:ysk9,项目名称:passman,代码行数:8,代码来源:dialogs.py

示例14: unbind_keys

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import unbind [as 别名]
 def unbind_keys(self):
     for keystring in self.bound_keys:
         Keybinder.unbind(keystring)
     self.bound_keys = []
开发者ID:gillesB,项目名称:azulejo,代码行数:6,代码来源:azulejo.py


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