aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-11-19 19:52:21 -0500
committerTeddy Wing2015-11-19 19:52:21 -0500
commitfe525afbdf87291277c45295a02870f74094023b (patch)
tree6b61c4f121213220c6f9cb40d025f34e6b0e8b87
parent549de182e493efc10448162c825a9e6c956e4af2 (diff)
downloadRoboFont-Equalize-Sidebearings-Key-fe525afbdf87291277c45295a02870f74094023b.tar.bz2
observer_test.py: Center on 'a' key press
A lot of testing code from when I was trying to get this to work. Actually just trying to inspect the objects/event. Unfortunately, `print`ing and `pdb` don't seem to work. Fortunately managed to get enough information from the `ObjectBrowser` once I figured out that I could use that for inspecting. The `print 'test'` at the end was just for me to confirm that the script was running when I couldn't see any outward evidence of that fact. Finally figured out what was going on and now the script will center when you press 'a' in the Space Center. Future enhancements include: * Add undo support * Make sure `center()` does what we're looking for and actually equalises sidebearings * Add a setting that allows users of the plugin to customise the hotkey through a custom interface (and ideally through a text configuration file as well).
-rw-r--r--observer_test.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/observer_test.py b/observer_test.py
index b339b4a..dcb7a7e 100644
--- a/observer_test.py
+++ b/observer_test.py
@@ -1,10 +1,21 @@
from mojo.events import addObserver
+import vanilla
class EqualizeSidebearings(object):
def __init__(self):
addObserver(self, 'center', 'spaceCenterKeyUp')
def center(self, info):
- print info
+ # print info
+ # self.w = vanilla.Window((400, 400, 1000, 900))
+ # self.w.text = vanilla.TextBox((10, 10, -10, 900), str(dir(info['spaceCenter'])))
+ # self.w.b = vanilla.EditText((0, 0, -0, -0), info['event'].characters())
+ # self.w.text = vanilla.TextBox((10, 10, -10, 900), info['event'].characters)
+ # self.w.open()
+
+ if info['event'].characters() == 'a':
+ info['glyph'].center()
-EqualizeSidebearings() \ No newline at end of file
+EqualizeSidebearings()
+
+print 'test' \ No newline at end of file