@@ -667,8 +667,6 @@ class FigureCanvasWx(FigureCanvasBase, wx.Panel):
667
667
wx .WXK_DELETE : 'delete' ,
668
668
wx .WXK_HOME : 'home' ,
669
669
wx .WXK_END : 'end' ,
670
- wx .WXK_PRIOR : 'pageup' ,
671
- wx .WXK_NEXT : 'pagedown' ,
672
670
wx .WXK_PAGEUP : 'pageup' ,
673
671
wx .WXK_PAGEDOWN : 'pagedown' ,
674
672
wx .WXK_NUMPAD0 : '0' ,
@@ -691,8 +689,6 @@ class FigureCanvasWx(FigureCanvasBase, wx.Panel):
691
689
wx .WXK_NUMPAD_RIGHT : 'right' ,
692
690
wx .WXK_NUMPAD_DOWN : 'down' ,
693
691
wx .WXK_NUMPAD_LEFT : 'left' ,
694
- wx .WXK_NUMPAD_PRIOR : 'pageup' ,
695
- wx .WXK_NUMPAD_NEXT : 'pagedown' ,
696
692
wx .WXK_NUMPAD_PAGEUP : 'pageup' ,
697
693
wx .WXK_NUMPAD_PAGEDOWN : 'pagedown' ,
698
694
wx .WXK_NUMPAD_HOME : 'home' ,
@@ -736,7 +732,10 @@ def do_nothing(*args, **kwargs):
736
732
737
733
738
734
# Create the drawing bitmap
739
- self .bitmap = wx .EmptyBitmap (w , h )
735
+ if 'phoenix' in wx .PlatformInfo :
736
+ self .bitmap = wx .Bitmap (w , h )
737
+ else :
738
+ self .bitmap = wx .EmptyBitmap (w , h )
740
739
DEBUG_MSG ("__init__() - bitmap w:%d h:%d" % (w ,h ), 2 , self )
741
740
# TODO: Add support for 'point' inspection and plot navigation.
742
741
self ._isDrawn = False
@@ -873,7 +872,10 @@ def start_event_loop(self, timeout=0):
873
872
bind (self , wx .EVT_TIMER , self .stop_event_loop , id = id )
874
873
875
874
# Event loop handler for start/stop event loop
876
- self ._event_loop = wx .EventLoop ()
875
+ if 'phoenix' in wx .PlatformInfo :
876
+ self ._event_loop = wx .GUIEventLoop ()
877
+ else :
878
+ self ._event_loop = wx .EventLoop ()
877
879
self ._event_loop .Run ()
878
880
timer .Stop ()
879
881
@@ -897,7 +899,7 @@ def _get_imagesave_wildcards(self):
897
899
'return the wildcard string for the filesave dialog'
898
900
default_filetype = self .get_default_filetype ()
899
901
filetypes = self .get_supported_filetypes_grouped ()
900
- sorted_filetypes = list ( six . iteritems ( filetypes ) )
902
+ sorted_filetypes = filetypes . items ( )
901
903
sorted_filetypes .sort ()
902
904
wildcards = []
903
905
extensions = []
@@ -923,9 +925,12 @@ def gui_repaint(self, drawDC=None):
923
925
if drawDC is None :
924
926
drawDC = wx .ClientDC (self )
925
927
926
- drawDC .BeginDrawing ()
927
- drawDC .DrawBitmap (self .bitmap , 0 , 0 )
928
- drawDC .EndDrawing ()
928
+ if 'phoenix' in wx .PlatformInfo :
929
+ drawDC .DrawBitmap (self .bitmap , 0 , 0 )
930
+ else :
931
+ drawDC .BeginDrawing ()
932
+ drawDC .DrawBitmap (self .bitmap , 0 , 0 )
933
+ drawDC .EndDrawing ()
929
934
#wx.GetApp().Yield()
930
935
else :
931
936
pass
@@ -979,7 +984,11 @@ def _print_image(self, filename, filetype, *args, **kwargs):
979
984
width = int (math .ceil (width ))
980
985
height = int (math .ceil (height ))
981
986
982
- self .bitmap = wx .EmptyBitmap (width , height )
987
+ if 'phoenix' in wx .PlatformInfo :
988
+ self .bitmap = wx .Bitmap (width , height )
989
+ else :
990
+ self .bitmap = wx .EmptyBitmap (width , height )
991
+
983
992
renderer = RendererWx (self .bitmap , self .figure .dpi )
984
993
985
994
gc = renderer .new_gc ()
@@ -1052,7 +1061,11 @@ def _onSize(self, evt):
1052
1061
DEBUG_MSG ("_onSize()" , 2 , self )
1053
1062
# Create a new, correctly sized bitmap
1054
1063
self ._width , self ._height = self .GetClientSize ()
1055
- self .bitmap = wx .EmptyBitmap (self ._width , self ._height )
1064
+ if 'phoenix' in wx .PlatformInfo :
1065
+ self .bitmap = wx .Bitmap (self ._width , self ._height )
1066
+ else :
1067
+ self .bitmap = wx .EmptyBitmap (self ._width , self ._height )
1068
+
1056
1069
self ._isDrawn = False
1057
1070
1058
1071
if self ._width <= 1 or self ._height <= 1 : return # Empty figure
@@ -1636,12 +1649,25 @@ def _init_toolbar(self):
1636
1649
self .AddSeparator ()
1637
1650
continue
1638
1651
self .wx_ids [text ] = wx .NewId ()
1639
- if text in ['Pan' , 'Zoom' ]:
1640
- self .AddCheckTool (self .wx_ids [text ], _load_bitmap (image_file + '.png' ),
1641
- shortHelp = text , longHelp = tooltip_text )
1652
+ if 'phoenix' in wx .PlatformInfo :
1653
+ if text in ['Pan' , 'Zoom' ]:
1654
+ kind = wx .ITEM_CHECK
1655
+ else :
1656
+ kind = wx .ITEM_NORMAL
1657
+ self .AddTool (self .wx_ids [text ], label = text ,
1658
+ bitmap = _load_bitmap (image_file + '.png' ),
1659
+ bmpDisabled = wx .NullBitmap ,
1660
+ shortHelpString = text ,
1661
+ longHelpString = tooltip_text ,
1662
+ kind = kind )
1642
1663
else :
1643
- self .AddSimpleTool (self .wx_ids [text ], _load_bitmap (image_file + '.png' ),
1644
- text , tooltip_text )
1664
+ if text in ['Pan' , 'Zoom' ]:
1665
+ self .AddCheckTool (self .wx_ids [text ], _load_bitmap (image_file + '.png' ),
1666
+ shortHelp = text , longHelp = tooltip_text )
1667
+ else :
1668
+ self .AddSimpleTool (self .wx_ids [text ], _load_bitmap (image_file + '.png' ),
1669
+ text , tooltip_text )
1670
+
1645
1671
bind (self , wx .EVT_TOOL , getattr (self , callback ), id = self .wx_ids [text ])
1646
1672
1647
1673
self .Realize ()
@@ -1700,7 +1726,10 @@ def save_figure(self, *args):
1700
1726
error_msg_wx (str (e ))
1701
1727
1702
1728
def set_cursor (self , cursor ):
1703
- cursor = wx .StockCursor (cursord [cursor ])
1729
+ if 'phoenix' in wx .PlatformInfo :
1730
+ cursor = wx .Cursor (cursord [cursor ])
1731
+ else :
1732
+ cursor = wx .StockCursor (cursord [cursor ])
1704
1733
self .canvas .SetCursor ( cursor )
1705
1734
1706
1735
def release (self , event ):
@@ -1737,7 +1766,8 @@ def draw_rubberband(self, event, x0, y0, x1, y1):
1737
1766
1738
1767
1739
1768
dc .ResetBoundingBox ()
1740
- dc .BeginDrawing ()
1769
+ if not 'phoenix' in wx .PlatformInfo :
1770
+ dc .BeginDrawing ()
1741
1771
height = self .canvas .figure .bbox .height
1742
1772
y1 = height - y1
1743
1773
y0 = height - y0
@@ -1754,7 +1784,8 @@ def draw_rubberband(self, event, x0, y0, x1, y1):
1754
1784
else : dc .DrawRectangle (* lastrect ) #erase last
1755
1785
self .lastrect = rect
1756
1786
dc .DrawRectangle (* rect )
1757
- dc .EndDrawing ()
1787
+ if not 'phoenix' in wx .PlatformInfo :
1788
+ dc .EndDrawing ()
1758
1789
1759
1790
def set_status_bar (self , statbar ):
1760
1791
self .statbar = statbar
0 commit comments