Ejemplo n.º 1
0
 def hotkeylisten(self, event):
     good = hotkeymgr.fromevent(event)
     if good:
         (hotkey_code, hotkey_mods) = good
         event.widget.delete(0, tk.END)
         event.widget.insert(0, hotkeymgr.display(hotkey_code, hotkey_mods))
         if hotkey_code:
             # done
             (self.hotkey_code, self.hotkey_mods) = (hotkey_code,
                                                     hotkey_mods)
             self.hotkey_only_btn['state'] = tk.NORMAL
             self.hotkey_play_btn['state'] = tk.NORMAL
             self.hotkey_only_btn.focus(
             )  # move to next widget - calls hotkeyend() implicitly
     else:
         if good is None:  # clear
             (self.hotkey_code, self.hotkey_mods) = (0, 0)
         event.widget.delete(0, tk.END)
         if self.hotkey_code:
             event.widget.insert(
                 0, hotkeymgr.display(self.hotkey_code, self.hotkey_mods))
             self.hotkey_only_btn['state'] = tk.NORMAL
             self.hotkey_play_btn['state'] = tk.NORMAL
         else:
             event.widget.insert(
                 0, _('None'))  # No hotkey/shortcut currently defined
             self.hotkey_only_btn['state'] = tk.DISABLED
             self.hotkey_play_btn['state'] = tk.DISABLED
         self.hotkey_only_btn.focus(
         )  # move to next widget - calls hotkeyend() implicitly
     return ('break'
             )  # stops further processing - insertion, Tab traversal etc
Ejemplo n.º 2
0
 def hotkeylisten(self, event):
     good = hotkeymgr.fromevent(event)
     if good:
         (hotkey_code, hotkey_mods) = good
         event.widget.delete(0, tk.END)
         event.widget.insert(0, hotkeymgr.display(hotkey_code, hotkey_mods))
         if hotkey_code:
             # done
             (self.hotkey_code, self.hotkey_mods) = (hotkey_code, hotkey_mods)
             self.hotkey_only_btn['state'] = tk.NORMAL
             self.hotkey_play_btn['state'] = tk.NORMAL
             self.hotkey_only_btn.focus()	# move to next widget - calls hotkeyend() implicitly
     else:
         if good is None: 	# clear
             (self.hotkey_code, self.hotkey_mods) = (0, 0)
         event.widget.delete(0, tk.END)
         if self.hotkey_code:
             event.widget.insert(0, hotkeymgr.display(self.hotkey_code, self.hotkey_mods))
             self.hotkey_only_btn['state'] = tk.NORMAL
             self.hotkey_play_btn['state'] = tk.NORMAL
         else:
             event.widget.insert(0, _('None'))	# No hotkey/shortcut currently defined
             self.hotkey_only_btn['state'] = tk.DISABLED
             self.hotkey_play_btn['state'] = tk.DISABLED
         self.hotkey_only_btn.focus()	# move to next widget - calls hotkeyend() implicitly
     return('break')	# stops further processing - insertion, Tab traversal etc