aboutsummaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'helpers')
-rw-r--r--helpers/key.py2
-rw-r--r--helpers/mapping.py11
2 files changed, 10 insertions, 3 deletions
diff --git a/helpers/key.py b/helpers/key.py
index 7ad0565..363e9ce 100644
--- a/helpers/key.py
+++ b/helpers/key.py
@@ -156,7 +156,7 @@ class Key(ButtonBehavior, Widget):
156 else: 156 else:
157 self.no_actions() 157 self.no_actions()
158 158
159 def on_enter_loaded_running(self): 159 def on_enter_loaded_running(self, modifiers):
160 self.parent.parent.ids['KeyList'].append(self.key_sym) 160 self.parent.parent.ids['KeyList'].append(self.key_sym)
161 debug_print("running actions for {}".format(self.key_sym)) 161 debug_print("running actions for {}".format(self.key_sym))
162 start_time = time.time() 162 start_time = time.time()
diff --git a/helpers/mapping.py b/helpers/mapping.py
index 9c05972..864afbe 100644
--- a/helpers/mapping.py
+++ b/helpers/mapping.py
@@ -100,8 +100,10 @@ class Mapping(RelativeLayout):
100 100
101 def on_keyboard_down(self, keyboard, keycode, text, modifiers): 101 def on_keyboard_down(self, keyboard, keycode, text, modifiers):
102 key = self.find_by_key_code(keycode) 102 key = self.find_by_key_code(keycode)
103 if len(modifiers) == 0 and key is not None: 103 if self.allowed_modifiers(modifiers) and key is not None:
104 threading.Thread(name="MSKeyAction", target=key.run).start() 104 modifiers.sort()
105 threading.Thread(name="MSKeyAction", target=key.run,
106 args=['-'.join(modifiers)]).start()
105 elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'): 107 elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'):
106 self.stop_all_running() 108 self.stop_all_running()
107 for thread in threading.enumerate(): 109 for thread in threading.enumerate():
@@ -112,6 +114,11 @@ class Mapping(RelativeLayout):
112 sys.exit() 114 sys.exit()
113 return True 115 return True
114 116
117 # Helpers
118 def allowed_modifiers(self, modifiers):
119 allowed = []
120 return len([a for a in modifiers if a not in allowed]) == 0
121
115 def find_by_key_code(self, key_code): 122 def find_by_key_code(self, key_code):
116 if "Key_" + str(key_code[0]) in self.ids: 123 if "Key_" + str(key_code[0]) in self.ids:
117 return self.ids["Key_" + str(key_code[0])] 124 return self.ids["Key_" + str(key_code[0])]