[bug 681] Plugin Submission + Generic Plugin Utility Functions & KeyBinding Feature: Mouseless / Mousefree / Keyboard URL opening or yanking #681
- renamed api interfacted for better clarity - removed double checking of short-cut binding for plugins in keybindings
This commit is contained in:
parent
8edebc6ca5
commit
8e5e6d1642
|
@ -723,7 +723,7 @@ class ConfigBase(Borg):
|
|||
from terminatorlib.plugin import KeyBindUtil
|
||||
# for plugin KeyBindUtil assist in plugin_util
|
||||
keybindutil = KeyBindUtil();
|
||||
keyb_keys = keybindutil.get_act_to_keys()
|
||||
keyb_keys = keybindutil.get_all_act_to_keys()
|
||||
# we only need keys as a reference so to match them
|
||||
# against new values
|
||||
keyb_keys = dict.fromkeys(keyb_keys, "")
|
||||
|
|
|
@ -303,8 +303,22 @@ class KeyBindUtil:
|
|||
dbg("keyaction: (%s)" % str(ret))
|
||||
return self.map_key_to_act.get(ret, None)
|
||||
|
||||
def get_act_to_keys(self):
|
||||
def get_act_to_keys(self, key):
|
||||
return self.map_act_to_keys.get(key)
|
||||
|
||||
def get_all_act_to_keys(self):
|
||||
return self.map_act_to_keys
|
||||
|
||||
def get_act_to_desc(self):
|
||||
def get_all_act_to_desc(self):
|
||||
return self.map_act_to_desc
|
||||
|
||||
def get_act_to_desc(self, act):
|
||||
return self.map_act_to_desc.get(act)
|
||||
|
||||
#get action to key binding from config
|
||||
def get_act_to_keys_config(self, act):
|
||||
if not self.config:
|
||||
raise Warning("get_keyvalmask_for_act called without config init")
|
||||
|
||||
keybindings = self.config["keybindings"]
|
||||
return keybindings.get(act)
|
||||
|
|
|
@ -464,8 +464,8 @@ class PrefsEditor:
|
|||
keybindings = self.config['keybindings']
|
||||
|
||||
keybindutil = KeyBindUtil()
|
||||
plugin_keyb_act = keybindutil.get_act_to_keys()
|
||||
plugin_keyb_desc = keybindutil.get_act_to_desc()
|
||||
plugin_keyb_act = keybindutil.get_all_act_to_keys()
|
||||
plugin_keyb_desc = keybindutil.get_all_act_to_desc()
|
||||
#merge give preference to main bindings over plugin
|
||||
keybindings = {**plugin_keyb_act, **keybindings}
|
||||
self.keybindingnames = {**plugin_keyb_desc, **self.keybindingnames}
|
||||
|
@ -1817,7 +1817,7 @@ class PrefsEditor:
|
|||
keybindutil = KeyBindUtil()
|
||||
keybindings = self.config["keybindings"]
|
||||
#merge give preference to main bindings over plugin
|
||||
plugin_keyb_act = keybindutil.get_act_to_keys()
|
||||
plugin_keyb_act = keybindutil.get_all_act_to_keys()
|
||||
keybindings = {**plugin_keyb_act, **keybindings}
|
||||
|
||||
duplicate_bindings = []
|
||||
|
@ -1865,13 +1865,11 @@ class PrefsEditor:
|
|||
accel = Gtk.accelerator_name(key, mods)
|
||||
self.config['keybindings'][binding] = accel
|
||||
|
||||
plugin_keyb_desc = keybindutil.get_act_to_desc()
|
||||
|
||||
if binding in plugin_keyb_desc:
|
||||
if binding in plugin_keyb_desc:
|
||||
desc = plugin_keyb_desc[binding]
|
||||
dbg("modifying plugin binding: %s, %s, %s" % (desc, binding, accel))
|
||||
keybindutil.bindkey([desc, binding, accel])
|
||||
plugin_keyb_desc = keybindutil.get_act_to_desc(binding)
|
||||
if plugin_keyb_desc:
|
||||
dbg("modifying plugin binding: %s, %s, %s" %
|
||||
(plugin_keyb_desc, binding, accel))
|
||||
keybindutil.bindkey([plugin_keyb_desc, binding, accel])
|
||||
else:
|
||||
dbg("skipping: %s" % binding)
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue