Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Repair hotkeys functional

  • Loading branch information...
commit c07e1451c834eb9cf6c25f61d0af51feb8a9831d 1 parent 17fbcc0
@zavlab1 zavlab1 authored
View
28 src/foobnix/preferences/configs/hotkey_conf.py
@@ -21,7 +21,7 @@ def activate_hot_key(command):
thread.start_new_thread(os.system, (command,))
def add_key_binder(command, hotkey):
- try:
+ try:
keybinder.bind(hotkey, activate_hot_key, command)
except Exception, e:
logging.warn("add_key_binder exception" + str(hotkey) + str(e))
@@ -113,24 +113,23 @@ def on_add_row(self, *args):
command = self.action_text.get_text()
hotkey = self.hotkey_text.get_text()
if command and hotkey:
- if command not in self.get_all_items():
- self.model.append([command, hotkey])
- add_key_binder(command, hotkey);
-
+ if hotkey not in self.get_all_items():
+ if command in self.get_all_items():
+ for item in self.model:
+ if item[0] == command:
+ item[1] = hotkey
+ else:
+ self.model.append([command, hotkey])
+
self.action_text.set_text("")
self.hotkey_text.set_text("")
-
-
+
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
-
+
def unbind_all(self):
items = self.get_all_items()
for keystring in items:
@@ -172,9 +171,10 @@ def on_load(self):
self.model.append([command, hotkey])
def on_save(self):
- FC().action_hotkey = self.get_all_items()
- bind_all(self.get_all_items())
self.unbind_all()
+ FC().action_hotkey = self.get_all_items()
+ bind_all(FC().action_hotkey)
+
def get_all_items(self):
items = {}
View
9 src/foobnix/util/key_utils.py
@@ -4,6 +4,7 @@
@author: ivan
'''
import gtk
+
KEY_DELETE = 'Delete'
KEY_RETURN = 'Return'
@@ -22,14 +23,14 @@ def is_key_enter(e):
return is_key(e,'Return') or is_key(e,'KP_Enter')
def is_key_control(event):
- return event.state == gtk.gdk.CONTROL_MASK #@UndefinedVariable
+ return event.state & gtk.gdk.CONTROL_MASK #@UndefinedVariable
def is_key_shift(event):
- return event.state == gtk.gdk.SHIFT_MASK #@UndefinedVariable
+ return event.state & gtk.gdk.SHIFT_MASK #@UndefinedVariable
def is_key_super(event):
- return event.state == gtk.gdk.SUPER_MASK #@UndefinedVariable
+ return (event.state & gtk.gdk.SUPER_MASK) #@UndefinedVariable
def is_key_alt(event):
- return event.state == gtk.gdk.MOD1_MASK | gtk.gdk.MOD2_MASK #@UndefinedVariable
+ return event.state & gtk.gdk.MOD1_MASK# | gtk.gdk.MOD2_MASK #@UndefinedVariable
Please sign in to comment.
Something went wrong with that request. Please try again.