@@ -61,7 +61,7 @@ def DEBUG_MSG(string, lvl=3, o=None):
61
61
# Jeremy, often times the commented line won't print but the
62
62
# one below does. I think WX is redefining stderr, damned
63
63
# beast
64
- #print >>sys.stderr, "%s- %s in %s" % (_DEBUG_lvls[lvl], string, cls)
64
+ # print >>sys.stderr, "%s- %s in %s" % (_DEBUG_lvls[lvl], string, cls)
65
65
print ("%s- %s in %s" % (_DEBUG_lvls [lvl ], string , cls ))
66
66
67
67
@@ -82,10 +82,6 @@ class fake_stderr(object):
82
82
def write (self , msg ):
83
83
print ("Stderr: %s\n \r " % msg )
84
84
85
- #if _DEBUG < 5:
86
- #sys.excepthook = debug_on_error
87
- #WxLogger =wx.LogStderr()
88
- #sys.stderr = fake_stderr
89
85
90
86
# the True dots per inch on the screen; should be display dependent
91
87
# see
@@ -410,7 +406,7 @@ class GraphicsContextWx(GraphicsContextBase):
410
406
411
407
def __init__ (self , bitmap , renderer ):
412
408
GraphicsContextBase .__init__ (self )
413
- #assert self.Ok(), "wxMemoryDC not OK to use"
409
+ # assert self.Ok(), "wxMemoryDC not OK to use"
414
410
DEBUG_MSG ("__init__()" , 1 , self )
415
411
DEBUG_MSG ("__init__() 2: %s" % bitmap , 1 , self )
416
412
@@ -1201,10 +1197,10 @@ def __init__(self, num, fig):
1201
1197
# This is not currently working on Linux and is untested elsewhere.
1202
1198
# icon_path = os.path.join(matplotlib.rcParams['datapath'],
1203
1199
# 'images', 'matplotlib.png')
1204
- #icon = wx.IconFromBitmap(wx.Bitmap(icon_path))
1205
- # for xpm type icons try:
1206
- #icon = wx.Icon(icon_path, wx.BITMAP_TYPE_XPM)
1207
- # self.SetIcon(icon)
1200
+ # icon = wx.IconFromBitmap(wx.Bitmap(icon_path))
1201
+ # for xpm type icons try:
1202
+ # icon = wx.Icon(icon_path, wx.BITMAP_TYPE_XPM)
1203
+ # self.SetIcon(icon)
1208
1204
1209
1205
self .figmgr = FigureManagerWx (self .canvas , num , self )
1210
1206
@@ -1308,7 +1304,8 @@ def resize(self, width, height):
1308
1304
# Identifiers for toolbar controls - images_wx contains bitmaps for the images
1309
1305
# used in the controls. wxWindows does not provide any stock images, so I've
1310
1306
# 'stolen' those from GTK2, and transformed them into the appropriate format.
1311
- #import images_wx
1307
+ # import images_wx
1308
+
1312
1309
1313
1310
_NTB_AXISMENU = wx .NewId ()
1314
1311
_NTB_AXISMENU_BUTTON = wx .NewId ()
@@ -1320,7 +1317,7 @@ def resize(self, width, height):
1320
1317
_NTB_Y_PAN_DOWN = wx .NewId ()
1321
1318
_NTB_Y_ZOOMIN = wx .NewId ()
1322
1319
_NTB_Y_ZOOMOUT = wx .NewId ()
1323
- #_NTB_SUBPLOT =wx.NewId()
1320
+ # _NTB_SUBPLOT =wx.NewId()
1324
1321
_NTB_SAVE = wx .NewId ()
1325
1322
_NTB_CLOSE = wx .NewId ()
1326
1323
@@ -1513,8 +1510,8 @@ def _init_toolbar(self):
1513
1510
continue
1514
1511
self .wx_ids [text ] = wx .NewId ()
1515
1512
wxc ._AddTool (self , self .wx_ids , text ,
1516
- _load_bitmap (image_file + '.png' ),
1517
- tooltip_text )
1513
+ _load_bitmap (image_file + '.png' ),
1514
+ tooltip_text )
1518
1515
1519
1516
self .Bind (wx .EVT_TOOL , getattr (self , callback ),
1520
1517
id = self .wx_ids [text ])
@@ -1584,12 +1581,6 @@ def set_cursor(self, cursor):
1584
1581
self .canvas .SetCursor (cursor )
1585
1582
self .canvas .Update ()
1586
1583
1587
- def release (self , event ):
1588
- try :
1589
- del self .lastrect
1590
- except AttributeError :
1591
- pass
1592
-
1593
1584
@cbook .deprecated ("2.1" , alternative = "canvas.draw_idle" )
1594
1585
def dynamic_update (self ):
1595
1586
d = self ._idle
@@ -1707,7 +1698,7 @@ def __init__(self, parent):
1707
1698
wx .StatusBar .__init__ (self , parent , - 1 )
1708
1699
self .SetFieldsCount (2 )
1709
1700
self .SetStatusText ("None" , 1 )
1710
- #self.SetStatusText("Measurement: None", 2)
1701
+ # self.SetStatusText("Measurement: None", 2)
1711
1702
# self.Reposition()
1712
1703
1713
1704
def set_function (self , string ):
@@ -1767,7 +1758,7 @@ def set_cursor(self, cursor):
1767
1758
self .canvas .Update ()
1768
1759
1769
1760
1770
- if not 'wxMac' in wx .PlatformInfo :
1761
+ if 'wxMac' not in wx .PlatformInfo :
1771
1762
# on most platforms, use overlay
1772
1763
class RubberbandWx (backend_tools .RubberbandBase ):
1773
1764
def __init__ (self , * args , ** kwargs ):
@@ -1813,7 +1804,8 @@ def draw_rubberband(self, x0, y0, x1, y1):
1813
1804
dc .DrawRectangleRect (rect )
1814
1805
1815
1806
def remove_rubberband (self ):
1816
- if self .wxoverlay is None : return
1807
+ if self .wxoverlay is None :
1808
+ return
1817
1809
self .wxoverlay .Reset ()
1818
1810
self .wxoverlay = None
1819
1811
@@ -1831,29 +1823,31 @@ def draw_rubberband(self, x0, y0, x1, y1):
1831
1823
# this would be required if the Canvas is a ScrolledWindow,
1832
1824
# which is not the case for now
1833
1825
# self.PrepareDC(dc)
1834
-
1826
+
1835
1827
# delete old rubberband
1836
- if self ._rect : self .remove_rubberband (dc )
1837
-
1828
+ if self ._rect :
1829
+ self .remove_rubberband (dc )
1830
+
1838
1831
# draw new rubberband
1839
- dc .SetPen (wx .Pen (wx .BLACK , 1 , wx .SOLID ))
1832
+ dc .SetPen (wx .Pen (wx .BLACK , 1 , wx .SOLID ))
1840
1833
dc .SetBrush (wx .TRANSPARENT_BRUSH )
1841
- self ._rect = (x0 ,self .canvas ._height - y0 , x1 - x0 , - y1 + y0 )
1834
+ self ._rect = (x0 , self .canvas ._height - y0 , x1 - x0 , - y1 + y0 )
1842
1835
if wxc .is_phoenix :
1843
1836
dc .DrawRectangle (self ._rect )
1844
1837
else :
1845
1838
dc .DrawRectangleRect (self ._rect )
1846
1839
1847
1840
def remove_rubberband (self , dc = None ):
1848
- if not self ._rect : return
1841
+ if not self ._rect :
1842
+ return
1849
1843
if self .canvas .bitmap :
1850
1844
if dc is None :
1851
1845
dc = wx .ClientDC (self .canvas )
1852
1846
dc .DrawBitmap (self .canvas .bitmap , 0 , 0 )
1853
- # for testing the method on Windows, use this code instead:
1854
- #img = self.canvas.bitmap.ConvertToImage()
1855
- #bmp = img.ConvertToBitmap()
1856
- #dc.DrawBitmap(bmp, 0, 0)
1847
+ # for testing the method on Windows, use this code instead:
1848
+ # img = self.canvas.bitmap.ConvertToImage()
1849
+ # bmp = img.ConvertToBitmap()
1850
+ # dc.DrawBitmap(bmp, 0, 0)
1857
1851
self ._rect = None
1858
1852
1859
1853
@@ -1862,8 +1856,7 @@ def remove_rubberband(self, dc=None):
1862
1856
backend_tools .ToolRubberband = RubberbandWx
1863
1857
1864
1858
1865
-
1866
- #< Additions for printing support: Matt Newville
1859
+ # < Additions for printing support: Matt Newville
1867
1860
1868
1861
class PrintoutWx (wx .Printout ):
1869
1862
"""
@@ -1938,25 +1931,26 @@ def OnPrintPage(self, page):
1938
1931
# this cute little number avoid API inconsistencies in wx
1939
1932
try :
1940
1933
dc .DrawBitmap (self .canvas .bitmap , 0 , 0 )
1941
- except :
1934
+ except Exception :
1942
1935
try :
1943
1936
dc .DrawBitmap (self .canvas .bitmap , (0 , 0 ))
1944
- except :
1937
+ except Exception :
1945
1938
pass
1946
1939
1947
1940
# restore original figure resolution
1948
1941
self .canvas .figure .set_facecolor (bgcolor )
1949
1942
self .canvas .figure .dpi = fig_dpi
1950
1943
self .canvas .draw ()
1951
1944
return True
1952
- #>
1945
+ # >
1953
1946
1954
1947
########################################################################
1955
1948
#
1956
1949
# Now just provide the standard names that backend.__init__ is expecting
1957
1950
#
1958
1951
########################################################################
1959
1952
1953
+
1960
1954
Toolbar = NavigationToolbar2Wx
1961
1955
1962
1956
0 commit comments