bindingprofile: Remove a bunch of (now) worthless methods

We no longer need to serialize to g13d command strings.
This commit is contained in:
June Tate-Gans 2021-05-04 01:42:38 -05:00
parent ccca4b5016
commit 17350fa524

View File

@ -72,35 +72,6 @@ class BindingProfile(Subject):
self._bindKey(gkey, keybinding) self._bindKey(gkey, keybinding)
self.notifyChanged() self.notifyChanged()
def _lcdColorToCommandString(self):
return 'rgb %d %d %d' % tuple([int(x * 255) for x in self._lcdColor])
def _keyBindingToCommandString(self, gkey):
kbdkey = self._keyBindings[gkey]
if len(kbdkey) > 0:
keys = '+'.join(['KEY_' + key for key in kbdkey])
return "bind %s %s" % (gkey, keys)
else:
return "unbind %s" % (gkey)
def toCommandString(self):
commands = []
commands.append(self._lcdColorToCommandString())
for gkey in self._keyBindings.keys():
commands.append(self._keyBindingToCommandString(gkey))
if self._stickMode == bindings.StickMode.KEYS:
for region, bounds in self._stickRegions.items():
commands.append("stickzone add %s" % (region))
commands.append("stickzone bounds %s %0.1f %0.1f %0.1f %0.1f" %
(region, *bounds))
keys = ' '.join(['KEY_' + key for key in self._stickRegionBindings[region]])
commands.append("stickzone action %s %s" % (region, keys))
return '\n'.join(commands)
def loadFromDict(self, dict): def loadFromDict(self, dict):
self._lcdColor = dict['lcdcolor'] self._lcdColor = dict['lcdcolor']
self._stickMode = dict['stickMode'] self._stickMode = dict['stickMode']