|
@@ -62,6 +62,7 @@ import wx.html
|
|
|
import wx.stc
|
|
|
import wx.lib.customtreectrl as CT
|
|
|
import wx.lib.flatnotebook as FN
|
|
|
+import wx.lib.scrolledpanel as scrolled
|
|
|
from wx.lib.wordwrap import wordwrap
|
|
|
|
|
|
grassPath = os.path.join(globalvar.ETCDIR, "python")
|
|
@@ -528,112 +529,9 @@ class GMFrame(wx.Frame):
|
|
|
|
|
|
def OnAboutGRASS(self, event):
|
|
|
"""!Display 'About GRASS' dialog"""
|
|
|
- import wx.lib.scrolledpanel as scrolled
|
|
|
-
|
|
|
- aboutwin = wx.Frame(self, id=wx.ID_ANY, size=(550,400),
|
|
|
- title='About GRASS GIS')
|
|
|
-
|
|
|
- # version and web site
|
|
|
- version, svn_gis_h_rev, svn_gis_h_date = gcmd.RunCommand('g.version',
|
|
|
- flags = 'r',
|
|
|
- read = True).splitlines()
|
|
|
-
|
|
|
- info = version.replace('GRASS', 'GRASS GIS version ').strip()
|
|
|
- info = ''.join([info,"\n\n",'Official GRASS site: http://grass.osgeo.org'])
|
|
|
- infotxt = wx.StaticText(aboutwin, id=wx.ID_ANY, label=info)
|
|
|
-
|
|
|
- # copyright information
|
|
|
- copyfile = os.path.join(os.getenv("GISBASE"), "COPYING")
|
|
|
- if os.path.exists(copyfile):
|
|
|
- copyrightFile = open(copyfile, 'r')
|
|
|
- copyrightOut = []
|
|
|
- copyright = copyrightFile.readlines()
|
|
|
- copytext = ('GIS Library '+ svn_gis_h_rev + '(' + svn_gis_h_date.split(' ')[1] + ')' +
|
|
|
- '\n\n' + wordwrap(''.join(copyright[:11] + copyright[26:-3]),
|
|
|
- 575, wx.ClientDC(self)))
|
|
|
- copyrightFile.close()
|
|
|
- else:
|
|
|
- copytext = 'COPYING file missing'
|
|
|
- # put text into a scrolling panel
|
|
|
- copyrightwin = scrolled.ScrolledPanel(aboutwin, id=wx.ID_ANY,
|
|
|
- size=wx.DefaultSize,
|
|
|
- style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
|
|
- copyrighttxt = wx.StaticText(copyrightwin, id=wx.ID_ANY, label=copytext)
|
|
|
- copyrightwin.SetAutoLayout(1)
|
|
|
- copyrightwin.SetupScrolling()
|
|
|
- copyrightwin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
- copyrightwin.sizer.Add(item=copyrighttxt, proportion=1,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
- copyrightwin.SetSizer(copyrightwin.sizer)
|
|
|
- copyrightwin.Layout()
|
|
|
-
|
|
|
- # license
|
|
|
- licfile = os.path.join(os.getenv("GISBASE"), "GPL.TXT")
|
|
|
- if os.path.exists(licfile):
|
|
|
- licenceFile = open(licfile, 'r')
|
|
|
- license = ''.join(licenceFile.readlines())
|
|
|
- licenceFile.close()
|
|
|
- else:
|
|
|
- license = 'GPL.TXT file missing'
|
|
|
- # put text into a scrolling panel
|
|
|
- licensewin = scrolled.ScrolledPanel(aboutwin, id=wx.ID_ANY,
|
|
|
- size=wx.DefaultSize,
|
|
|
- style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
|
|
- licensetxt = wx.StaticText(licensewin, id=wx.ID_ANY, label=license)
|
|
|
- licensewin.SetAutoLayout(1)
|
|
|
- licensewin.SetupScrolling()
|
|
|
- licensewin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
- licensewin.sizer.Add(item=licensetxt, proportion=1,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
- licensewin.SetSizer(licensewin.sizer)
|
|
|
- licensewin.Layout()
|
|
|
-
|
|
|
- # credits
|
|
|
- authfile = os.path.join(os.getenv("GISBASE"), "AUTHORS")
|
|
|
- if os.path.exists(authfile):
|
|
|
- authorsFile = open(authfile, 'r')
|
|
|
- authors = unicode(''.join(authorsFile.readlines()), "utf-8")
|
|
|
- authorsFile.close()
|
|
|
- else:
|
|
|
- authors = 'AUTHORS file missing'
|
|
|
- authorwin = scrolled.ScrolledPanel(aboutwin, id=wx.ID_ANY,
|
|
|
- size=wx.DefaultSize,
|
|
|
- style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
|
|
- authortxt = wx.StaticText(authorwin, id=wx.ID_ANY, label=str(authors))
|
|
|
- authorwin.SetAutoLayout(1)
|
|
|
- authorwin.SetupScrolling()
|
|
|
- authorwin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
- authorwin.sizer.Add(item=authortxt, proportion=1,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
- authorwin.SetSizer(authorwin.sizer)
|
|
|
- authorwin.Layout()
|
|
|
-
|
|
|
- # create a flat notebook for displaying information about GRASS
|
|
|
- nbstyle = FN.FNB_VC8 | \
|
|
|
- FN.FNB_BACKGROUND_GRADIENT | \
|
|
|
- FN.FNB_TABS_BORDER_SIMPLE | \
|
|
|
- FN.FNB_NO_X_BUTTON | \
|
|
|
- FN.FNB_NO_NAV_BUTTONS
|
|
|
-
|
|
|
- aboutgrass = FN.FlatNotebook(aboutwin, id=wx.ID_ANY, style=nbstyle)
|
|
|
- aboutgrass.SetTabAreaColour(globalvar.FNPageColor)
|
|
|
-
|
|
|
- # make pages for About GRASS notebook
|
|
|
- pg1 = aboutgrass.AddPage(infotxt, text=_("Info"))
|
|
|
- pg2 = aboutgrass.AddPage(copyrightwin, text=_("Copyright"))
|
|
|
- pg3 = aboutgrass.AddPage(licensewin, text=_("License"))
|
|
|
- pg4 = aboutgrass.AddPage(authorwin, text=_("Authors"))
|
|
|
-
|
|
|
- # bindings
|
|
|
-# self.aboutgrass.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnAGPageChanged)
|
|
|
-
|
|
|
- sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
- sizer.Add(item=aboutgrass, proportion=1,
|
|
|
- flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
- aboutwin.SetSizer(sizer)
|
|
|
- aboutwin.Layout()
|
|
|
- aboutwin.Centre()
|
|
|
- aboutwin.Show(True)
|
|
|
+ win = AboutWindow(self)
|
|
|
+ win.Centre()
|
|
|
+ win.Show(True)
|
|
|
|
|
|
def OnWorkspace(self, event):
|
|
|
"""!Workspace menu (new, load)"""
|
|
@@ -1614,6 +1512,148 @@ class GMFrame(wx.Frame):
|
|
|
caption=_("Message"),
|
|
|
style=wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
|
|
|
|
|
|
+class AboutWindow(wx.Frame):
|
|
|
+ def __init__(self, parent):
|
|
|
+ """!Create custom About Window
|
|
|
+
|
|
|
+ @todo improve styling
|
|
|
+ """
|
|
|
+ wx.Frame.__init__(self, parent=parent, id=wx.ID_ANY, size=(550,400),
|
|
|
+ title=_('About GRASS GIS'))
|
|
|
+
|
|
|
+ # version and web site
|
|
|
+ version, svn_gis_h_rev, svn_gis_h_date = gcmd.RunCommand('g.version',
|
|
|
+ flags = 'r',
|
|
|
+ read = True).splitlines()
|
|
|
+
|
|
|
+ infoTxt = wx.Panel(parent = self, id = wx.ID_ANY)
|
|
|
+ infoSizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
+ logo = os.path.join(globalvar.ETCDIR, "gui", "icons", "grass.ico")
|
|
|
+ logoBitmap = wx.StaticBitmap(parent = infoTxt, id = wx.ID_ANY,
|
|
|
+ bitmap = wx.Bitmap(name = logo,
|
|
|
+ type = wx.BITMAP_TYPE_ICO))
|
|
|
+ infoSizer.Add(item = logoBitmap, proportion = 0,
|
|
|
+ flag = wx.ALL | wx.ALIGN_CENTER, border = 10)
|
|
|
+
|
|
|
+ i = 0
|
|
|
+ for label in [version.replace('GRASS', 'GRASS GIS').strip() + '\n\n',
|
|
|
+ _('Official GRASS site: http://grass.osgeo.org') + '\n\n',
|
|
|
+ _('GIS Library') + ' ' + svn_gis_h_rev + '(' + svn_gis_h_date.split(' ')[1] + ')']:
|
|
|
+ info = wx.StaticText(parent = infoTxt,
|
|
|
+ id = wx.ID_ANY,
|
|
|
+ label = label)
|
|
|
+ if i == 0:
|
|
|
+ info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
|
|
|
+ infoSizer.Add(item = info, proportion = 0,
|
|
|
+ flag = wx.TOP | wx.ALIGN_CENTER, border = 5)
|
|
|
+ i += 1
|
|
|
+
|
|
|
+ # copyright information
|
|
|
+ copyfile = os.path.join(os.getenv("GISBASE"), "COPYING")
|
|
|
+ if os.path.exists(copyfile):
|
|
|
+ copyrightFile = open(copyfile, 'r')
|
|
|
+ copyrightOut = []
|
|
|
+ copyright = copyrightFile.readlines()
|
|
|
+ copytext = wordwrap(''.join(copyright[:11] + copyright[26:-3]),
|
|
|
+ 575, wx.ClientDC(self))
|
|
|
+ copyrightFile.close()
|
|
|
+ else:
|
|
|
+ copytext = _('COPYING file missing')
|
|
|
+ # put text into a scrolling panel
|
|
|
+ copyrightwin = scrolled.ScrolledPanel(self, id=wx.ID_ANY,
|
|
|
+ size=wx.DefaultSize,
|
|
|
+ style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
|
|
+ copyrighttxt = wx.StaticText(copyrightwin, id=wx.ID_ANY, label=copytext)
|
|
|
+ copyrightwin.SetAutoLayout(1)
|
|
|
+ copyrightwin.SetupScrolling()
|
|
|
+ copyrightwin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
+ copyrightwin.sizer.Add(item=copyrighttxt, proportion=1,
|
|
|
+ flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
+ copyrightwin.SetSizer(copyrightwin.sizer)
|
|
|
+ copyrightwin.Layout()
|
|
|
+
|
|
|
+ # license
|
|
|
+ licfile = os.path.join(os.getenv("GISBASE"), "GPL.TXT")
|
|
|
+ if os.path.exists(licfile):
|
|
|
+ licenceFile = open(licfile, 'r')
|
|
|
+ license = ''.join(licenceFile.readlines())
|
|
|
+ licenceFile.close()
|
|
|
+ else:
|
|
|
+ license = _('GPL.TXT file missing')
|
|
|
+ # put text into a scrolling panel
|
|
|
+ licensewin = scrolled.ScrolledPanel(self, id=wx.ID_ANY,
|
|
|
+ size=wx.DefaultSize,
|
|
|
+ style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
|
|
+ licensetxt = wx.StaticText(licensewin, id=wx.ID_ANY, label=license)
|
|
|
+ licensewin.SetAutoLayout(1)
|
|
|
+ licensewin.SetupScrolling()
|
|
|
+ licensewin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
+ licensewin.sizer.Add(item=licensetxt, proportion=1,
|
|
|
+ flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
+ licensewin.SetSizer(licensewin.sizer)
|
|
|
+ licensewin.Layout()
|
|
|
+
|
|
|
+ # credits
|
|
|
+ authfile = os.path.join(os.getenv("GISBASE"), "AUTHORS")
|
|
|
+ if os.path.exists(authfile):
|
|
|
+ authorsFile = open(authfile, 'r')
|
|
|
+ authors = unicode(''.join(authorsFile.readlines()), "utf-8")
|
|
|
+ authorsFile.close()
|
|
|
+ else:
|
|
|
+ authors = _('AUTHORS file missing')
|
|
|
+ authorwin = scrolled.ScrolledPanel(self, id=wx.ID_ANY,
|
|
|
+ size=wx.DefaultSize,
|
|
|
+ style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
|
|
+ authortxt = wx.StaticText(authorwin, id=wx.ID_ANY, label=str(authors))
|
|
|
+ authorwin.SetAutoLayout(1)
|
|
|
+ authorwin.SetupScrolling()
|
|
|
+ authorwin.sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
+ authorwin.sizer.Add(item=authortxt, proportion=1,
|
|
|
+ flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
+ authorwin.SetSizer(authorwin.sizer)
|
|
|
+ authorwin.Layout()
|
|
|
+
|
|
|
+ # create a flat notebook for displaying information about GRASS
|
|
|
+ nbstyle = FN.FNB_VC8 | \
|
|
|
+ FN.FNB_BACKGROUND_GRADIENT | \
|
|
|
+ FN.FNB_TABS_BORDER_SIMPLE | \
|
|
|
+ FN.FNB_NO_X_BUTTON | \
|
|
|
+ FN.FNB_NO_NAV_BUTTONS
|
|
|
+
|
|
|
+ aboutNotebook = FN.FlatNotebook(self, id=wx.ID_ANY, style=nbstyle)
|
|
|
+ aboutNotebook.SetTabAreaColour(globalvar.FNPageColor)
|
|
|
+
|
|
|
+ # make pages for About GRASS notebook
|
|
|
+ pg1 = aboutNotebook.AddPage(infoTxt, text=_("Info"))
|
|
|
+ pg2 = aboutNotebook.AddPage(copyrightwin, text=_("Copyright"))
|
|
|
+ pg3 = aboutNotebook.AddPage(licensewin, text=_("License"))
|
|
|
+ pg4 = aboutNotebook.AddPage(authorwin, text=_("Authors"))
|
|
|
+
|
|
|
+ # buttons
|
|
|
+ btnClose = wx.Button(parent = self, id = wx.ID_CLOSE)
|
|
|
+ btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
+ btnSizer.Add(item = btnClose, proportion = 1,
|
|
|
+ flag = wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT,
|
|
|
+ border = 5)
|
|
|
+ # bindings
|
|
|
+ # self.aboutNotebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnAGPageChanged)
|
|
|
+ btnClose.Bind(wx.EVT_BUTTON, self.OnCloseWindow)
|
|
|
+
|
|
|
+ infoTxt.SetSizer(infoSizer)
|
|
|
+ infoSizer.Fit(infoTxt)
|
|
|
+
|
|
|
+ sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
+ sizer.Add(item=aboutNotebook, proportion=1,
|
|
|
+ flag=wx.EXPAND | wx.ALL, border=1)
|
|
|
+ sizer.Add(item=btnSizer, proportion=0,
|
|
|
+ flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=1)
|
|
|
+ self.SetSizer(sizer)
|
|
|
+ self.Layout()
|
|
|
+
|
|
|
+ def OnCloseWindow(self, event):
|
|
|
+ """!Close window"""
|
|
|
+ self.Close()
|
|
|
+
|
|
|
class GMApp(wx.App):
|
|
|
def __init__(self, workspace = None):
|
|
|
"""!Main GUI class.
|