aboutsummaryrefslogtreecommitdiffstats
path: root/preferences.py
diff options
context:
space:
mode:
Diffstat (limited to 'preferences.py')
-rw-r--r--preferences.py33
1 files changed, 26 insertions, 7 deletions
diff --git a/preferences.py b/preferences.py
index 7f6434c..637ad64 100644
--- a/preferences.py
+++ b/preferences.py
@@ -1,12 +1,31 @@
-import vanilla
+from mojo.extensions import getExtensionDefault, setExtensionDefault
+# from lib.doodlePreferences import HotKeyItem
-class EqualizeSidebearingsPreferences(object):
+
+class Preferences(object):
+ DEFAULT_ACTIVATION_KEY = 'e'
+ PREFERENCES_DOMAIN = 'com.teddywing.EqualizeSidebearings'
def __init__(self):
- self.w = vanilla.Window((150, 50), 'Equalize Sidebearings')
- self.w.activation_key_label = vanilla.TextBox((10, 15, -10, 22), 'Short Key:')
- self.w.activation_key = vanilla.EditText((82, 12, -10, 25), 'e')
- self.w.open()
+ self.load()
+
+ def preference_key(self, key):
+ return '{0}.{1}'.format(self.PREFERENCES_DOMAIN, key)
+
+ def load(self):
+ self._activation_key = getExtensionDefault(
+ self.preference_key('activation_key'),
+ self.DEFAULT_ACTIVATION_KEY)
+
+ def save(self):
+ setExtensionDefault(
+ self.preference_key('activation_key'),
+ self.activation_key)
+ @property
+ def activation_key(self):
+ return self._activation_key
-EqualizeSidebearingsPreferences()
+ @activation_key.setter
+ def activation_key(self, value):
+ self._activation_key = value