[GRASS-SVN] r57138 - in grass/trunk/gui/wxpython: gmodeler gui_core psmap

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 15 03:49:40 PDT 2013


Author: annakrat
Date: 2013-07-15 03:49:40 -0700 (Mon, 15 Jul 2013)
New Revision: 57138

Modified:
   grass/trunk/gui/wxpython/gmodeler/frame.py
   grass/trunk/gui/wxpython/gui_core/ghelp.py
   grass/trunk/gui/wxpython/psmap/frame.py
Log:
wxGUI: reusable about dialog, not translatable

Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py	2013-07-15 10:48:11 UTC (rev 57137)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py	2013-07-15 10:49:40 UTC (rev 57138)
@@ -23,7 +23,6 @@
 import sys
 import time
 import stat
-import textwrap
 import tempfile
 import copy
 import re
@@ -41,6 +40,7 @@
 from core.debug           import Debug
 from core.gcmd            import GMessage, GException, GWarning, GError, RunCommand
 from gui_core.dialogs     import GetImageHandlers
+from gui_core.ghelp       import ShowAboutDialog
 from gui_core.preferences import PreferencesBaseDialog
 from core.settings        import UserSettings
 from gui_core.menu        import Menu
@@ -720,18 +720,8 @@
 
     def OnAbout(self, event):
         """!Display About window"""
-        info = wx.AboutDialogInfo()
-
-        info.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
-        info.SetName(_('wxGUI Graphical Modeler'))
-        info.SetWebSite('http://grass.osgeo.org')
-        year = grass.version()['date']
-        info.SetDescription(_('(C) 2010-%s by the GRASS Development Team\n\n') % year + 
-                            '\n'.join(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)))
+        ShowAboutDialog(prgName=_('wxGUI Graphical Modeler'), startYear='2010')
         
-        wx.AboutBox(info)
-        
     def GetOptData(self, dcmd, layer, params, propwin):
         """!Process action data"""
         if params: # add data items

Modified: grass/trunk/gui/wxpython/gui_core/ghelp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/ghelp.py	2013-07-15 10:48:11 UTC (rev 57137)
+++ grass/trunk/gui/wxpython/gui_core/ghelp.py	2013-07-15 10:49:40 UTC (rev 57138)
@@ -21,6 +21,7 @@
 import codecs
 import platform
 import re
+import textwrap
 
 import wx
 from wx.html import HtmlWindow
@@ -773,3 +774,21 @@
         self.OnHistory()
         
         event.Skip()
+
+def ShowAboutDialog(prgName, startYear):
+    """!Displays About window.
+
+    @param prgName name of the program
+    @param startYear the first year of existence of the program
+    """
+    info = wx.AboutDialogInfo()
+    
+    info.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
+    info.SetName(prgName)
+    info.SetWebSite('http://grass.osgeo.org')
+    year = grass.version()['date']
+    info.SetDescription('(C) %(start)s-%(end)s by the GRASS Development Team\n\n' % {'start': startYear, 'end': year} +
+                        '\n'.join(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)))
+    
+    wx.AboutBox(info)

Modified: grass/trunk/gui/wxpython/psmap/frame.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/frame.py	2013-07-15 10:48:11 UTC (rev 57137)
+++ grass/trunk/gui/wxpython/psmap/frame.py	2013-07-15 10:49:40 UTC (rev 57138)
@@ -17,7 +17,6 @@
 
 import os
 import sys
-import textwrap
 import Queue
 from math import sin, cos, pi, sqrt
 
@@ -38,6 +37,7 @@
 from core.settings      import UserSettings
 from gui_core.forms     import GUI
 from gui_core.dialogs   import HyperlinkDialog
+from gui_core.ghelp     import ShowAboutDialog
 from psmap.menudata     import PsMapMenuData
 
 from psmap.dialogs      import *
@@ -1062,16 +1062,7 @@
         
     def OnAbout(self, event):
         """!Display About window"""
-        info = wx.AboutDialogInfo()
-        
-        info.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
-        info.SetName(_('wxGUI Cartographic Composer'))
-        info.SetWebSite('http://grass.osgeo.org')
-        info.SetDescription(_('(C) 2011 by the GRASS Development Team\n\n') + 
-                            '\n'.join(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)))
-        
-        wx.AboutBox(info)
+        ShowAboutDialog(prgName=_('wxGUI Cartographic Composer'), startYear='2011')
 
     def OnCloseWindow(self, event):
         """!Close window"""



More information about the grass-commit mailing list