2 @package gui_core.ghelp
7 - ghelp::SearchModuleWindow
8 - ghelp::MenuTreeWindow
15 (C) 2008-2011 by the GRASS Development Team
17 This program is free software under the GNU General Public License
18 (>=v2). Read the file COPYING that comes with GRASS for details.
20 @author Martin Landa <landa.martin gmail.com>
30 from wx.html
import HtmlWindow
32 import wx.lib.agw.customtreectrl
as CT
33 from wx.lib.agw.hyperlink
import HyperLinkCtrl
35 import wx.lib.customtreectrl
as CT
36 from wx.lib.hyperlink
import HyperLinkCtrl
37 import wx.lib.flatnotebook
as FN
41 from core
import globalvar
42 from core
import utils
43 from lmgr.menudata
import ManagerData
44 from core.gcmd import GError, DecodeString
45 from gui_core.widgets import GNotebook, StaticWrapText, ItemTree, ScrolledPanel
48 """!Search module window (used in MenuTreeWindow)"""
49 def __init__(self, parent, id = wx.ID_ANY, cmdPrompt = None,
50 showChoice =
True, showTip =
False, **kwargs):
55 wx.Panel.__init__(self, parent = parent, id = id, **kwargs)
57 self.
_searchDict = { _(
'description') :
'description',
58 _(
'command') :
'command',
59 _(
'keywords') :
'keywords' }
61 self.
box = wx.StaticBox(parent = self, id = wx.ID_ANY,
62 label =
" %s " % _(
"Find module(s)"))
64 self.
searchBy = wx.Choice(parent = self, id = wx.ID_ANY,
65 choices = [_(
'description'),
68 self.searchBy.SetSelection(0)
70 self.
search = wx.TextCtrl(parent = self, id = wx.ID_ANY,
71 value =
"", size = (-1, 25),
72 style = wx.TE_PROCESS_ENTER)
76 self.
searchTip = StaticWrapText(parent = self, id = wx.ID_ANY,
82 self.searchChoice.SetItems(self.cmdPrompt.GetCommandItems())
89 sizer = wx.StaticBoxSizer(self.
box, wx.HORIZONTAL)
90 gridSizer = wx.GridBagSizer(hgap = 3, vgap = 3)
94 flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
95 gridSizer.Add(item = self.
search,
96 flag = wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos = (0, 1))
100 flag = wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos = (row, 0), span = (1, 2))
105 flag = wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos = (row, 0), span = (1, 2))
107 gridSizer.AddGrowableCol(1)
108 sizer.Add(item = gridSizer, proportion = 1)
114 """!Get selected element"""
115 selection = self.searchBy.GetStringSelection()
120 """!Set selection element"""
121 self.searchBy.SetSelection(i)
124 """!Search module by keywords or description"""
129 text = event.GetString()
131 self.cmdPrompt.SetFilter(
None)
132 mList = self.cmdPrompt.GetCommandItems()
133 self.searchChoice.SetItems(mList)
135 self.searchTip.SetLabel(_(
"%d modules found") % len(mList))
141 for module, data
in self.cmdPrompt.moduleDesc.iteritems():
143 sel = self.searchBy.GetSelection()
145 if text
in data[
'desc']:
148 if text
in ','.join(data[
'keywords']):
151 if module[:len(text)] == text:
157 group, name = module.split(
'.')
161 if group
not in modules:
162 modules[group] = list()
163 modules[group].append(name)
165 self.cmdPrompt.SetFilter(modules)
166 self.searchChoice.SetItems(self.cmdPrompt.GetCommandItems())
168 self.searchTip.SetLabel(_(
"%d modules found") % iFound)
173 """!Module selected from choice, update command prompt"""
174 cmd = event.GetString().
split(
' ', 1)[0]
179 self.cmdPrompt.SetText(text)
180 self.cmdPrompt.SetSelectionStart(pos)
181 self.cmdPrompt.SetCurrentPos(pos)
182 self.cmdPrompt.SetFocus()
184 desc = self.cmdPrompt.GetCommandDesc(cmd)
186 self.searchTip.SetLabel(desc)
190 self.searchBy.SetSelection(0)
191 self.search.SetValue(
'')
193 self.searchTip.SetLabel(
'')
196 """!Show menu tree"""
197 def __init__(self, parent, id = wx.ID_ANY, **kwargs):
200 wx.Panel.__init__(self, parent = parent, id = id, **kwargs)
202 self.
dataBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
203 label =
" %s " % _(
"Menu tree (double-click to run command)"))
212 self.
btnRun = wx.Button(self, id = wx.ID_OK, label = _(
"&Run"))
213 self.btnRun.SetToolTipString(_(
"Run selected command"))
214 self.btnRun.Enable(
False)
217 self.btnRun.Bind(wx.EVT_BUTTON, self.
OnRun)
220 self.search.Bind(wx.EVT_TEXT_ENTER, self.
OnShowItem)
225 self.search.SetFocus()
228 """!Do dialog layout"""
229 sizer = wx.BoxSizer(wx.VERTICAL)
232 dataSizer = wx.StaticBoxSizer(self.
dataBox, wx.HORIZONTAL)
233 dataSizer.Add(item = self.
tree, proportion =1,
237 btnSizer = wx.BoxSizer(wx.HORIZONTAL)
238 btnSizer.Add(item = self.
btnRun, proportion = 0)
240 sizer.Add(item = dataSizer, proportion = 1,
241 flag = wx.EXPAND | wx.ALL, border = 5)
243 sizer.Add(item = self.
search, proportion = 0,
244 flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 5)
246 sizer.Add(item = btnSizer, proportion = 0,
247 flag = wx.ALIGN_RIGHT | wx.BOTTOM | wx.RIGHT, border = 5)
250 sizer.SetSizeHints(self)
255 self.SetAutoLayout(
True)
263 """!Run selected command"""
264 if not self.tree.GetSelected():
267 data = self.tree.GetPyData(self.tree.GetSelected())
271 handler =
'self.parent.' + data[
'handler'].lstrip(
'self.')
272 if data[
'handler'] ==
'self.OnXTerm':
273 wx.MessageBox(parent = self,
274 message = _(
'You must run this command from the menu or command line',
275 'This command require an XTerm'),
276 caption = _(
'Message'), style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
277 elif data[
'command']:
278 eval(handler)(event =
None, cmd = data[
'command'].
split())
283 """!Show selected item"""
284 self.tree.OnShowItem(event)
285 if self.tree.GetSelected():
288 self.btnRun.Enable(
False)
291 """!Item activated (double-click)"""
292 item = event.GetItem()
293 if not item
or not item.IsOk():
296 data = self.tree.GetPyData(item)
297 if not data
or 'command' not in data:
300 self.tree.itemSelected = item
306 item = event.GetItem()
307 if not item
or not item.IsOk():
310 data = self.tree.GetPyData(item)
311 if not data
or 'command' not in data:
315 label = data[
'command'] +
' -- ' + data[
'description']
317 label = data[
'description']
319 self.parent.SetStatusText(label, 0)
322 """!Update statusbar text"""
323 element = self.search.GetSelection()
324 self.tree.SearchItems(element = element,
325 value = event.GetString())
327 nItems = len(self.tree.itemsMarked)
328 if event.GetString():
329 self.parent.SetStatusText(_(
"%d modules match") % nItems, 0)
331 self.parent.SetStatusText(
"", 0)
336 """!Menu tree class"""
341 super(MenuTree, self).
__init__(parent, **kwargs)
344 """!Load menu data tree
346 @param data menu data (None to use self.menudata)
352 for eachMenuData
in data.GetMenu():
353 for label, items
in eachMenuData:
354 item = self.AppendItem(parentId = self.root,
355 text = label.replace(
'&',
''))
358 def __AppendItems(self, item, data):
359 """!Append items into tree (used by Load()
361 @param item tree item (parent)
362 @parent data menu data"""
363 for eachItem
in data:
364 if len(eachItem) == 2:
366 itemSub = self.AppendItem(parentId = item,
371 itemNew = self.AppendItem(parentId = item,
374 data = {
'item' : eachItem[0],
375 'description' : eachItem[1],
376 'handler' : eachItem[2],
377 'command' : eachItem[3],
378 'keywords' : eachItem[4] }
380 self.SetPyData(itemNew, data)
383 """!Create custom About Window
385 def __init__(self, parent, size = (650, 460),
386 title = _(
'About GRASS GIS'), **kwargs):
387 wx.Frame.__init__(self, parent = parent, id = wx.ID_ANY, title = title, size = size, **kwargs)
389 panel = wx.Panel(parent = self, id = wx.ID_ANY)
392 self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR,
'grass.ico'), wx.BITMAP_TYPE_ICO))
395 vInfo = grass.version()
397 infoTxt = ScrolledPanel(parent = panel)
398 infoTxt.SetupScrolling()
399 infoSizer = wx.BoxSizer(wx.VERTICAL)
400 infoGridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
401 infoGridSizer.SetCols(2)
402 logo = os.path.join(globalvar.ETCDIR,
"gui",
"icons",
"grass-64x64.png")
403 logoBitmap = wx.StaticBitmap(parent = infoTxt, id = wx.ID_ANY,
404 bitmap = wx.Bitmap(name = logo,
405 type = wx.BITMAP_TYPE_PNG))
406 infoSizer.Add(item = logoBitmap, proportion = 0,
407 flag = wx.ALL | wx.ALIGN_CENTER, border = 20)
409 info = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
410 label =
'GRASS GIS ' + vInfo[
'version'] +
'\n\n')
411 info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0,
""))
412 info.SetForegroundColour(wx.Colour(35, 142, 35))
413 infoSizer.Add(item = info, proportion = 0,
414 flag = wx.BOTTOM | wx.ALIGN_CENTER, border = 1)
417 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
418 label = _(
'Official GRASS site:')),
420 flag = wx.ALIGN_RIGHT)
422 infoGridSizer.Add(item = HyperLinkCtrl(parent = infoTxt, id = wx.ID_ANY,
423 label =
'http://grass.osgeo.org'),
425 flag = wx.ALIGN_LEFT)
428 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
429 label =
'%s:' % _(
'SVN Revision')),
431 flag = wx.ALIGN_RIGHT)
433 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
434 label = vInfo[
'revision']),
436 flag = wx.ALIGN_LEFT)
439 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
440 label =
'%s:' % _(
'GIS Library Revision')),
442 flag = wx.ALIGN_RIGHT)
444 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
445 label = vInfo[
'libgis_revision'] +
' (' +
446 vInfo[
'libgis_date'].
split(
' ')[0] +
')'),
448 flag = wx.ALIGN_LEFT)
451 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
454 flag = wx.ALIGN_RIGHT)
456 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
457 label = platform.python_version()),
459 flag = wx.ALIGN_LEFT)
462 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
463 label =
'wxPython:'),
465 flag = wx.ALIGN_RIGHT)
467 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
468 label = wx.__version__),
470 flag = wx.ALIGN_LEFT)
471 infoGridSizer.AddGrowableCol(0)
472 infoGridSizer.AddGrowableCol(1)
474 infoSizer.Add(item = infoGridSizer,
476 flag = wx.EXPAND | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL)
479 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
480 label =
"%s:" % _(
'Language')),
482 flag = wx.ALIGN_RIGHT)
483 lang = grass.gisenv().get(
'LANG',
None)
486 loc = locale.getdefaultlocale()
487 if loc == (
None,
None):
490 lang =
u'%s.%s' % (loc[0], loc[1])
491 infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
494 flag = wx.ALIGN_LEFT)
497 aboutNotebook = GNotebook(panel, style = globalvar.FNPageStyle | FN.FNB_NO_X_BUTTON)
498 aboutNotebook.SetTabAreaColour(globalvar.FNPageColor)
500 for title, win
in ((_(
"Info"), infoTxt),
507 aboutNotebook.AddPage(page = win, text = title)
508 wx.CallAfter(aboutNotebook.SetSelection, 0)
511 btnClose = wx.Button(parent = panel, id = wx.ID_CLOSE)
512 btnSizer = wx.BoxSizer(wx.HORIZONTAL)
513 btnSizer.Add(item = btnClose, proportion = 0,
514 flag = wx.ALL | wx.ALIGN_RIGHT,
519 infoTxt.SetSizer(infoSizer)
520 infoSizer.Fit(infoTxt)
522 sizer = wx.BoxSizer(wx.VERTICAL)
523 sizer.Add(item = aboutNotebook, proportion = 1,
524 flag = wx.EXPAND | wx.ALL, border = 1)
525 sizer.Add(item = btnSizer, proportion = 0,
526 flag = wx.ALL | wx.ALIGN_RIGHT, border = 1)
527 panel.SetSizer(sizer)
530 self.SetMinSize((400, 400))
532 def _pageCopyright(self):
533 """Copyright information"""
534 copyfile = os.path.join(os.getenv(
"GISBASE"),
"COPYING")
535 if os.path.exists(copyfile):
536 copyrightFile = open(copyfile,
'r')
537 copytext = copyrightFile.read()
538 copyrightFile.close()
540 copytext = _(
'%s file missing') %
'COPYING'
543 copyrightwin = ScrolledPanel(self)
545 copyrighttxt = wx.StaticText(copyrightwin, id = wx.ID_ANY, label = copytext)
546 copyrightwin.SetAutoLayout(
True)
547 copyrightwin.sizer = wx.BoxSizer(wx.VERTICAL)
548 copyrightwin.sizer.Add(item = copyrighttxt, proportion = 1,
549 flag = wx.EXPAND | wx.ALL, border = 3)
550 copyrightwin.SetSizer(copyrightwin.sizer)
551 copyrightwin.Layout()
552 copyrightwin.SetupScrolling()
556 def _pageLicense(self):
558 licfile = os.path.join(os.getenv(
"GISBASE"),
"GPL.TXT")
559 if os.path.exists(licfile):
560 licenceFile = open(licfile,
'r')
561 license = ''.join(licenceFile.readlines())
564 license = _(
'%s file missing') %
'GPL.TXT'
566 licensewin = ScrolledPanel(self)
567 licensetxt = wx.StaticText(licensewin, id = wx.ID_ANY, label = license)
568 licensewin.SetAutoLayout(
True)
569 licensewin.sizer = wx.BoxSizer(wx.VERTICAL)
570 licensewin.sizer.Add(item = licensetxt, proportion = 1,
571 flag = wx.EXPAND | wx.ALL, border = 3)
572 licensewin.SetSizer(licensewin.sizer)
574 licensewin.SetupScrolling()
578 def _pageCredit(self):
581 authfile = os.path.join(os.getenv(
"GISBASE"),
"AUTHORS")
582 if os.path.exists(authfile):
583 authorsFile = open(authfile,
'r')
584 authors = unicode(''.join(authorsFile.readlines()),
"utf-8")
587 authors = _(
'%s file missing') %
'AUTHORS'
588 authorwin = ScrolledPanel(self)
589 authortxt = wx.StaticText(authorwin, id = wx.ID_ANY, label = authors)
590 authorwin.SetAutoLayout(
True)
591 authorwin.SetupScrolling()
592 authorwin.sizer = wx.BoxSizer(wx.VERTICAL)
593 authorwin.sizer.Add(item = authortxt, proportion = 1,
594 flag = wx.EXPAND | wx.ALL, border = 3)
595 authorwin.SetSizer(authorwin.sizer)
600 def _pageContributors(self, extra = False):
601 """Contributors info"""
603 contribfile = os.path.join(os.getenv(
"GISBASE"),
"contributors_extra.csv")
605 contribfile = os.path.join(os.getenv(
"GISBASE"),
"contributors.csv")
606 if os.path.exists(contribfile):
607 contribFile = codecs.open(contribfile, encoding =
'utf-8', mode =
'r')
610 for line
in contribFile.readlines()[1:]:
611 line = line.rstrip(
'\n')
614 name, email, country, rfc2_agreed = line.split(
',')
616 cvs_id, name, email, country, osgeo_id, rfc2_agreed = line.split(
',')
618 errLines.append(line)
621 contribs.append((name, email))
623 contribs.append((name, email, country, osgeo_id))
628 GError(parent = self,
629 message = _(
"Error when reading file '%s'.") % contribfile + \
630 "\n\n" + _(
"Lines:") +
" %s" % \
631 os.linesep.join(map(DecodeString, errLines)))
635 contribwin = ScrolledPanel(self)
636 contribwin.SetAutoLayout(
True)
637 contribwin.SetupScrolling()
638 contribwin.sizer = wx.BoxSizer(wx.VERTICAL)
641 contribtxt = wx.StaticText(contribwin, id = wx.ID_ANY,
642 label = _(
'%s file missing') % contribfile)
643 contribwin.sizer.Add(item = contribtxt, proportion = 1,
644 flag = wx.EXPAND | wx.ALL, border = 3)
647 items = (_(
'Name'), _(
'E-mail'))
649 items = (_(
'Name'), _(
'E-mail'), _(
'Country'), _(
'OSGeo_ID'))
650 contribBox = wx.FlexGridSizer(cols = len(items), vgap = 5, hgap = 5)
652 contribBox.Add(item = wx.StaticText(parent = contribwin, id = wx.ID_ANY,
654 for vals
in sorted(contribs, key =
lambda x: x[0]):
656 contribBox.Add(item = wx.StaticText(parent = contribwin, id = wx.ID_ANY,
658 contribwin.sizer.Add(item = contribBox, proportion = 1,
659 flag = wx.EXPAND | wx.ALL, border = 3)
661 contribwin.SetSizer(contribwin.sizer)
666 def _pageTranslators(self):
667 """Translators info"""
668 translatorsfile = os.path.join(os.getenv(
"GISBASE"),
"translators.csv")
669 if os.path.exists(translatorsfile):
670 translatorsFile = open(translatorsfile,
'r')
673 for line
in translatorsFile.readlines()[1:]:
674 line = line.rstrip(
'\n')
676 name, email, languages = line.split(
',')
678 errLines.append(line)
680 for language
in languages.split(
' '):
681 if language
not in translators:
682 translators[language] = list()
683 translators[language].append((name, email))
684 translatorsFile.close()
687 GError(parent = self,
688 message = _(
"Error when reading file '%s'.") % translatorsfile + \
689 "\n\n" + _(
"Lines:") +
" %s" % \
690 os.linesep.join(map(DecodeString, errLines)))
694 translatorswin = ScrolledPanel(self)
695 translatorswin.SetAutoLayout(
True)
696 translatorswin.SetupScrolling()
697 translatorswin.sizer = wx.BoxSizer(wx.VERTICAL)
700 translatorstxt = wx.StaticText(translatorswin, id = wx.ID_ANY,
701 label = _(
'%s file missing') %
'translators.csv')
702 translatorswin.sizer.Add(item = translatorstxt, proportion = 1,
703 flag = wx.EXPAND | wx.ALL, border = 3)
705 translatorsBox = wx.FlexGridSizer(cols = 3, vgap = 5, hgap = 5)
706 languages = translators.keys()
708 translatorsBox.Add(item = wx.StaticText(parent = translatorswin, id = wx.ID_ANY,
710 translatorsBox.Add(item = wx.StaticText(parent = translatorswin, id = wx.ID_ANY,
711 label = _(
'E-mail')))
712 translatorsBox.Add(item = wx.StaticText(parent = translatorswin, id = wx.ID_ANY,
713 label = _(
'Language')))
714 for lang
in languages:
715 for translator
in translators[lang]:
716 name, email = translator
717 translatorsBox.Add(item = wx.StaticText(parent = translatorswin, id = wx.ID_ANY,
718 label = unicode(name,
"utf-8")))
719 translatorsBox.Add(item = wx.StaticText(parent = translatorswin, id = wx.ID_ANY,
721 translatorsBox.Add(item = wx.StaticText(parent = translatorswin, id = wx.ID_ANY,
724 translatorswin.sizer.Add(item = translatorsBox, proportion = 1,
725 flag = wx.EXPAND | wx.ALL, border = 3)
727 translatorswin.SetSizer(translatorswin.sizer)
728 translatorswin.Layout()
730 return translatorswin
737 """!GRASS Quickstart help window
739 As a base class wx.Dialog is used, because of not working
740 close button with wx.Frame when dialog is called from wizard.
741 If parent is None, application TopLevelWindow is used (wxPython standard behaviour).
744 wx.Dialog.__init__(self, parent = parent, id = id, title = title,
745 size = size, style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MINIMIZE_BOX)
747 sizer = wx.BoxSizer(wx.VERTICAL)
751 content.LoadPage(file)
753 sizer.Add(item = content, proportion = 1, flag = wx.EXPAND)
755 self.SetAutoLayout(
True)
761 """!This panel holds the text from GRASS docs.
763 GISBASE must be set in the environment to find the html docs dir.
764 The SYNOPSIS section is skipped, since this Panel is supposed to
765 be integrated into the cmdPanel and options are obvious there.
767 def __init__(self, parent, grass_command, text, skip_description,
769 """!If grass_command is given, the corresponding HTML help
770 file will be presented, with all links pointing to absolute
771 paths of local files.
773 If 'skip_description' is True, the HTML corresponding to
774 SYNOPSIS will be skipped, thus only presenting the help file
775 from the DESCRIPTION section onwards.
777 If 'text' is given, it must be the HTML text to be presented
782 wx.InitAllImageHandlers()
783 wx.html.HtmlWindow.__init__(self, parent = parent, **kwargs)
785 gisbase = os.getenv(
"GISBASE")
789 self.
fspath = os.path.join(gisbase,
"docs",
"html")
791 self.SetStandardFonts (size = 10)
796 url = os.path.join(self.
fspath, grass_command +
".html")
798 skip_description = skip_description)
799 self.history.append(url)
810 url = linkinfo.GetHref()
811 if url[:4] !=
'http':
812 url = os.path.join(self.
fspath, url)
813 self.history.append(url)
815 self.parent.OnHistory()
820 """!Load content from file"""
821 aLink = re.compile(
r'(<a href="?)(.+\.html?["\s]*>)', re.IGNORECASE)
822 imgLink = re.compile(
r'(<img src="?)(.+\.[png|gif])', re.IGNORECASE)
826 for l
in file(htmlFile,
"rb").readlines():
827 if "DESCRIPTION" in l:
832 skip = skip_description
835 findALink = aLink.search(l)
836 if findALink
is not None:
837 contents.append(aLink.sub(findALink.group(1)+
838 self.
fspath+findALink.group(2),l))
839 findImgLink = imgLink.search(l)
840 if findImgLink
is not None:
841 contents.append(imgLink.sub(findImgLink.group(1)+
842 self.
fspath+findImgLink.group(2),l))
844 if findALink
is None and findImgLink
is None:
846 self.SetPage(
"".join(contents))
852 def __init__(self, parent, grass_command = "index", text = None,
853 skip_description =
False, **kwargs):
855 wx.Panel.__init__(self, parent = parent, id = wx.ID_ANY)
860 self.
btnNext = wx.Button(parent = self, id = wx.ID_ANY,
862 self.btnNext.Enable(
False)
863 self.
btnPrev = wx.Button(parent = self, id = wx.ID_ANY,
864 label = _(
"&Previous"))
865 self.btnPrev.Enable(
False)
867 self.btnNext.Bind(wx.EVT_BUTTON, self.
OnNext)
868 self.btnPrev.Bind(wx.EVT_BUTTON, self.
OnPrev)
874 sizer = wx.BoxSizer(wx.VERTICAL)
875 btnSizer = wx.BoxSizer(wx.HORIZONTAL)
877 btnSizer.Add(item = self.
btnPrev, proportion = 0,
878 flag = wx.ALL, border = 5)
879 btnSizer.Add(item = wx.Size(1, 1), proportion = 1)
880 btnSizer.Add(item = self.
btnNext, proportion = 0,
881 flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
883 sizer.Add(item = self.
content, proportion = 1,
885 sizer.Add(item = btnSizer, proportion = 0,
895 self.content.history.append(path)
896 self.content.LoadPage(path)
900 fMan = os.path.join(self.content.fspath, self.
grass_command +
".html")
901 if os.path.isfile(fMan):
905 aPath = os.getenv(
'GRASS_ADDON_PATH')
907 for path
in aPath.split(os.pathsep):
908 faMan = os.path.join(path,
"docs",
"html",
910 if os.path.isfile(faMan):
916 return self.content.loaded
919 """!Update buttons"""
920 nH = len(self.content.history)
921 iH = self.content.historyIdx
923 self.btnNext.Enable(
False)
925 self.btnNext.Enable(
True)
927 self.btnPrev.Enable(
False)
929 self.btnPrev.Enable(
True)
933 self.content.historyIdx += 1
934 idx = self.content.historyIdx
935 path = self.content.history[idx]
936 self.content.LoadPage(path)
942 """Load previous page"""
943 self.content.historyIdx -= 1
944 idx = self.content.historyIdx
945 path = self.content.history[idx]
946 self.content.LoadPage(path)
Search module window (used in MenuTreeWindow)
def OnSearchModule(self, event)
Search module by keywords or description.
def OnHistory(self)
Update buttons.
def _pageTranslators(self)
def SetSelection(self, i)
Set selection element.
def GetFile(self)
Get HTML file.
def OnCloseWindow(self, event)
Close window.
def __init__(self, parent, id, title, size, file)
def split(s)
Platform spefic shlex.split.
def __init__(self, parent, grass_command="index", text=None, skip_description=False, kwargs)
Create custom About Window.
def __init__(self, parent, size=(650, 460, title=_('About GRASS GIS'), kwargs)
def OnLinkClicked(self, linkinfo)
def _layout(self)
Do layout.
def _layout(self)
Do layout.
def CheckWxVersion(version=[2)
Check wx version.
def __init__(self, parent, id=wx.ID_ANY, cmdPrompt=None, showChoice=True, showTip=False, kwargs)
loaded
FIXME: calling LoadPage() is strangely time-consuming (only first call) self.LoadPage(self.fspath + grass_command + ".html")
This panel holds the text from GRASS docs.
def GetSelection(self)
Get selected element.
def __init__(self, parent, grass_command, text, skip_description, kwargs)
If grass_command is given, the corresponding HTML help file will be presented, with all links pointin...
GRASS Quickstart help window.
def fillContentsFromFile
Load content from file.
def OnSelectModule(self, event)
Module selected from choice, update command prompt.
def Reset(self)
Reset widget.