19 |
|
|
20 |
from math import hypot |
from math import hypot |
21 |
|
|
22 |
from wxPython.wx import wxWindow, wxYield,\ |
from wxPython.wx import wxWindow, \ |
23 |
wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\ |
wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\ |
24 |
EVT_PAINT, EVT_LEFT_DOWN, EVT_LEFT_UP, EVT_MOTION, EVT_LEAVE_WINDOW, \ |
EVT_PAINT, EVT_LEFT_DOWN, EVT_LEFT_UP, EVT_MOTION, EVT_LEAVE_WINDOW, \ |
25 |
wxBITMAP_TYPE_XPM, wxCursor, wxImageFromBitmap, wxPlatform |
wxBITMAP_TYPE_XPM, wxCursor, wxImageFromBitmap, wxPlatform, \ |
26 |
|
wxBeginBusyCursor, wxEndBusyCursor |
27 |
|
|
28 |
|
|
29 |
# Export related stuff |
# Export related stuff |
30 |
if wxPlatform == '__WXMSW__': |
if wxPlatform == '__WXMSW__': |
45 |
from Thuban.Lib.connector import Publisher |
from Thuban.Lib.connector import Publisher |
46 |
from Thuban.Model.color import Color |
from Thuban.Model.color import Color |
47 |
|
|
|
from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor |
|
|
|
|
48 |
import resource |
import resource |
49 |
|
|
50 |
from selection import Selection |
from selection import Selection |
381 |
|
|
382 |
def OnPaint(self, event): |
def OnPaint(self, event): |
383 |
dc = wxPaintDC(self) |
dc = wxPaintDC(self) |
384 |
|
|
385 |
clear = self.map is None or not self.map.HasLayers() |
clear = self.map is None or not self.map.HasLayers() |
386 |
|
|
387 |
ThubanBeginBusyCursor() |
wxBeginBusyCursor() |
388 |
try: |
try: |
389 |
if not clear: |
if not clear: |
390 |
self.do_redraw() |
self.do_redraw() |
391 |
try: |
else: |
|
pass |
|
|
except: |
|
|
print "Error during drawing:", sys.exc_info()[0] |
|
|
clear = True |
|
|
|
|
|
if clear: |
|
392 |
# If we've got no map or if the map is empty, simply clear |
# If we've got no map or if the map is empty, simply clear |
393 |
# the screen. |
# the screen. |
394 |
|
|
400 |
dc.Clear() |
dc.Clear() |
401 |
dc.EndDrawing() |
dc.EndDrawing() |
402 |
finally: |
finally: |
403 |
ThubanEndBusyCursor() |
wxEndBusyCursor() |
404 |
|
|
405 |
def do_redraw(self): |
def do_redraw(self): |
406 |
# This should only be called if we have a non-empty map. |
# This should only be called if we have a non-empty map. |