-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmoveGlyphWinow.py
39 lines (28 loc) · 1.07 KB
/
moveGlyphWinow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from vanilla import *
class MoveGlyphWindow:
def __init__(self, glyph):
if glyph is None:
print "There should be a glyph window selected!!"
return
self.glyph = glyph
self.moveX = 0
self.moveY = 0
self.w = Window((200, 60), "Move %s" %self.glyph.name)
self.w.hs = Slider((10, 10, -10, 22), value=0,
maxValue=200,
minValue=-200,
callback=self.adjust)
self.w.vs = Slider((10, 30, -10, 22), value=0,
maxValue=200,
minValue=-200,
callback=self.adjust)
self.w.open()
def adjust(self, sender):
hValue = self.w.hs.get()
vValue = self.w.vs.get()
x = self.moveX - hValue
y = self.moveY - vValue
self.moveX = hValue
self.moveY = vValue
self.glyph.move((x, y))
OpenWindow(MoveGlyphWindow, CurrentGlyph())