Esempio n. 1
0
	def unbind(self, key_seq):
		logging.info('Unbinding key seq: %s' % key_seq)
		try:
			keybinder.unbind(key_seq)
		except KeyError as err:
			# KeyError: 'bind: keystring is not bound'
			logging.warn(err)
Esempio n. 2
0
	def unbind(self):
		try:
			keybinder.unbind(self.prevbinding)
			self.bound = False
		except KeyError:
			# if the requested keybinding is not bound, a KeyError will be thrown
			pass
 def __try_unbind(self, key):
     try:
         self.logdebug("Unbinding %s" % key)
         keybinder.unbind(key)
         self.logdebug("Unbound %s" % key)
     except:
         self.logdebug("Did not unbind %s" % key)
Esempio n. 4
0
 def unbind_all(self):
     items = self.get_all_items()
     for keystring in items:
         try:
             keybinder.unbind(items[keystring])
         except Exception, e:
             logging.warn("unbind error %s" % str(e))
Esempio n. 5
0
 def unbind(self):
     try:
         keybinder.unbind(self.prevbinding)
         self.bound = False
     except KeyError:
         # if the requested keybinding is not bound, a KeyError will be thrown
         pass
Esempio n. 6
0
 def unbind_all(self):
     items = self.get_all_items()
     for keystring in items: 
         try:          
             keybinder.unbind(items[keystring])
         except Exception, e:
             logging.warn("unbind error %s" % str(e))
Esempio n. 7
0
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)
Esempio n. 8
0
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)
Esempio n. 9
0
 def unbinder(self, items):
     for keystring in items:
         try: 
             keybinder.unbind(items[keystring])
         except:
             pass
     HotKeysConfig.binded = False
Esempio n. 10
0
	def change_s_dialog_key(self, gconfclient=None, gconfentry=None, gconfvalue=None, d=None):
		try:
			keybinder.unbind(self.prev_sel_dialog_key)
		except:
			pass

		keybinder.bind(prefs.get_sel_dialog_key(), lambda: self.s_dialog.show())
		self.prev_sel_dialog_key = prefs.get_sel_dialog_key()
Esempio n. 11
0
	def change_prefs_dialog_key(self, gconfclient=None, gconfentry=None, gconfvalue=None, d=None):
		try:
			keybinder.unbind(self.prev_prefs_dialog_key)
		except:
			pass

		keybinder.bind(prefs.get_prefs_dialog_key(), lambda: prefs.PreferencesDialog())
		self.prev_prefs_dialog_key = prefs.get_prefs_dialog_key()
Esempio n. 12
0
 def release_hotkey(self):
     try:
         import keybinder
         keybinder.unbind(
               config.settings['shortcut_summon_hotot']
             , self.on_hotkey_compose)
     except:
         pass
Esempio n. 13
0
 def __try_unbind(self, key):
     key = deepin_to_keybinder(key)
     try:
         self.logdebug("Unbinding %s" % key)
         keybinder.unbind(key)
         self.logdebug("Unbound %s" % key)
     except:
         self.logdebug("Did not unbind %s" % key)
Esempio n. 14
0
 def release_hotkey(self):
     try:
         import keybinder
         keybinder.unbind(
               config.settings['shortcut_summon_hotot']
             , self.on_hotkey_compose)
     except:
         pass
Esempio n. 15
0
 def __unbind(self, accelerator):
     if accelerator["hotkey"] == None:
         return
     if accelerator["global"]:
         keybinder.unbind(accelerator["hotkey"])
     else:
         self.disconnect_key(accelerator["hotkey"], accelerator["hotmask"])
     accelerator["hotkey"] = None
     accelerator["hotmask"] = None
Esempio n. 16
0
    def unbind(self):

        try:

            keybinder.unbind(self.keystring)

        except:

            pass
Esempio n. 17
0
 def on_remove_row(self, *args):
     selection = self.tree_widget.get_selection()
     model, selected = selection.get_selected()
     model.remove(selected)
     keystring = self.model.get_value(selected, 1)
     try:
         keybinder.unbind(keystring)
     except:
         pass
Esempio n. 18
0
 def on_remove_row(self, *args):
     selection = self.tree_widget.get_selection()
     model, selected = selection.get_selected()
     model.remove(selected)   
     keystring = self.model.get_value(selected, 1)
     try:
         keybinder.unbind(keystring)
     except:
         pass 
