10 |
def __init__(self, fenPDF): |
def __init__(self, fenPDF): |
11 |
self.fenPDF = fenPDF |
self.fenPDF = fenPDF |
12 |
|
|
13 |
|
# Whether the next mouse click should be eaten |
14 |
|
# Used when a mouse press did something. |
15 |
|
self._eatNextClick = 0 |
16 |
|
|
17 |
|
|
18 |
def mouse(self, ev, oldvs): |
def mouse(self, ev, oldvs): |
19 |
""" Callback from buoymanager, should not do context things.. |
""" Callback from buoymanager, should not do context things.. |
22 |
""" |
""" |
23 |
if dbg: p(ev) |
if dbg: p(ev) |
24 |
|
|
25 |
|
# MouseMenu will want to know if the mouse is pressed |
26 |
|
# to remove itself if the press is not inside |
27 |
|
# the menu. |
28 |
|
# |
29 |
|
# In addition to the PRESSED, |
30 |
|
# we need to eat the next MOUSE_CLICKED event. |
31 |
|
if ev.getType() == ev.MOUSE_PRESSED: |
32 |
|
# If a previous PRESSED didn't end as a click |
33 |
|
# because of a drag, don't eat the following click. |
34 |
|
self._eatNextClick = 0 |
35 |
|
if self.fenPDF.uistate.menu.shown and \ |
36 |
|
not self.fenPDF.events.mousemenu.mousePressed(ev) : |
37 |
|
p("Eating next click") |
38 |
|
self._eatNextClick = 1 |
39 |
|
return 1 |
40 |
|
|
41 |
|
if dbg: p("1", self._eatNextClick) |
42 |
|
|
43 |
if ev.getType() == ev.MOUSE_CLICKED: |
if ev.getType() == ev.MOUSE_CLICKED: |
44 |
if (self.fenPDF.events.mousemenu.mouse(ev) or |
if self._eatNextClick: |
45 |
|
self._eatNextClick = 0 |
46 |
|
return 1 |
47 |
|
if (self.fenPDF.events.mousemenu.mouseClicked(ev) or |
48 |
self.fenPDF.events.buttons.mouseEvent(ev, oldvs)): |
self.fenPDF.events.buttons.mouseEvent(ev, oldvs)): |
49 |
p('context seen, now cleaning it') |
p('context seen, now cleaning it') |
50 |
self.context.clean() |
self.context.clean() |
54 |
|
|
55 |
self.context.clean() |
self.context.clean() |
56 |
|
|
57 |
|
if dbg: p("2") |
58 |
|
|
59 |
if ev.getType() == ev.MOUSE_RELEASED: |
if ev.getType() == ev.MOUSE_RELEASED: |
60 |
p('mainMouse released? - there\'s a bug in here!') |
p('mainMouse released? - there\'s a bug in here!') |
61 |
|
|
73 |
return 1 |
return 1 |
74 |
|
|
75 |
# There is a bug in AbstractUpdateManager code(?) and that's why now is must to return. |
# There is a bug in AbstractUpdateManager code(?) and that's why now is must to return. |
76 |
|
if dbg: p("3") |
77 |
|
|
78 |
|
|
79 |
self.context.states.lastEvent = ev |
self.context.states.lastEvent = ev |
80 |
|
|
81 |
buoymanager = self.fenPDF.views.getBuoyManager() |
buoymanager = self.fenPDF.views.getBuoyManager() |
85 |
vob.AbstractUpdateManager.chg() |
vob.AbstractUpdateManager.chg() |
86 |
return 1 |
return 1 |
87 |
|
|
88 |
|
if dbg: p("3") |
89 |
|
|
90 |
if ev.getType() == ev.MOUSE_DRAGGED: |
if ev.getType() == ev.MOUSE_DRAGGED: |
91 |
if buoymanager.singles[buoymanager.lastIndex].mainNode.mouse(ev, buoymanager.vs): |
if buoymanager.singles[buoymanager.lastIndex].mainNode.mouse(ev, buoymanager.vs): |
94 |
vob.AbstractUpdateManager.chg() |
vob.AbstractUpdateManager.chg() |
95 |
return 1 |
return 1 |
96 |
|
|
97 |
|
if dbg: p("4") |
98 |
|
|
99 |
buoyhit = buoymanager.findIfBuoyHit(buoymanager.vs, ev.getX(), ev.getY()) |
buoyhit = buoymanager.findIfBuoyHit(buoymanager.vs, ev.getX(), ev.getY()) |
100 |
if buoyhit != None: |
if buoyhit != None: |
101 |
single, link = buoyhit |
single, link = buoyhit |
105 |
return 1 |
return 1 |
106 |
return 0 |
return 0 |
107 |
|
|
108 |
|
if dbg: p("5") |
109 |
|
|
110 |
topmostMainNode = buoymanager.findTopmostMainNode(buoymanager.vs, ev.getX(), ev.getY()) |
topmostMainNode = buoymanager.findTopmostMainNode(buoymanager.vs, ev.getX(), ev.getY()) |
111 |
|
|
112 |
# If the most upper main node is available use it. |
# If the most upper main node is available use it. |