[GRASS-SVN] r32010 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 6 05:52:20 EDT 2008
Author: martinl
Date: 2008-07-06 05:52:20 -0400 (Sun, 06 Jul 2008)
New Revision: 32010
Modified:
grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: Add 'Help' button as in gis.m, trac #221
Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2008-07-06 09:27:44 UTC (rev 32009)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2008-07-06 09:52:20 UTC (rev 32010)
@@ -650,6 +650,10 @@
btn_cancel.SetToolTipString(_("Cancel the command settings and ignore changes"))
btnsizer.Add(item=btn_cancel, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=10)
btn_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
+ # help
+ btn_help = wx.Button(parent=self.panel, id=wx.ID_HELP)
+ btn_help.SetToolTipString(_("Show manual page of the command"))
+ btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)
if self.get_dcmd is not None: # A callback has been set up
btn_apply = wx.Button(parent=self.panel, id=wx.ID_APPLY)
btn_ok = wx.Button(parent=self.panel, id=wx.ID_OK)
@@ -693,6 +697,9 @@
self.btn_abort.Bind(wx.EVT_BUTTON, self.OnAbort)
btn_clipboard.Bind(wx.EVT_BUTTON, self.OnCopy)
+ # add help button
+ btnsizer.Add(item=btn_help, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=10)
+
guisizer.Add(item=btnsizer, proportion=0, flag=wx.ALIGN_CENTER)
if self.get_dcmd is None:
@@ -825,6 +832,14 @@
else:
self.Destroy()
+ def OnHelp(self, event):
+ """Show manual page (switch to the 'Manual' notebook page)"""
+ if hasattr(self.notebookpanel, "manual_tab_id"):
+ self.notebookpanel.notebook.SetSelection(self.notebookpanel.manual_tab_id)
+ self.notebookpanel.OnPageChange(None)
+
+ event.Skip()
+
def OnCloseWindow(self, event):
"""Close the main window"""
self.MakeModal(False)
@@ -1240,11 +1255,17 @@
event.Skip()
def OnPageChange(self, event):
+ if not event:
+ sel = self.notebook.GetSelection()
+ else:
+ sel = event.GetSelection()
+
if hasattr(self, "manual_tab_id") and \
- event.GetSelection() == self.manual_tab_id:
+ sel == self.manual_tab_id:
# calling LoadPage() is strangely time-consuming (only first call)
# FIXME: move to helpPage.__init__()
if not self.manual_tab.Ok:
+ wx.Yield()
self.manual_tab.LoadPage(self.manual_tab.fspath + self.task.name + ".html")
self.manual_tab.Ok = True
More information about the grass-commit
mailing list