305 |
self.dragging = 1 |
self.dragging = 1 |
306 |
|
|
307 |
def OnLeftUp(self, event): |
def OnLeftUp(self, event): |
308 |
self.MouseLeftUp(event) |
"""Handle EVT_LEFT_UP |
309 |
|
|
310 |
|
Release the mouse if it was captured, if a tool is active call |
311 |
|
its Hide method and call self.MouseLeftUp. |
312 |
|
""" |
313 |
|
# It's important that ReleaseMouse is called before MouseLeftUp. |
314 |
|
# MouseLeftUp may pop up modal dialogs which leads to an |
315 |
|
# effectively frozen X session because the user can only |
316 |
|
# interact with the dialog but the mouse is still grabbed by the |
317 |
|
# canvas. |
318 |
if self.dragging: |
if self.dragging: |
319 |
self.ReleaseMouse() |
if self.HasCapture(): |
320 |
|
self.ReleaseMouse() |
321 |
try: |
try: |
322 |
self.tool.Hide(self.drag_dc) |
self.tool.Hide(self.drag_dc) |
323 |
finally: |
finally: |
324 |
self.drag_dc = None |
self.drag_dc = None |
325 |
self.dragging = 0 |
self.dragging = 0 |
326 |
|
self.MouseLeftUp(event) |
327 |
|
|
328 |
def OnMotion(self, event): |
def OnMotion(self, event): |
329 |
if self.dragging: |
if self.dragging: |