4 @brief Main Python application for GRASS wxPython GUI 
   10 (C) 2006-2011 by the GRASS Development Team 
   12 This program is free software under the GNU General Public License 
   13 (>=v2). Read the file COPYING that comes with GRASS for details. 
   15 @author Michael Barton (Arizona State University) 
   16 @author Jachym Cepicky (Mendel University of Agriculture) 
   17 @author Martin Landa <landa.martin gmail.com> 
   18 @author Vaclav Petras <wenzeslaus gmail.com> (menu customization) 
   25 if __name__ == 
"__main__":
 
   26     sys.path.append(os.path.join(os.getenv(
'GISBASE'), 
'etc', 
'wxpython'))
 
   27 from core 
import globalvar
 
   30     import wx.lib.agw.advancedsplash 
as SC
 
   34 from lmgr.frame 
import GMFrame
 
   40         @param workspace path to the workspace file 
   45         wx.App.__init__(self, 
False)
 
   47         self.
locale = wx.Locale(language = wx.LANGUAGE_DEFAULT)
 
   50         """!Initialize all available image handlers 
   55             wx.InitAllImageHandlers()
 
   58         introImagePath = os.path.join(globalvar.ETCIMGDIR, 
"silesia_splash.png")
 
   59         introImage     = wx.Image(introImagePath, wx.BITMAP_TYPE_PNG)
 
   60         introBmp       = introImage.ConvertToBitmap()
 
   61         if SC 
and sys.platform != 
'darwin':
 
   64             splash = SC.AdvancedSplash(bitmap = introBmp, 
 
   65                                        timeout = 2000, parent = 
None, id = wx.ID_ANY)
 
   66             splash.SetText(_(
'Starting GRASS GUI...'))
 
   67             splash.SetTextColour(wx.Colour(45, 52, 27))
 
   68             splash.SetTextFont(wx.Font(pointSize = 15, family = wx.DEFAULT, style = wx.NORMAL,
 
   70             splash.SetTextPosition((150, 430))
 
   72             wx.SplashScreen (bitmap = introBmp, splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
 
   73                              milliseconds = 2000, parent = 
None, id = wx.ID_ANY)
 
   78         mainframe = GMFrame(parent = 
None, id = wx.ID_ANY,
 
   82         self.SetTopWindow(mainframe)
 
   91     """!Print program help""" 
   92     print >> sys.stderr, 
"Usage:" 
   93     print >> sys.stderr, 
" python wxgui.py [options]" 
   94     print >> sys.stderr, 
"%sOptions:" % os.linesep
 
   95     print >> sys.stderr, 
" -w\t--workspace file\tWorkspace file to load" 
   99     """!Process command-line arguments""" 
  102         if o 
in (
"-h", 
"--help"):
 
  105         if o 
in (
"-w", 
"--workspace"):
 
  107                 workspaceFile = str(a)
 
  109                 workspaceFile = args.pop(0)
 
  111     return (workspaceFile,)
 
  115     gettext.install(
'grasswxpy', os.path.join(os.getenv(
"GISBASE"), 
'locale'), unicode = 
True)
 
  121             opts, args = getopt.getopt(argv[1:], 
"hw:",
 
  122                                        [
"help", 
"workspace"])
 
  123         except getopt.error, msg:
 
  127         print >> sys.stderr, err.msg
 
  128         print >> sys.stderr, 
"for help use --help" 
  133     app = 
GMApp(workspaceFile)
 
  139 if __name__ == 
"__main__":
 
def CheckWxVersion
Check wx version. 
def process_opt
Process command-line arguments. 
def __init__
Main GUI class. 
def printHelp
Print program help. 
def OnInit
Initialize all available image handlers.