Ejemplo n.º 1
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)
 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)
Ejemplo n.º 3
0
 def __bind(self, raw_key, field):
     key = deepin_to_keybinder(raw_key)
     try:
         self.__try_unbind(key)
     except:    
         pass
     
     try:
         result = keybinder.bind(key, lambda : self.__handle_callback(key, self.func[field]))
     except:    
         result = False
     else:    
         if not result:
             dbus_notify.set_summary(_("DMusic"))
             dbus_notify.set_body(_("Failed to bind %s !") % utils.xmlescape(raw_key))
             dbus_notify.notify()
     return result    
 def __bind(self, raw_key, field):
     key = deepin_to_keybinder(raw_key)
     try:
         self.__try_unbind(key)
     except:    
         pass
     
     try:
         result = keybinder.bind(key, lambda : self.__handle_callback(key, self.func[field]))
     except:    
         result = False
     else:    
         if not result:
             dbus_notify.set_summary(PROGRAM_NAME_LONG)
             dbus_notify.set_body(_("Failed to bind %s !") % utils.xmlescape(raw_key))
             dbus_notify.notify()
     return result