41 |
set.add(node) |
set.add(node) |
42 |
self.multiplexer.setMultiplexerNodes(set) |
self.multiplexer.setMultiplexerNodes(set) |
43 |
|
|
44 |
|
class Selection: |
45 |
|
"""A selected area |
46 |
|
|
47 |
|
self.area = x0,y0,x1,y1 |
48 |
|
""" |
49 |
|
def __init__(self): |
50 |
|
self.area = [0,0,0,0] |
51 |
|
self.mainNode = None |
52 |
|
def getArea(self): return self.area |
53 |
|
def getMainNode(self): return self.mainNode |
54 |
|
def setArea(self, area, mainNode): |
55 |
|
self.area = area |
56 |
|
self.mainNode = mainNode |
57 |
|
def hasSelection(self): |
58 |
|
a = self.area |
59 |
|
return (a[0]-a[2]) != 0 and (a[1]-a[3]) != 0 |
60 |
|
def getXYWH(self): |
61 |
|
"""Return a x, y, width, height tuple. |
62 |
|
""" |
63 |
|
a = self.area |
64 |
|
if a[2] > a[0]: |
65 |
|
x = a[0] |
66 |
|
w = a[2]-a[0] |
67 |
|
else: |
68 |
|
x = a[2] |
69 |
|
w = a[0]-a[2] |
70 |
|
if a[3] > a[1]: |
71 |
|
y = a[1] |
72 |
|
h = a[3]-a[1] |
73 |
|
else: |
74 |
|
y = a[3] |
75 |
|
h = a[1]-a[3] |
76 |
|
return (x, y, w, h) |
77 |
|
|
78 |
class ContextStates: |
class ContextStates: |
79 |
def __init__(self, fen, ppAction): |
def __init__(self, fen, ppAction): |
80 |
self.clean() |
self.clean() |
88 |
# main view mouse multiplexer |
# main view mouse multiplexer |
89 |
self.mainMouse = None |
self.mainMouse = None |
90 |
|
|
|
class Selection: |
|
|
"""A selected area |
|
|
|
|
|
self.area = x0,y0,x1,y1 |
|
|
""" |
|
|
def __init__(self): |
|
|
self.area = [0,0,0,0] |
|
|
self.mainNode = None |
|
|
def getArea(self): return self.area |
|
|
def getMainNode(self): return self.mainNode |
|
|
def setArea(self, area, mainNode): |
|
|
self.area = area |
|
|
self.mainNode = mainNode |
|
|
def hasSelection(self): |
|
|
a = self.area |
|
|
return (a[0]-a[2]) != 0 and (a[1]-a[3]) != 0 |
|
|
def getXYWH(self): |
|
|
"""Return a x, y, width, height tuple. |
|
|
""" |
|
|
a = self.area |
|
|
if a[2] > a[0]: |
|
|
x = a[0] |
|
|
w = a[2]-a[0] |
|
|
else: |
|
|
x = a[2] |
|
|
w = a[0]-a[2] |
|
|
if a[3] > a[1]: |
|
|
y = a[1] |
|
|
h = a[3]-a[1] |
|
|
else: |
|
|
y = a[3] |
|
|
h = a[1]-a[3] |
|
|
return (x, y, w, h) |
|
|
self.selection = Selection() |
|
|
|
|
91 |
# kludge to keep flag how BuoyViewMainNode.mouse() should return. |
# kludge to keep flag how BuoyViewMainNode.mouse() should return. |
92 |
# see AbstractMainNode2D.mouse() |
# see AbstractMainNode2D.mouse() |
93 |
self.fastChg = 0 |
self.fastChg = 0 |