Esempio n. 19
0
 def on_gkeys_changed(self, arg=None, dialog=True):
     functions = {
                  "gkeys_select_next_group": self.gkey_select_next_group,
                  "gkeys_select_previous_group": \
                             self.gkey_select_previous_group,
                  "gkeys_select_next_window": \
                             self.gkey_select_next_window_in_group,
                  "gkeys_select_previous_window": \
                             self.gkey_select_previous_window_in_group,
                }
     translations = {
        'gkeys_select_next_group': _('Select next group'),
        'gkeys_select_previous_group': _('Select previous group'),
        'gkeys_select_next_window': _('Select next window in group'),
        'gkeys_select_previous_window': _('Select previous window in group')
                    }
     for (s, f) in functions.items():
         if self.gkeys[s] is not None:
             keybinder.unbind(self.gkeys[s])
             self.gkeys[s] = None
         if not self.globals.settings[s]:
             # The global key is not in use
             continue
         keystr = self.globals.settings['%s_keystr'%s]
         try:
             if keybinder.bind(keystr, f):
                 # Key succesfully bound.
                 self.gkeys[s]= keystr
                 error = False
             else:
                 error = True
                 reason = ""
                 # Keybinder sometimes doesn't unbind faulty binds.
                 # We have to do it manually.
                 try:
                     keybinder.unbind(keystr)
                 except:
                     pass
         except KeyError:
             error = True
             reason = _("The key is already bound elsewhere.")
         if error:
             message = _("Error: DockbarX couldn't set global keybinding '%(keystr)s' for %(function)s.")%{'keystr':keystr, 'function':translations[s]}
             text = "%s %s"%(message, reason)
             print text
             if dialog:
                 md = gtk.MessageDialog(
                         None,
                         gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                         gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE,
                         text
                                       )
                 md.run()
                 md.destroy()
Esempio n. 20
0
    def change_s_dialog_key(self,
                            gconfclient=None,
                            gconfentry=None,
                            gconfvalue=None,
                            d=None):
        try:
            keybinder.unbind(self.prev_sel_dialog_key)
        except:
            pass

        keybinder.bind(prefs.get_sel_dialog_key(),
                       lambda: self.s_dialog.show())
        self.prev_sel_dialog_key = prefs.get_sel_dialog_key()
Esempio n. 21
0
    def change_prefs_dialog_key(self,
                                gconfclient=None,
                                gconfentry=None,
                                gconfvalue=None,
                                d=None):
        try:
            keybinder.unbind(self.prev_prefs_dialog_key)
        except:
            pass

        keybinder.bind(prefs.get_prefs_dialog_key(),
                       lambda: prefs.PreferencesDialog())
        self.prev_prefs_dialog_key = prefs.get_prefs_dialog_key()
Esempio n. 22
0
 def bindKeys(self):
   for toggle in self._hotkeys:
     if not (self._hotkeys[toggle] == "DISABLED"):
       try:  keybinder.unbind(self._hotkeys[toggle])
       except: pass
     
       # Default bad hotkeys
       if not gtk.accelerator_parse(self._hotkeys[toggle])[0] and not self._hotkeys[toggle] == self._defaults[toggle]:
         self._hotkeys[toggle] = self._defaults[toggle]
     
       try:
           keybinder.bind(self._hotkeys[toggle], self.keyboard_callback, toggle)
       
       except: pass
Esempio n. 23
0
 def btnsave_clicked(self, widget):
     self.config.login_password = self.txtPassword.get_text()
     self.config.proxy_uri = self.txtProxyUri.get_text()
     self.config.save_path = self.dcbtnSavePath.get_current_folder()
     try:
         keybinder.unbind(self.config.hot_key)
     except:
         pass
     self.config.hot_key = self.txtHotkey.get_text()
     keybinder.bind(self.config.hot_key, self.tray.keybind_callback)
     self.webview.init_proxy()
     self.config.save()
     utils.notification('保存配置成功', '部分配置重启程序后生效')
     self.window.destroy()
