@@ -1826,8 +1826,8 @@ def remove_rubberband(self, dc=None):
1826
1826
self ._rect = None
1827
1827
1828
1828
1829
- class _TableDialog (wx .Dialog ):
1830
- def __init__ (self , parent , help , title = "Help" ):
1829
+ class _HelpDialog (wx .Dialog ):
1830
+ def __init__ (self , parent , help_entries , title = "Help" ):
1831
1831
wx .Dialog .__init__ (self , parent , title = title ,
1832
1832
style = wx .DEFAULT_DIALOG_STYLE | wx .RESIZE_BORDER )
1833
1833
@@ -1836,7 +1836,7 @@ def __init__(self, parent, help, title="Help"):
1836
1836
# create and add the entries
1837
1837
widths = [100 , 140 , 300 ]
1838
1838
bold = self .GetFont ().MakeBold ()
1839
- for r , row in enumerate (help ):
1839
+ for r , row in enumerate (help_entries ):
1840
1840
for (col , width ) in zip (row , widths ):
1841
1841
label = wx .StaticText (self , label = col )
1842
1842
if r == 0 :
@@ -1851,18 +1851,25 @@ def __init__(self, parent, help, title="Help"):
1851
1851
sizer .Fit (self )
1852
1852
self .Layout ()
1853
1853
self .Bind (wx .EVT_CLOSE , self .OnClose )
1854
+ OK .Bind (wx .EVT_BUTTON , self .OnClose )
1854
1855
1855
1856
def OnClose (self , evt ):
1857
+ HelpWx .dlg = None
1856
1858
self .DestroyLater ()
1857
1859
evt .Skip ()
1858
1860
1859
1861
1860
1862
class HelpWx (backend_tools .ToolHelpBase ):
1863
+ dlg = None
1861
1864
def trigger (self , * args ):
1862
- help = [("Action" ,"Shortcuts" , "Description" )]
1863
- help += self ._get_help_entries ()
1864
- dlg = _TableDialog (self .figure .canvas .GetTopLevelParent (), help )
1865
- dlg .Show ()
1865
+ if self .dlg :
1866
+ self .dlg .Raise ()
1867
+ return
1868
+ help_entries = [("Action" , "Shortcuts" , "Description" )]
1869
+ help_entries += self ._get_help_entries ()
1870
+ self .dlg = _HelpDialog (self .figure .canvas .GetTopLevelParent (),
1871
+ help_entries )
1872
+ self .dlg .Show ()
1866
1873
1867
1874
1868
1875
backend_tools .ToolSaveFigure = SaveFigureWx
0 commit comments