|
@@ -26,6 +26,7 @@ import sys
|
|
import six
|
|
import six
|
|
import wx
|
|
import wx
|
|
from wx.html import HtmlWindow
|
|
from wx.html import HtmlWindow
|
|
|
|
+
|
|
try:
|
|
try:
|
|
from wx.lib.agw.hyperlink import HyperLinkCtrl
|
|
from wx.lib.agw.hyperlink import HyperLinkCtrl
|
|
except ImportError:
|
|
except ImportError:
|
|
@@ -41,8 +42,9 @@ import grass.script as grass
|
|
from grass.exceptions import CalledModuleError
|
|
from grass.exceptions import CalledModuleError
|
|
|
|
|
|
# needed just for testing
|
|
# needed just for testing
|
|
-if __name__ == '__main__':
|
|
|
|
|
|
+if __name__ == "__main__":
|
|
from grass.script.setup import set_gui_path
|
|
from grass.script.setup import set_gui_path
|
|
|
|
+
|
|
set_gui_path()
|
|
set_gui_path()
|
|
|
|
|
|
from core import globalvar
|
|
from core import globalvar
|
|
@@ -53,41 +55,34 @@ from core.debug import Debug
|
|
|
|
|
|
|
|
|
|
class AboutWindow(wx.Frame):
|
|
class AboutWindow(wx.Frame):
|
|
- """Create custom About Window
|
|
|
|
- """
|
|
|
|
|
|
+ """Create custom About Window"""
|
|
|
|
|
|
- def __init__(self, parent, size=(770, 460),
|
|
|
|
- title=_('About GRASS GIS'), **kwargs):
|
|
|
|
|
|
+ def __init__(self, parent, size=(770, 460), title=_("About GRASS GIS"), **kwargs):
|
|
wx.Frame.__init__(
|
|
wx.Frame.__init__(
|
|
- self,
|
|
|
|
- parent=parent,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- title=title,
|
|
|
|
- size=size,
|
|
|
|
- **kwargs)
|
|
|
|
|
|
+ self, parent=parent, id=wx.ID_ANY, title=title, size=size, **kwargs
|
|
|
|
+ )
|
|
|
|
|
|
self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
|
|
self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
|
|
|
|
|
|
# icon
|
|
# icon
|
|
self.SetIcon(
|
|
self.SetIcon(
|
|
- wx.Icon(
|
|
|
|
- os.path.join(
|
|
|
|
- globalvar.ICONDIR,
|
|
|
|
- 'grass.ico'),
|
|
|
|
- wx.BITMAP_TYPE_ICO))
|
|
|
|
|
|
+ wx.Icon(os.path.join(globalvar.ICONDIR, "grass.ico"), wx.BITMAP_TYPE_ICO)
|
|
|
|
+ )
|
|
|
|
|
|
# notebook
|
|
# notebook
|
|
self.aboutNotebook = FormNotebook(self.panel, style=wx.BK_LEFT)
|
|
self.aboutNotebook = FormNotebook(self.panel, style=wx.BK_LEFT)
|
|
|
|
|
|
- for title, win in ((_("Info"), self._pageInfo()),
|
|
|
|
- (_("Copyright"), self._pageCopyright()),
|
|
|
|
- (_("License"), self._pageLicense()),
|
|
|
|
- (_("Citation"), self._pageCitation()),
|
|
|
|
- (_("Authors"), self._pageCredit()),
|
|
|
|
- (_("Contributors"), self._pageContributors()),
|
|
|
|
- (_("Extra contributors"), self._pageContributors(extra=True)),
|
|
|
|
- (_("Translators"), self._pageTranslators()),
|
|
|
|
- (_("Translation status"), self._pageStats())):
|
|
|
|
|
|
+ for title, win in (
|
|
|
|
+ (_("Info"), self._pageInfo()),
|
|
|
|
+ (_("Copyright"), self._pageCopyright()),
|
|
|
|
+ (_("License"), self._pageLicense()),
|
|
|
|
+ (_("Citation"), self._pageCitation()),
|
|
|
|
+ (_("Authors"), self._pageCredit()),
|
|
|
|
+ (_("Contributors"), self._pageContributors()),
|
|
|
|
+ (_("Extra contributors"), self._pageContributors(extra=True)),
|
|
|
|
+ (_("Translators"), self._pageTranslators()),
|
|
|
|
+ (_("Translation status"), self._pageStats()),
|
|
|
|
+ ):
|
|
self.aboutNotebook.AddPage(page=win, text=title)
|
|
self.aboutNotebook.AddPage(page=win, text=title)
|
|
wx.CallAfter(self.aboutNotebook.SetSelection, 0)
|
|
wx.CallAfter(self.aboutNotebook.SetSelection, 0)
|
|
wx.CallAfter(self.aboutNotebook.Refresh)
|
|
wx.CallAfter(self.aboutNotebook.Refresh)
|
|
@@ -103,10 +98,8 @@ class AboutWindow(wx.Frame):
|
|
btnSizer.Add(self.btnClose, proportion=0, flag=wx.ALL, border=5)
|
|
btnSizer.Add(self.btnClose, proportion=0, flag=wx.ALL, border=5)
|
|
|
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
- sizer.Add(self.aboutNotebook, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
|
- sizer.Add(btnSizer, proportion=0,
|
|
|
|
- flag=wx.ALL | wx.ALIGN_RIGHT, border=1)
|
|
|
|
|
|
+ sizer.Add(self.aboutNotebook, proportion=1, flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
|
+ sizer.Add(btnSizer, proportion=0, flag=wx.ALL | wx.ALIGN_RIGHT, border=1)
|
|
|
|
|
|
self.SetMinSize((400, 400))
|
|
self.SetMinSize((400, 400))
|
|
|
|
|
|
@@ -127,59 +120,71 @@ class AboutWindow(wx.Frame):
|
|
infoSizer = wx.BoxSizer(wx.VERTICAL)
|
|
infoSizer = wx.BoxSizer(wx.VERTICAL)
|
|
infoGridSizer = wx.GridBagSizer(vgap=5, hgap=5)
|
|
infoGridSizer = wx.GridBagSizer(vgap=5, hgap=5)
|
|
logo = os.path.join(globalvar.ICONDIR, "grass-64x64.png")
|
|
logo = os.path.join(globalvar.ICONDIR, "grass-64x64.png")
|
|
- logoBitmap = wx.StaticBitmap(infoTxt, wx.ID_ANY,
|
|
|
|
- wx.Bitmap(name=logo, type=wx.BITMAP_TYPE_PNG))
|
|
|
|
- infoSizer.Add(logoBitmap, proportion=0,
|
|
|
|
- flag=wx.ALL | wx.ALIGN_CENTER, border=20)
|
|
|
|
-
|
|
|
|
- infoLabel = 'GRASS GIS %s' % vInfo.get('version', _('unknown version'))
|
|
|
|
- if 'x86_64' in vInfo.get('build_platform', ''):
|
|
|
|
- infoLabel += ' (64bit)'
|
|
|
|
- info = StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label=infoLabel + os.linesep)
|
|
|
|
|
|
+ logoBitmap = wx.StaticBitmap(
|
|
|
|
+ infoTxt, wx.ID_ANY, wx.Bitmap(name=logo, type=wx.BITMAP_TYPE_PNG)
|
|
|
|
+ )
|
|
|
|
+ infoSizer.Add(
|
|
|
|
+ logoBitmap, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=20
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ infoLabel = "GRASS GIS %s" % vInfo.get("version", _("unknown version"))
|
|
|
|
+ if "x86_64" in vInfo.get("build_platform", ""):
|
|
|
|
+ infoLabel += " (64bit)"
|
|
|
|
+ info = StaticText(parent=infoTxt, id=wx.ID_ANY, label=infoLabel + os.linesep)
|
|
info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
info.SetForegroundColour(wx.Colour(35, 142, 35))
|
|
info.SetForegroundColour(wx.Colour(35, 142, 35))
|
|
- infoSizer.Add(info, proportion=0,
|
|
|
|
- flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
|
|
|
|
|
|
+ infoSizer.Add(info, proportion=0, flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
|
|
|
|
|
|
- team = StaticText(parent=infoTxt, label=_grassDevTeam(1999) + '\n')
|
|
|
|
- infoSizer.Add(team, proportion=0,
|
|
|
|
- flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
|
|
|
|
|
|
+ team = StaticText(parent=infoTxt, label=_grassDevTeam(1999) + "\n")
|
|
|
|
+ infoSizer.Add(team, proportion=0, flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
|
|
|
|
|
|
row = 0
|
|
row = 0
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label=_('Official GRASS site:')),
|
|
|
|
- pos=(row, 0),
|
|
|
|
- flag=wx.ALIGN_RIGHT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label=_("Official GRASS site:")),
|
|
|
|
+ pos=(row, 0),
|
|
|
|
+ flag=wx.ALIGN_RIGHT,
|
|
|
|
+ )
|
|
|
|
|
|
- infoGridSizer.Add(HyperLinkCtrl(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label='https://grass.osgeo.org'),
|
|
|
|
- pos=(row, 1),
|
|
|
|
- flag=wx.ALIGN_LEFT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ HyperLinkCtrl(
|
|
|
|
+ parent=infoTxt, id=wx.ID_ANY, label="https://grass.osgeo.org"
|
|
|
|
+ ),
|
|
|
|
+ pos=(row, 1),
|
|
|
|
+ flag=wx.ALIGN_LEFT,
|
|
|
|
+ )
|
|
|
|
|
|
row += 2
|
|
row += 2
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label='%s:' % _('Code Revision')),
|
|
|
|
- pos=(row, 0),
|
|
|
|
- flag=wx.ALIGN_RIGHT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label="%s:" % _("Code Revision")),
|
|
|
|
+ pos=(row, 0),
|
|
|
|
+ flag=wx.ALIGN_RIGHT,
|
|
|
|
+ )
|
|
|
|
|
|
- infoGridSizer.Add(HyperLinkCtrl(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label=vInfo.get('revision', '?'),
|
|
|
|
- URL='https://github.com/OSGeo/grass.git'),
|
|
|
|
- pos=(row, 1),
|
|
|
|
- flag=wx.ALIGN_LEFT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ HyperLinkCtrl(
|
|
|
|
+ parent=infoTxt,
|
|
|
|
+ id=wx.ID_ANY,
|
|
|
|
+ label=vInfo.get("revision", "?"),
|
|
|
|
+ URL="https://github.com/OSGeo/grass.git",
|
|
|
|
+ ),
|
|
|
|
+ pos=(row, 1),
|
|
|
|
+ flag=wx.ALIGN_LEFT,
|
|
|
|
+ )
|
|
|
|
|
|
row += 1
|
|
row += 1
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label='%s:' % _('Build Date')),
|
|
|
|
- pos=(row, 0),
|
|
|
|
- flag=wx.ALIGN_RIGHT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label="%s:" % _("Build Date")),
|
|
|
|
+ pos=(row, 0),
|
|
|
|
+ flag=wx.ALIGN_RIGHT,
|
|
|
|
+ )
|
|
|
|
|
|
infoGridSizer.Add(
|
|
infoGridSizer.Add(
|
|
StaticText(
|
|
StaticText(
|
|
- parent=infoTxt, id=wx.ID_ANY, label=vInfo.get(
|
|
|
|
- 'build_date', '?')), pos=(
|
|
|
|
- row, 1), flag=wx.ALIGN_LEFT)
|
|
|
|
|
|
+ parent=infoTxt, id=wx.ID_ANY, label=vInfo.get("build_date", "?")
|
|
|
|
+ ),
|
|
|
|
+ pos=(row, 1),
|
|
|
|
+ flag=wx.ALIGN_LEFT,
|
|
|
|
+ )
|
|
|
|
|
|
# show only basic info
|
|
# show only basic info
|
|
# row += 1
|
|
# row += 1
|
|
@@ -195,48 +200,55 @@ class AboutWindow(wx.Frame):
|
|
# flag = wx.ALIGN_LEFT)
|
|
# flag = wx.ALIGN_LEFT)
|
|
|
|
|
|
row += 2
|
|
row += 2
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label='Python:'),
|
|
|
|
- pos=(row, 0),
|
|
|
|
- flag=wx.ALIGN_RIGHT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label="Python:"),
|
|
|
|
+ pos=(row, 0),
|
|
|
|
+ flag=wx.ALIGN_RIGHT,
|
|
|
|
+ )
|
|
|
|
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label=platform.python_version()),
|
|
|
|
- pos=(row, 1),
|
|
|
|
- flag=wx.ALIGN_LEFT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label=platform.python_version()),
|
|
|
|
+ pos=(row, 1),
|
|
|
|
+ flag=wx.ALIGN_LEFT,
|
|
|
|
+ )
|
|
|
|
|
|
row += 1
|
|
row += 1
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label='wxPython:'),
|
|
|
|
- pos=(row, 0),
|
|
|
|
- flag=wx.ALIGN_RIGHT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label="wxPython:"),
|
|
|
|
+ pos=(row, 0),
|
|
|
|
+ flag=wx.ALIGN_RIGHT,
|
|
|
|
+ )
|
|
|
|
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label=wx.__version__),
|
|
|
|
- pos=(row, 1),
|
|
|
|
- flag=wx.ALIGN_LEFT)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label=wx.__version__),
|
|
|
|
+ pos=(row, 1),
|
|
|
|
+ flag=wx.ALIGN_LEFT,
|
|
|
|
+ )
|
|
|
|
|
|
infoGridSizer.AddGrowableCol(0)
|
|
infoGridSizer.AddGrowableCol(0)
|
|
infoGridSizer.AddGrowableCol(1)
|
|
infoGridSizer.AddGrowableCol(1)
|
|
infoSizer.Add(infoGridSizer, proportion=1, flag=wx.EXPAND)
|
|
infoSizer.Add(infoGridSizer, proportion=1, flag=wx.EXPAND)
|
|
|
|
|
|
row += 2
|
|
row += 2
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label="%s:" % _('Language')),
|
|
|
|
- pos=(row, 0),
|
|
|
|
- flag=wx.ALIGN_RIGHT)
|
|
|
|
- self.langUsed = grass.gisenv().get('LANG', None)
|
|
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label="%s:" % _("Language")),
|
|
|
|
+ pos=(row, 0),
|
|
|
|
+ flag=wx.ALIGN_RIGHT,
|
|
|
|
+ )
|
|
|
|
+ self.langUsed = grass.gisenv().get("LANG", None)
|
|
if not self.langUsed:
|
|
if not self.langUsed:
|
|
import locale
|
|
import locale
|
|
|
|
+
|
|
loc = locale.getdefaultlocale()
|
|
loc = locale.getdefaultlocale()
|
|
if loc == (None, None):
|
|
if loc == (None, None):
|
|
- self.langUsed = _('unknown')
|
|
|
|
|
|
+ self.langUsed = _("unknown")
|
|
else:
|
|
else:
|
|
- self.langUsed = u'%s.%s' % (loc[0], loc[1])
|
|
|
|
- infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
|
|
|
|
- label=self.langUsed),
|
|
|
|
- pos=(row, 1),
|
|
|
|
- flag=wx.ALIGN_LEFT)
|
|
|
|
|
|
+ self.langUsed = "%s.%s" % (loc[0], loc[1])
|
|
|
|
+ infoGridSizer.Add(
|
|
|
|
+ StaticText(parent=infoTxt, id=wx.ID_ANY, label=self.langUsed),
|
|
|
|
+ pos=(row, 1),
|
|
|
|
+ flag=wx.ALIGN_LEFT,
|
|
|
|
+ )
|
|
|
|
|
|
infoTxt.SetSizer(infoSizer)
|
|
infoTxt.SetSizer(infoSizer)
|
|
infoSizer.Fit(infoTxt)
|
|
infoSizer.Fit(infoTxt)
|
|
@@ -247,21 +259,25 @@ class AboutWindow(wx.Frame):
|
|
"""Copyright information"""
|
|
"""Copyright information"""
|
|
copyfile = os.path.join(os.getenv("GISBASE"), "COPYING")
|
|
copyfile = os.path.join(os.getenv("GISBASE"), "COPYING")
|
|
if os.path.exists(copyfile):
|
|
if os.path.exists(copyfile):
|
|
- copyrightFile = open(copyfile, 'r')
|
|
|
|
|
|
+ copyrightFile = open(copyfile, "r")
|
|
copytext = copyrightFile.read()
|
|
copytext = copyrightFile.read()
|
|
copyrightFile.close()
|
|
copyrightFile.close()
|
|
else:
|
|
else:
|
|
- copytext = _('%s file missing') % 'COPYING'
|
|
|
|
|
|
+ copytext = _("%s file missing") % "COPYING"
|
|
|
|
|
|
# put text into a scrolling panel
|
|
# put text into a scrolling panel
|
|
copyrightwin = ScrolledPanel(self.aboutNotebook)
|
|
copyrightwin = ScrolledPanel(self.aboutNotebook)
|
|
copyrighttxt = TextCtrl(
|
|
copyrighttxt = TextCtrl(
|
|
- copyrightwin, id=wx.ID_ANY, value=copytext,
|
|
|
|
- style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
|
|
|
|
+ copyrightwin,
|
|
|
|
+ id=wx.ID_ANY,
|
|
|
|
+ value=copytext,
|
|
|
|
+ style=wx.TE_MULTILINE | wx.TE_READONLY,
|
|
|
|
+ )
|
|
copyrightwin.SetAutoLayout(True)
|
|
copyrightwin.SetAutoLayout(True)
|
|
copyrightwin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
copyrightwin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
- copyrightwin.sizer.Add(copyrighttxt, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ copyrightwin.sizer.Add(
|
|
|
|
+ copyrighttxt, proportion=1, flag=wx.EXPAND | wx.ALL, border=3
|
|
|
|
+ )
|
|
copyrightwin.SetSizer(copyrightwin.sizer)
|
|
copyrightwin.SetSizer(copyrightwin.sizer)
|
|
copyrightwin.Layout()
|
|
copyrightwin.Layout()
|
|
copyrightwin.SetupScrolling()
|
|
copyrightwin.SetupScrolling()
|
|
@@ -272,20 +288,24 @@ class AboutWindow(wx.Frame):
|
|
"""Licence about"""
|
|
"""Licence about"""
|
|
licfile = os.path.join(os.getenv("GISBASE"), "GPL.TXT")
|
|
licfile = os.path.join(os.getenv("GISBASE"), "GPL.TXT")
|
|
if os.path.exists(licfile):
|
|
if os.path.exists(licfile):
|
|
- licenceFile = open(licfile, 'r')
|
|
|
|
- license = ''.join(licenceFile.readlines())
|
|
|
|
|
|
+ licenceFile = open(licfile, "r")
|
|
|
|
+ license = "".join(licenceFile.readlines())
|
|
licenceFile.close()
|
|
licenceFile.close()
|
|
else:
|
|
else:
|
|
- license = _('%s file missing') % 'GPL.TXT'
|
|
|
|
|
|
+ license = _("%s file missing") % "GPL.TXT"
|
|
# put text into a scrolling panel
|
|
# put text into a scrolling panel
|
|
licensewin = ScrolledPanel(self.aboutNotebook)
|
|
licensewin = ScrolledPanel(self.aboutNotebook)
|
|
licensetxt = TextCtrl(
|
|
licensetxt = TextCtrl(
|
|
- licensewin, id=wx.ID_ANY, value=license,
|
|
|
|
- style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
|
|
|
|
+ licensewin,
|
|
|
|
+ id=wx.ID_ANY,
|
|
|
|
+ value=license,
|
|
|
|
+ style=wx.TE_MULTILINE | wx.TE_READONLY,
|
|
|
|
+ )
|
|
licensewin.SetAutoLayout(True)
|
|
licensewin.SetAutoLayout(True)
|
|
licensewin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
licensewin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
- licensewin.sizer.Add(licensetxt, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ licensewin.sizer.Add(
|
|
|
|
+ licensetxt, proportion=1, flag=wx.EXPAND | wx.ALL, border=3
|
|
|
|
+ )
|
|
licensewin.SetSizer(licensewin.sizer)
|
|
licensewin.SetSizer(licensewin.sizer)
|
|
licensewin.Layout()
|
|
licensewin.Layout()
|
|
licensewin.SetupScrolling()
|
|
licensewin.SetupScrolling()
|
|
@@ -297,21 +317,23 @@ class AboutWindow(wx.Frame):
|
|
try:
|
|
try:
|
|
# import only when needed
|
|
# import only when needed
|
|
import grass.script as gscript
|
|
import grass.script as gscript
|
|
- text = gscript.read_command('g.version', flags='x')
|
|
|
|
|
|
+
|
|
|
|
+ text = gscript.read_command("g.version", flags="x")
|
|
except CalledModuleError as error:
|
|
except CalledModuleError as error:
|
|
- text = _("Unable to provide citation suggestion,"
|
|
|
|
- " see GRASS GIS website instead."
|
|
|
|
- " The error was: {0}").format(error)
|
|
|
|
|
|
+ text = _(
|
|
|
|
+ "Unable to provide citation suggestion,"
|
|
|
|
+ " see GRASS GIS website instead."
|
|
|
|
+ " The error was: {0}"
|
|
|
|
+ ).format(error)
|
|
|
|
|
|
# put text into a scrolling panel
|
|
# put text into a scrolling panel
|
|
window = ScrolledPanel(self.aboutNotebook)
|
|
window = ScrolledPanel(self.aboutNotebook)
|
|
stat_text = TextCtrl(
|
|
stat_text = TextCtrl(
|
|
- window, id=wx.ID_ANY, value=text,
|
|
|
|
- style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
|
|
|
|
+ window, id=wx.ID_ANY, value=text, style=wx.TE_MULTILINE | wx.TE_READONLY
|
|
|
|
+ )
|
|
window.SetAutoLayout(True)
|
|
window.SetAutoLayout(True)
|
|
window.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
window.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
- window.sizer.Add(stat_text, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ window.sizer.Add(stat_text, proportion=1, flag=wx.EXPAND | wx.ALL, border=3)
|
|
window.SetSizer(window.sizer)
|
|
window.SetSizer(window.sizer)
|
|
window.Layout()
|
|
window.Layout()
|
|
window.SetupScrolling()
|
|
window.SetupScrolling()
|
|
@@ -323,19 +345,21 @@ class AboutWindow(wx.Frame):
|
|
# credits
|
|
# credits
|
|
authfile = os.path.join(os.getenv("GISBASE"), "AUTHORS")
|
|
authfile = os.path.join(os.getenv("GISBASE"), "AUTHORS")
|
|
if os.path.exists(authfile):
|
|
if os.path.exists(authfile):
|
|
- with codecs.open(authfile, encoding='utf-8', mode='r') as authorsFile:
|
|
|
|
- authors = ''.join(authorsFile.readlines())
|
|
|
|
|
|
+ with codecs.open(authfile, encoding="utf-8", mode="r") as authorsFile:
|
|
|
|
+ authors = "".join(authorsFile.readlines())
|
|
else:
|
|
else:
|
|
- authors = _('%s file missing') % 'AUTHORS'
|
|
|
|
|
|
+ authors = _("%s file missing") % "AUTHORS"
|
|
authorwin = ScrolledPanel(self.aboutNotebook)
|
|
authorwin = ScrolledPanel(self.aboutNotebook)
|
|
authortxt = TextCtrl(
|
|
authortxt = TextCtrl(
|
|
- authorwin, id=wx.ID_ANY, value=authors,
|
|
|
|
- style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
|
|
|
|
+ authorwin,
|
|
|
|
+ id=wx.ID_ANY,
|
|
|
|
+ value=authors,
|
|
|
|
+ style=wx.TE_MULTILINE | wx.TE_READONLY,
|
|
|
|
+ )
|
|
authorwin.SetAutoLayout(True)
|
|
authorwin.SetAutoLayout(True)
|
|
authorwin.SetupScrolling()
|
|
authorwin.SetupScrolling()
|
|
authorwin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
authorwin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
- authorwin.sizer.Add(authortxt, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ authorwin.sizer.Add(authortxt, proportion=1, flag=wx.EXPAND | wx.ALL, border=3)
|
|
authorwin.SetSizer(authorwin.sizer)
|
|
authorwin.SetSizer(authorwin.sizer)
|
|
authorwin.Layout()
|
|
authorwin.Layout()
|
|
|
|
|
|
@@ -344,25 +368,27 @@ class AboutWindow(wx.Frame):
|
|
def _pageContributors(self, extra=False):
|
|
def _pageContributors(self, extra=False):
|
|
"""Contributors info"""
|
|
"""Contributors info"""
|
|
if extra:
|
|
if extra:
|
|
- contribfile = os.path.join(
|
|
|
|
- os.getenv("GISBASE"),
|
|
|
|
- "contributors_extra.csv")
|
|
|
|
|
|
+ contribfile = os.path.join(os.getenv("GISBASE"), "contributors_extra.csv")
|
|
else:
|
|
else:
|
|
- contribfile = os.path.join(
|
|
|
|
- os.getenv("GISBASE"),
|
|
|
|
- "contributors.csv")
|
|
|
|
|
|
+ contribfile = os.path.join(os.getenv("GISBASE"), "contributors.csv")
|
|
if os.path.exists(contribfile):
|
|
if os.path.exists(contribfile):
|
|
- contribFile = codecs.open(contribfile, encoding='utf-8', mode='r')
|
|
|
|
|
|
+ contribFile = codecs.open(contribfile, encoding="utf-8", mode="r")
|
|
contribs = list()
|
|
contribs = list()
|
|
errLines = list()
|
|
errLines = list()
|
|
for line in contribFile.readlines()[1:]:
|
|
for line in contribFile.readlines()[1:]:
|
|
- line = line.rstrip('\n')
|
|
|
|
|
|
+ line = line.rstrip("\n")
|
|
try:
|
|
try:
|
|
if extra:
|
|
if extra:
|
|
- name, email, country, rfc2_agreed = line.split(',')
|
|
|
|
|
|
+ name, email, country, rfc2_agreed = line.split(",")
|
|
else:
|
|
else:
|
|
- cvs_id, name, email, country, osgeo_id, rfc2_agreed = line.split(
|
|
|
|
- ',')
|
|
|
|
|
|
+ (
|
|
|
|
+ cvs_id,
|
|
|
|
+ name,
|
|
|
|
+ email,
|
|
|
|
+ country,
|
|
|
|
+ osgeo_id,
|
|
|
|
+ rfc2_agreed,
|
|
|
|
+ ) = line.split(",")
|
|
except ValueError:
|
|
except ValueError:
|
|
errLines.append(line)
|
|
errLines.append(line)
|
|
continue
|
|
continue
|
|
@@ -374,9 +400,13 @@ class AboutWindow(wx.Frame):
|
|
contribFile.close()
|
|
contribFile.close()
|
|
|
|
|
|
if errLines:
|
|
if errLines:
|
|
- GError(parent=self, message=_("Error when reading file '%s'.") %
|
|
|
|
- contribfile + "\n\n" + _("Lines:") + " %s" %
|
|
|
|
- os.linesep.join(map(DecodeString, errLines)))
|
|
|
|
|
|
+ GError(
|
|
|
|
+ parent=self,
|
|
|
|
+ message=_("Error when reading file '%s'.") % contribfile
|
|
|
|
+ + "\n\n"
|
|
|
|
+ + _("Lines:")
|
|
|
|
+ + " %s" % os.linesep.join(map(DecodeString, errLines)),
|
|
|
|
+ )
|
|
else:
|
|
else:
|
|
contribs = None
|
|
contribs = None
|
|
|
|
|
|
@@ -387,39 +417,29 @@ class AboutWindow(wx.Frame):
|
|
|
|
|
|
if not contribs:
|
|
if not contribs:
|
|
contribtxt = StaticText(
|
|
contribtxt = StaticText(
|
|
- contribwin,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- label=_('%s file missing') %
|
|
|
|
- contribfile)
|
|
|
|
- contribwin.sizer.Add(contribtxt, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ contribwin, id=wx.ID_ANY, label=_("%s file missing") % contribfile
|
|
|
|
+ )
|
|
|
|
+ contribwin.sizer.Add(
|
|
|
|
+ contribtxt, proportion=1, flag=wx.EXPAND | wx.ALL, border=3
|
|
|
|
+ )
|
|
else:
|
|
else:
|
|
if extra:
|
|
if extra:
|
|
- items = (_('Name'), _('E-mail'), _('Country'))
|
|
|
|
|
|
+ items = (_("Name"), _("E-mail"), _("Country"))
|
|
else:
|
|
else:
|
|
- items = (_('Name'), _('E-mail'), _('Country'), _('OSGeo_ID'))
|
|
|
|
|
|
+ items = (_("Name"), _("E-mail"), _("Country"), _("OSGeo_ID"))
|
|
contribBox = wx.FlexGridSizer(cols=len(items), vgap=5, hgap=5)
|
|
contribBox = wx.FlexGridSizer(cols=len(items), vgap=5, hgap=5)
|
|
for item in items:
|
|
for item in items:
|
|
- text = StaticText(parent=contribwin, id=wx.ID_ANY,
|
|
|
|
- label=item)
|
|
|
|
- text.SetFont(
|
|
|
|
- wx.Font(
|
|
|
|
- 10,
|
|
|
|
- wx.DEFAULT,
|
|
|
|
- wx.NORMAL,
|
|
|
|
- wx.BOLD,
|
|
|
|
- 0,
|
|
|
|
- ""))
|
|
|
|
|
|
+ text = StaticText(parent=contribwin, id=wx.ID_ANY, label=item)
|
|
|
|
+ text.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
contribBox.Add(text)
|
|
contribBox.Add(text)
|
|
for vals in sorted(contribs, key=lambda x: x[0]):
|
|
for vals in sorted(contribs, key=lambda x: x[0]):
|
|
for item in vals:
|
|
for item in vals:
|
|
contribBox.Add(
|
|
contribBox.Add(
|
|
- StaticText(
|
|
|
|
- parent=contribwin,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- label=item))
|
|
|
|
- contribwin.sizer.Add(contribBox, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ StaticText(parent=contribwin, id=wx.ID_ANY, label=item)
|
|
|
|
+ )
|
|
|
|
+ contribwin.sizer.Add(
|
|
|
|
+ contribBox, proportion=1, flag=wx.EXPAND | wx.ALL, border=3
|
|
|
|
+ )
|
|
|
|
|
|
contribwin.SetSizer(contribwin.sizer)
|
|
contribwin.SetSizer(contribwin.sizer)
|
|
contribwin.Layout()
|
|
contribwin.Layout()
|
|
@@ -430,26 +450,30 @@ class AboutWindow(wx.Frame):
|
|
"""Translators info"""
|
|
"""Translators info"""
|
|
translatorsfile = os.path.join(os.getenv("GISBASE"), "translators.csv")
|
|
translatorsfile = os.path.join(os.getenv("GISBASE"), "translators.csv")
|
|
if os.path.exists(translatorsfile):
|
|
if os.path.exists(translatorsfile):
|
|
- translatorsFile = codecs.open(translatorsfile, encoding='utf-8', mode='r')
|
|
|
|
|
|
+ translatorsFile = codecs.open(translatorsfile, encoding="utf-8", mode="r")
|
|
translators = dict()
|
|
translators = dict()
|
|
errLines = list()
|
|
errLines = list()
|
|
for line in translatorsFile.readlines()[1:]:
|
|
for line in translatorsFile.readlines()[1:]:
|
|
- line = line.rstrip('\n')
|
|
|
|
|
|
+ line = line.rstrip("\n")
|
|
try:
|
|
try:
|
|
- name, email, languages = line.split(',')
|
|
|
|
|
|
+ name, email, languages = line.split(",")
|
|
except ValueError:
|
|
except ValueError:
|
|
errLines.append(line)
|
|
errLines.append(line)
|
|
continue
|
|
continue
|
|
- for language in languages.split(' '):
|
|
|
|
|
|
+ for language in languages.split(" "):
|
|
if language not in translators:
|
|
if language not in translators:
|
|
translators[language] = list()
|
|
translators[language] = list()
|
|
translators[language].append((name, email))
|
|
translators[language].append((name, email))
|
|
translatorsFile.close()
|
|
translatorsFile.close()
|
|
|
|
|
|
if errLines:
|
|
if errLines:
|
|
- GError(parent=self, message=_("Error when reading file '%s'.") %
|
|
|
|
- translatorsfile + "\n\n" + _("Lines:") + " %s" %
|
|
|
|
- os.linesep.join(map(DecodeString, errLines)))
|
|
|
|
|
|
+ GError(
|
|
|
|
+ parent=self,
|
|
|
|
+ message=_("Error when reading file '%s'.") % translatorsfile
|
|
|
|
+ + "\n\n"
|
|
|
|
+ + _("Lines:")
|
|
|
|
+ + " %s" % os.linesep.join(map(DecodeString, errLines)),
|
|
|
|
+ )
|
|
else:
|
|
else:
|
|
translators = None
|
|
translators = None
|
|
|
|
|
|
@@ -462,63 +486,56 @@ class AboutWindow(wx.Frame):
|
|
translatorstxt = StaticText(
|
|
translatorstxt = StaticText(
|
|
translatorswin,
|
|
translatorswin,
|
|
id=wx.ID_ANY,
|
|
id=wx.ID_ANY,
|
|
- label=_('%s file missing') %
|
|
|
|
- 'translators.csv')
|
|
|
|
- translatorswin.sizer.Add(translatorstxt, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ label=_("%s file missing") % "translators.csv",
|
|
|
|
+ )
|
|
|
|
+ translatorswin.sizer.Add(
|
|
|
|
+ translatorstxt, proportion=1, flag=wx.EXPAND | wx.ALL, border=3
|
|
|
|
+ )
|
|
else:
|
|
else:
|
|
translatorsBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
|
|
translatorsBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
|
|
languages = sorted(translators.keys())
|
|
languages = sorted(translators.keys())
|
|
- tname = StaticText(parent=translatorswin, id=wx.ID_ANY,
|
|
|
|
- label=_('Name'))
|
|
|
|
|
|
+ tname = StaticText(parent=translatorswin, id=wx.ID_ANY, label=_("Name"))
|
|
tname.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
tname.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
translatorsBox.Add(tname)
|
|
translatorsBox.Add(tname)
|
|
- temail = StaticText(parent=translatorswin, id=wx.ID_ANY,
|
|
|
|
- label=_('E-mail'))
|
|
|
|
|
|
+ temail = StaticText(parent=translatorswin, id=wx.ID_ANY, label=_("E-mail"))
|
|
temail.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
temail.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
translatorsBox.Add(temail)
|
|
translatorsBox.Add(temail)
|
|
- tlang = StaticText(parent=translatorswin, id=wx.ID_ANY,
|
|
|
|
- label=_('Language'))
|
|
|
|
|
|
+ tlang = StaticText(parent=translatorswin, id=wx.ID_ANY, label=_("Language"))
|
|
tlang.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
tlang.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
translatorsBox.Add(tlang)
|
|
translatorsBox.Add(tlang)
|
|
- tnat = StaticText(parent=translatorswin, id=wx.ID_ANY,
|
|
|
|
- label=_('Nation'))
|
|
|
|
|
|
+ tnat = StaticText(parent=translatorswin, id=wx.ID_ANY, label=_("Nation"))
|
|
tnat.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
tnat.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
translatorsBox.Add(tnat)
|
|
translatorsBox.Add(tnat)
|
|
for lang in languages:
|
|
for lang in languages:
|
|
for translator in translators[lang]:
|
|
for translator in translators[lang]:
|
|
name, email = translator
|
|
name, email = translator
|
|
translatorsBox.Add(
|
|
translatorsBox.Add(
|
|
- StaticText(
|
|
|
|
- parent=translatorswin,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- label=name))
|
|
|
|
|
|
+ StaticText(parent=translatorswin, id=wx.ID_ANY, label=name)
|
|
|
|
+ )
|
|
translatorsBox.Add(
|
|
translatorsBox.Add(
|
|
- StaticText(
|
|
|
|
- parent=translatorswin,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- label=email))
|
|
|
|
|
|
+ StaticText(parent=translatorswin, id=wx.ID_ANY, label=email)
|
|
|
|
+ )
|
|
translatorsBox.Add(
|
|
translatorsBox.Add(
|
|
- StaticText(
|
|
|
|
- parent=translatorswin,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- label=lang))
|
|
|
|
|
|
+ StaticText(parent=translatorswin, id=wx.ID_ANY, label=lang)
|
|
|
|
+ )
|
|
flag = os.path.join(
|
|
flag = os.path.join(
|
|
- globalvar.ICONDIR, "flags", "%s.png" %
|
|
|
|
- lang.lower())
|
|
|
|
|
|
+ globalvar.ICONDIR, "flags", "%s.png" % lang.lower()
|
|
|
|
+ )
|
|
if os.path.exists(flag):
|
|
if os.path.exists(flag):
|
|
- flagBitmap = wx.StaticBitmap(translatorswin, wx.ID_ANY, wx.Bitmap(
|
|
|
|
- name=flag, type=wx.BITMAP_TYPE_PNG))
|
|
|
|
|
|
+ flagBitmap = wx.StaticBitmap(
|
|
|
|
+ translatorswin,
|
|
|
|
+ wx.ID_ANY,
|
|
|
|
+ wx.Bitmap(name=flag, type=wx.BITMAP_TYPE_PNG),
|
|
|
|
+ )
|
|
translatorsBox.Add(flagBitmap)
|
|
translatorsBox.Add(flagBitmap)
|
|
else:
|
|
else:
|
|
translatorsBox.Add(
|
|
translatorsBox.Add(
|
|
- StaticText(
|
|
|
|
- parent=translatorswin,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- label=lang))
|
|
|
|
|
|
+ StaticText(parent=translatorswin, id=wx.ID_ANY, label=lang)
|
|
|
|
+ )
|
|
|
|
|
|
- translatorswin.sizer.Add(translatorsBox, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ translatorswin.sizer.Add(
|
|
|
|
+ translatorsBox, proportion=1, flag=wx.EXPAND | wx.ALL, border=3
|
|
|
|
+ )
|
|
|
|
|
|
translatorswin.SetSizer(translatorswin.sizer)
|
|
translatorswin.SetSizer(translatorswin.sizer)
|
|
translatorswin.Layout()
|
|
translatorswin.Layout()
|
|
@@ -529,15 +546,15 @@ class AboutWindow(wx.Frame):
|
|
"""Return string for the status of translation"""
|
|
"""Return string for the status of translation"""
|
|
allStr = "%s :" % k.upper()
|
|
allStr = "%s :" % k.upper()
|
|
try:
|
|
try:
|
|
- allStr += _(" %d translated" % v['good'])
|
|
|
|
|
|
+ allStr += _(" %d translated" % v["good"])
|
|
except:
|
|
except:
|
|
pass
|
|
pass
|
|
try:
|
|
try:
|
|
- allStr += _(" %d fuzzy" % v['fuzzy'])
|
|
|
|
|
|
+ allStr += _(" %d fuzzy" % v["fuzzy"])
|
|
except:
|
|
except:
|
|
pass
|
|
pass
|
|
try:
|
|
try:
|
|
- allStr += _(" %d untranslated" % v['bad'])
|
|
|
|
|
|
+ allStr += _(" %d untranslated" % v["bad"])
|
|
except:
|
|
except:
|
|
pass
|
|
pass
|
|
return allStr
|
|
return allStr
|
|
@@ -545,43 +562,46 @@ class AboutWindow(wx.Frame):
|
|
def _langBox(self, par, k, v):
|
|
def _langBox(self, par, k, v):
|
|
"""Return box"""
|
|
"""Return box"""
|
|
langBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
|
|
langBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
|
|
- tkey = StaticText(parent=par, id=wx.ID_ANY,
|
|
|
|
- label=k.upper())
|
|
|
|
|
|
+ tkey = StaticText(parent=par, id=wx.ID_ANY, label=k.upper())
|
|
langBox.Add(tkey)
|
|
langBox.Add(tkey)
|
|
try:
|
|
try:
|
|
- tgood = StaticText(parent=par, id=wx.ID_ANY,
|
|
|
|
- label=_("%d translated" % v['good']))
|
|
|
|
|
|
+ tgood = StaticText(
|
|
|
|
+ parent=par, id=wx.ID_ANY, label=_("%d translated" % v["good"])
|
|
|
|
+ )
|
|
tgood.SetForegroundColour(wx.Colour(35, 142, 35))
|
|
tgood.SetForegroundColour(wx.Colour(35, 142, 35))
|
|
langBox.Add(tgood)
|
|
langBox.Add(tgood)
|
|
except:
|
|
except:
|
|
- tgood = StaticText(parent=par, id=wx.ID_ANY,
|
|
|
|
- label="")
|
|
|
|
|
|
+ tgood = StaticText(parent=par, id=wx.ID_ANY, label="")
|
|
langBox.Add(tgood)
|
|
langBox.Add(tgood)
|
|
try:
|
|
try:
|
|
- tfuzzy = StaticText(parent=par, id=wx.ID_ANY,
|
|
|
|
- label=_(" %d fuzzy" % v['fuzzy']))
|
|
|
|
|
|
+ tfuzzy = StaticText(
|
|
|
|
+ parent=par, id=wx.ID_ANY, label=_(" %d fuzzy" % v["fuzzy"])
|
|
|
|
+ )
|
|
tfuzzy.SetForegroundColour(wx.Colour(255, 142, 0))
|
|
tfuzzy.SetForegroundColour(wx.Colour(255, 142, 0))
|
|
langBox.Add(tfuzzy)
|
|
langBox.Add(tfuzzy)
|
|
except:
|
|
except:
|
|
- tfuzzy = StaticText(parent=par, id=wx.ID_ANY,
|
|
|
|
- label="")
|
|
|
|
|
|
+ tfuzzy = StaticText(parent=par, id=wx.ID_ANY, label="")
|
|
langBox.Add(tfuzzy)
|
|
langBox.Add(tfuzzy)
|
|
try:
|
|
try:
|
|
- tbad = StaticText(parent=par, id=wx.ID_ANY,
|
|
|
|
- label=_(" %d untranslated" % v['bad']))
|
|
|
|
|
|
+ tbad = StaticText(
|
|
|
|
+ parent=par, id=wx.ID_ANY, label=_(" %d untranslated" % v["bad"])
|
|
|
|
+ )
|
|
tbad.SetForegroundColour(wx.Colour(255, 0, 0))
|
|
tbad.SetForegroundColour(wx.Colour(255, 0, 0))
|
|
langBox.Add(tbad)
|
|
langBox.Add(tbad)
|
|
except:
|
|
except:
|
|
- tbad = StaticText(parent=par, id=wx.ID_ANY,
|
|
|
|
- label="")
|
|
|
|
|
|
+ tbad = StaticText(parent=par, id=wx.ID_ANY, label="")
|
|
langBox.Add(tbad)
|
|
langBox.Add(tbad)
|
|
return langBox
|
|
return langBox
|
|
|
|
|
|
def _langPanel(self, lang, js):
|
|
def _langPanel(self, lang, js):
|
|
"""Create panel for each languages"""
|
|
"""Create panel for each languages"""
|
|
- text = self._langString(lang, js['total'])
|
|
|
|
|
|
+ text = self._langString(lang, js["total"])
|
|
panel = wx.CollapsiblePane(
|
|
panel = wx.CollapsiblePane(
|
|
- self.statswin, -1, label=text, style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE)
|
|
|
|
|
|
+ self.statswin,
|
|
|
|
+ -1,
|
|
|
|
+ label=text,
|
|
|
|
+ style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE,
|
|
|
|
+ )
|
|
panel.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged)
|
|
panel.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged)
|
|
win = panel.GetPane()
|
|
win = panel.GetPane()
|
|
# TODO IT DOESN'T WORK
|
|
# TODO IT DOESN'T WORK
|
|
@@ -592,10 +612,9 @@ class AboutWindow(wx.Frame):
|
|
# panel.Collapse(True)
|
|
# panel.Collapse(True)
|
|
pageSizer = wx.BoxSizer(wx.VERTICAL)
|
|
pageSizer = wx.BoxSizer(wx.VERTICAL)
|
|
for k, v in six.iteritems(js):
|
|
for k, v in six.iteritems(js):
|
|
- if k != 'total' and k != 'name':
|
|
|
|
|
|
+ if k != "total" and k != "name":
|
|
box = self._langBox(win, k, v)
|
|
box = self._langBox(win, k, v)
|
|
- pageSizer.Add(box, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ pageSizer.Add(box, proportion=1, flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
win.SetSizer(pageSizer)
|
|
win.SetSizer(pageSizer)
|
|
pageSizer.SetSizeHints(win)
|
|
pageSizer.SetSizeHints(win)
|
|
@@ -614,6 +633,7 @@ class AboutWindow(wx.Frame):
|
|
if os.path.exists(statsfile):
|
|
if os.path.exists(statsfile):
|
|
statsFile = open(statsfile)
|
|
statsFile = open(statsfile)
|
|
import json
|
|
import json
|
|
|
|
+
|
|
jsStats = json.load(statsFile)
|
|
jsStats = json.load(statsFile)
|
|
else:
|
|
else:
|
|
jsStats = None
|
|
jsStats = None
|
|
@@ -623,16 +643,16 @@ class AboutWindow(wx.Frame):
|
|
if not jsStats:
|
|
if not jsStats:
|
|
Debug.msg(5, _("File <%s> not found") % fname)
|
|
Debug.msg(5, _("File <%s> not found") % fname)
|
|
statsSizer = wx.BoxSizer(wx.VERTICAL)
|
|
statsSizer = wx.BoxSizer(wx.VERTICAL)
|
|
- statstext = StaticText(self.statswin, id=wx.ID_ANY,
|
|
|
|
- label=_('%s file missing') % fname)
|
|
|
|
- statsSizer.Add(statstext, proportion=1,
|
|
|
|
- flag=wx.EXPAND | wx.ALL, border=3)
|
|
|
|
|
|
+ statstext = StaticText(
|
|
|
|
+ self.statswin, id=wx.ID_ANY, label=_("%s file missing") % fname
|
|
|
|
+ )
|
|
|
|
+ statsSizer.Add(statstext, proportion=1, flag=wx.EXPAND | wx.ALL, border=3)
|
|
else:
|
|
else:
|
|
- languages = sorted(jsStats['langs'].keys())
|
|
|
|
|
|
+ languages = sorted(jsStats["langs"].keys())
|
|
|
|
|
|
statsSizer = wx.BoxSizer(wx.VERTICAL)
|
|
statsSizer = wx.BoxSizer(wx.VERTICAL)
|
|
for lang in languages:
|
|
for lang in languages:
|
|
- v = jsStats['langs'][lang]
|
|
|
|
|
|
+ v = jsStats["langs"][lang]
|
|
panel = self._langPanel(lang, v)
|
|
panel = self._langPanel(lang, v)
|
|
statsSizer.Add(panel)
|
|
statsSizer.Add(panel)
|
|
|
|
|
|
@@ -661,8 +681,13 @@ class HelpFrame(wx.Dialog):
|
|
|
|
|
|
def __init__(self, parent, id, title, size, file):
|
|
def __init__(self, parent, id, title, size, file):
|
|
wx.Dialog.__init__(
|
|
wx.Dialog.__init__(
|
|
- self, parent=parent, id=id, title=title, size=size,
|
|
|
|
- style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MINIMIZE_BOX)
|
|
|
|
|
|
+ self,
|
|
|
|
+ parent=parent,
|
|
|
|
+ id=id,
|
|
|
|
+ title=title,
|
|
|
|
+ size=size,
|
|
|
|
+ style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MINIMIZE_BOX,
|
|
|
|
+ )
|
|
|
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
|
@@ -685,8 +710,7 @@ class HelpWindow(HtmlWindow):
|
|
be integrated into the cmdPanel and options are obvious there.
|
|
be integrated into the cmdPanel and options are obvious there.
|
|
"""
|
|
"""
|
|
|
|
|
|
- def __init__(self, parent, command, text, skipDescription,
|
|
|
|
- **kwargs):
|
|
|
|
|
|
+ def __init__(self, parent, command, text, skipDescription, **kwargs):
|
|
"""If command is given, the corresponding HTML help
|
|
"""If command is given, the corresponding HTML help
|
|
file will be presented, with all links pointing to absolute
|
|
file will be presented, with all links pointing to absolute
|
|
paths of local files.
|
|
paths of local files.
|
|
@@ -712,8 +736,7 @@ class HelpWindow(HtmlWindow):
|
|
if text is None:
|
|
if text is None:
|
|
if skipDescription:
|
|
if skipDescription:
|
|
url = os.path.join(self.fspath, command + ".html")
|
|
url = os.path.join(self.fspath, command + ".html")
|
|
- self.fillContentsFromFile(url,
|
|
|
|
- skipDescription=skipDescription)
|
|
|
|
|
|
+ self.fillContentsFromFile(url, skipDescription=skipDescription)
|
|
self.history.append(url)
|
|
self.history.append(url)
|
|
self.loaded = True
|
|
self.loaded = True
|
|
else:
|
|
else:
|
|
@@ -726,7 +749,7 @@ class HelpWindow(HtmlWindow):
|
|
|
|
|
|
def OnLinkClicked(self, linkinfo):
|
|
def OnLinkClicked(self, linkinfo):
|
|
url = linkinfo.GetHref()
|
|
url = linkinfo.GetHref()
|
|
- if url[:4] != 'http':
|
|
|
|
|
|
+ if url[:4] != "http":
|
|
url = os.path.join(self.fspath, url)
|
|
url = os.path.join(self.fspath, url)
|
|
self.history.append(url)
|
|
self.history.append(url)
|
|
self.historyIdx += 1
|
|
self.historyIdx += 1
|
|
@@ -761,20 +784,20 @@ class HelpWindow(HtmlWindow):
|
|
if findALink is not None:
|
|
if findALink is not None:
|
|
contents.append(
|
|
contents.append(
|
|
aLink.sub(
|
|
aLink.sub(
|
|
- findALink.group(1) +
|
|
|
|
- self.fspath +
|
|
|
|
- findALink.group(2),
|
|
|
|
- line
|
|
|
|
|
|
+ findALink.group(1)
|
|
|
|
+ + self.fspath
|
|
|
|
+ + findALink.group(2),
|
|
|
|
+ line,
|
|
)
|
|
)
|
|
)
|
|
)
|
|
findImgLink = imgLink.search(line)
|
|
findImgLink = imgLink.search(line)
|
|
if findImgLink is not None:
|
|
if findImgLink is not None:
|
|
contents.append(
|
|
contents.append(
|
|
imgLink.sub(
|
|
imgLink.sub(
|
|
- findImgLink.group(1) +
|
|
|
|
- self.fspath +
|
|
|
|
- findImgLink.group(2),
|
|
|
|
- line
|
|
|
|
|
|
+ findImgLink.group(1)
|
|
|
|
+ + self.fspath
|
|
|
|
+ + findImgLink.group(2),
|
|
|
|
+ line,
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
|
|
@@ -787,19 +810,17 @@ class HelpWindow(HtmlWindow):
|
|
|
|
|
|
|
|
|
|
class HelpPanel(wx.Panel):
|
|
class HelpPanel(wx.Panel):
|
|
-
|
|
|
|
- def __init__(self, parent, command="index", text=None,
|
|
|
|
- skipDescription=False, **kwargs):
|
|
|
|
|
|
+ def __init__(
|
|
|
|
+ self, parent, command="index", text=None, skipDescription=False, **kwargs
|
|
|
|
+ ):
|
|
self.command = command
|
|
self.command = command
|
|
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
|
|
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
|
|
|
|
|
|
self.content = HelpWindow(self, command, text, skipDescription)
|
|
self.content = HelpWindow(self, command, text, skipDescription)
|
|
|
|
|
|
- self.btnNext = Button(parent=self, id=wx.ID_ANY,
|
|
|
|
- label=_("&Next"))
|
|
|
|
|
|
+ self.btnNext = Button(parent=self, id=wx.ID_ANY, label=_("&Next"))
|
|
self.btnNext.Enable(False)
|
|
self.btnNext.Enable(False)
|
|
- self.btnPrev = Button(parent=self, id=wx.ID_ANY,
|
|
|
|
- label=_("&Previous"))
|
|
|
|
|
|
+ self.btnPrev = Button(parent=self, id=wx.ID_ANY, label=_("&Previous"))
|
|
self.btnPrev.Enable(False)
|
|
self.btnPrev.Enable(False)
|
|
|
|
|
|
self.btnNext.Bind(wx.EVT_BUTTON, self.OnNext)
|
|
self.btnNext.Bind(wx.EVT_BUTTON, self.OnNext)
|
|
@@ -812,16 +833,12 @@ class HelpPanel(wx.Panel):
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
|
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
|
|
|
- btnSizer.Add(self.btnPrev, proportion=0,
|
|
|
|
- flag=wx.ALL, border=5)
|
|
|
|
|
|
+ btnSizer.Add(self.btnPrev, proportion=0, flag=wx.ALL, border=5)
|
|
btnSizer.Add(wx.Size(1, 1), proportion=1)
|
|
btnSizer.Add(wx.Size(1, 1), proportion=1)
|
|
- btnSizer.Add(self.btnNext, proportion=0,
|
|
|
|
- flag=wx.ALL, border=5)
|
|
|
|
|
|
+ btnSizer.Add(self.btnNext, proportion=0, flag=wx.ALL, border=5)
|
|
|
|
|
|
- sizer.Add(self.content, proportion=1,
|
|
|
|
- flag=wx.EXPAND)
|
|
|
|
- sizer.Add(btnSizer, proportion=0,
|
|
|
|
- flag=wx.EXPAND)
|
|
|
|
|
|
+ sizer.Add(self.content, proportion=1, flag=wx.EXPAND)
|
|
|
|
+ sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)
|
|
|
|
|
|
self.SetSizer(sizer)
|
|
self.SetSizer(sizer)
|
|
sizer.Fit(self)
|
|
sizer.Fit(self)
|
|
@@ -840,10 +857,10 @@ class HelpPanel(wx.Panel):
|
|
return fMan
|
|
return fMan
|
|
|
|
|
|
# check also addons
|
|
# check also addons
|
|
- faMan = os.path.join(os.getenv('GRASS_ADDON_BASE'), "docs", "html",
|
|
|
|
- self.command + ".html")
|
|
|
|
- if os.getenv('GRASS_ADDON_BASE') and \
|
|
|
|
- os.path.isfile(faMan):
|
|
|
|
|
|
+ faMan = os.path.join(
|
|
|
|
+ os.getenv("GRASS_ADDON_BASE"), "docs", "html", self.command + ".html"
|
|
|
|
+ )
|
|
|
|
+ if os.getenv("GRASS_ADDON_BASE") and os.path.isfile(faMan):
|
|
return faMan
|
|
return faMan
|
|
|
|
|
|
return None
|
|
return None
|
|
@@ -894,47 +911,55 @@ def ShowAboutDialog(prgName, startYear):
|
|
info = AboutDialogInfo()
|
|
info = AboutDialogInfo()
|
|
|
|
|
|
info.SetIcon(
|
|
info.SetIcon(
|
|
- wx.Icon(
|
|
|
|
- os.path.join(
|
|
|
|
- globalvar.ICONDIR,
|
|
|
|
- 'grass.ico'),
|
|
|
|
- wx.BITMAP_TYPE_ICO))
|
|
|
|
|
|
+ wx.Icon(os.path.join(globalvar.ICONDIR, "grass.ico"), wx.BITMAP_TYPE_ICO)
|
|
|
|
+ )
|
|
info.SetName(prgName)
|
|
info.SetName(prgName)
|
|
- info.SetWebSite('https://grass.osgeo.org')
|
|
|
|
|
|
+ info.SetWebSite("https://grass.osgeo.org")
|
|
info.SetDescription(
|
|
info.SetDescription(
|
|
- _grassDevTeam(startYear) +
|
|
|
|
- '\n\n' +
|
|
|
|
- '\n'.join(
|
|
|
|
|
|
+ _grassDevTeam(startYear)
|
|
|
|
+ + "\n\n"
|
|
|
|
+ + "\n".join(
|
|
textwrap.wrap(
|
|
textwrap.wrap(
|
|
- 'This program is free software under the GNU General Public License'
|
|
|
|
- '(>=v2). Read the file COPYING that comes with GRASS for details.',
|
|
|
|
- 75)))
|
|
|
|
|
|
+ "This program is free software under the GNU General Public License"
|
|
|
|
+ "(>=v2). Read the file COPYING that comes with GRASS for details.",
|
|
|
|
+ 75,
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
|
|
AboutBox(info)
|
|
AboutBox(info)
|
|
|
|
|
|
|
|
|
|
def _grassDevTeam(start):
|
|
def _grassDevTeam(start):
|
|
try:
|
|
try:
|
|
- end = grass.version()['date']
|
|
|
|
|
|
+ end = grass.version()["date"]
|
|
except KeyError:
|
|
except KeyError:
|
|
sys.stderr.write(_("Unable to get GRASS version\n"))
|
|
sys.stderr.write(_("Unable to get GRASS version\n"))
|
|
|
|
|
|
from datetime import date
|
|
from datetime import date
|
|
|
|
+
|
|
end = date.today().year
|
|
end = date.today().year
|
|
|
|
|
|
- return '%(c)s %(start)s-%(end)s by the GRASS Development Team' % {
|
|
|
|
- 'c': chr(169), 'start': start, 'end': end}
|
|
|
|
|
|
+ return "%(c)s %(start)s-%(end)s by the GRASS Development Team" % {
|
|
|
|
+ "c": chr(169),
|
|
|
|
+ "start": start,
|
|
|
|
+ "end": end,
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
def main():
|
|
def main():
|
|
"""Test application (potentially useful as g.gui.gmanual)"""
|
|
"""Test application (potentially useful as g.gui.gmanual)"""
|
|
app = wx.App()
|
|
app = wx.App()
|
|
- frame = HelpFrame(parent=None, id=wx.ID_ANY,
|
|
|
|
- title="Test help application",
|
|
|
|
- size=(600, 800), file=sys.argv[1])
|
|
|
|
|
|
+ frame = HelpFrame(
|
|
|
|
+ parent=None,
|
|
|
|
+ id=wx.ID_ANY,
|
|
|
|
+ title="Test help application",
|
|
|
|
+ size=(600, 800),
|
|
|
|
+ file=sys.argv[1],
|
|
|
|
+ )
|
|
frame.Show()
|
|
frame.Show()
|
|
app.MainLoop()
|
|
app.MainLoop()
|
|
|
|
|
|
|
|
|
|
-if __name__ == '__main__':
|
|
|
|
|
|
+if __name__ == "__main__":
|
|
main()
|
|
main()
|