Esempio n. 24
0
	def btnsave_clicked(self, widget):
		self.config.login_password = self.txtPassword.get_text()
		self.config.proxy_uri = self.txtProxyUri.get_text()
		self.config.save_path = self.dcbtnSavePath.get_current_folder()
		try:
			keybinder.unbind(self.config.hot_key)
		except:
			pass
		self.config.hot_key = self.txtHotkey.get_text()
		keybinder.bind(self.config.hot_key, self.tray.keybind_callback)
		self.webview.init_proxy()
		self.config.save()
		utils.notification('保存配置成功', '部分配置重启程序后生效')
		self.window.destroy()
	def bind_tails(chain, callback, timeout):
		links = chain.split("-")
		head = links[0]
		tails = links[1:]
		if links != ['']:
			keybinder.bind(head, lambda : bind_tails("-".join(tails), callback, timeout))
			gobject.timeout_add(timeout, lambda : keybinder.unbind(head))
		else:
			callback()
Esempio n. 26
0
 def unbind(self, k):
     if self.keybindings.get(k):
         try:
             keybinder.unbind(modifiers+funkey+str(k))
         except:
             pass
Esempio n. 27
0
 def unbind_keys(self):
     if bind_global:
         keybinder.unbind(self.config.get_item('global_play_pause'))
         keybinder.unbind(self.config.get_item('global_next'))
         keybinder.unbind(self.config.get_item('global_previous'))
         keybinder.unbind(self.config.get_item('global_star'))
Esempio n. 28
0
 def unbind_hotkey(self):
     """
     Unbind the toggle hotkey.
     """
     keybinder.unbind(CONFIG['hotkey'])
 def unbind(self, modifiers, key, handler):
     """
     Unbind an already binded key
     """
     keys = modifiers + key
     keybinder.unbind(keys, handler)
 def unbind(self, modifiers, key, handler):
     """
     Unbind an already binded key
     """
     keys = modifiers+key
     keybinder.unbind(keys, handler)
Esempio n. 31
0
 def unbind_keys(self):
     if bind_global:
         keybinder.unbind(self.config.get_item('global_play_pause'))
         keybinder.unbind(self.config.get_item('global_next'))
         keybinder.unbind(self.config.get_item('global_previous'))
         keybinder.unbind(self.config.get_item('global_star'))
Esempio n. 32
0
 def unbind_keys(self):
     if BINDABLE:
         keybinder.unbind(self.config.get_item('global_play_pause'))
         keybinder.unbind(self.config.get_item('global_next'))
         keybinder.unbind(self.config.get_item('global_previous'))
Esempio n. 33
0
 def unbindKeys(self):
   for toggle in self._hotkeys:  
     if not (self._hotkeys[toggle] == "DISABLED"):
       try:  keybinder.unbind(self._hotkeys[toggle])
       except: pass
Esempio n. 34
0
 def unbind_hotkeys(self):
     """
     Unbind the toggle and hide hotkeys.
     """
     keybinder.unbind(CONFIG["hotkey"])
     keybinder.unbind("Escape")
Esempio n. 35
0
 def unbind_hotkeys(self):
     """
     Unbind the toggle and hide hotkeys.
     """
     keybinder.unbind(CONFIG['hotkey'])
     keybinder.unbind('Escape')
Esempio n. 36
0
        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, 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


def _is_sane_keybinding(keystr):
    "Refuse keys that we absolutely do not want to bind"
    if keystr is None:
        return True
    if len(keystr) == 1 and keystr.isalnum():
        return False
    if keystr in set(["Return", "space", "BackSpace", "Escape"]):
        return False
    return True
Esempio n. 37
0
 def unbind_keys(self):
     if BINDABLE:
         keybinder.unbind(self.config.get_item('global_play_pause'))
         keybinder.unbind(self.config.get_item('global_next'))
         keybinder.unbind(self.config.get_item('global_previous'))
	def bind_choices(keys, callbacks, timeout):
		for (key, callback) in zip(keys, callbacks):
			bind_keychain(key, callback, timeout)
			gobject.timeout_add(timeout, lambda key=key: keybinder.unbind(key))
Esempio n. 39
0
		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, 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


def _is_sane_keybinding(keystr):
	"Refuse keys that we absolutely do not want to bind"
	if keystr is None:
		return True
	if len(keystr) == 1 and keystr.isalnum():
		return False
	if keystr in set(["Return", "space", "BackSpace", "Escape"]):
		return False
	return True
Esempio n. 40
0
 def unbind(self, accel):
     try:
         keybinder.unbind(accel)
     except KeyError:
         pass
Esempio n. 41
0
 def hide(self):
     self.window.hide()
     keybinder.unbind("Escape")
Esempio n. 42
0
 def hide(self):
     self.window.hide()
     keybinder.unbind('Escape')