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
54 wx.InitAllImageHandlers()
57 introImagePath = os.path.join(globalvar.ETCIMGDIR,
"silesia_splash.png")
58 introImage = wx.Image(introImagePath, wx.BITMAP_TYPE_PNG)
59 introBmp = introImage.ConvertToBitmap()
60 if SC
and sys.platform !=
'darwin':
63 splash = SC.AdvancedSplash(bitmap = introBmp,
64 timeout = 2000, parent =
None, id = wx.ID_ANY)
65 splash.SetText(_(
'Starting GRASS GUI...'))
66 splash.SetTextColour(wx.Colour(45, 52, 27))
67 splash.SetTextFont(wx.Font(pointSize = 15, family = wx.DEFAULT, style = wx.NORMAL,
69 splash.SetTextPosition((150, 430))
71 wx.SplashScreen (bitmap = introBmp, splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
72 milliseconds = 2000, parent =
None, id = wx.ID_ANY)
77 mainframe = GMFrame(parent =
None, id = wx.ID_ANY,
81 self.SetTopWindow(mainframe)
90 """!Print program help"""
91 print >> sys.stderr,
"Usage:"
92 print >> sys.stderr,
" python wxgui.py [options]"
93 print >> sys.stderr,
"%sOptions:" % os.linesep
94 print >> sys.stderr,
" -w\t--workspace file\tWorkspace file to load"
98 """!Process command-line arguments"""
101 if o
in (
"-h",
"--help"):
104 if o
in (
"-w",
"--workspace"):
106 workspaceFile = str(a)
108 workspaceFile = args.pop(0)
110 return (workspaceFile,)
114 gettext.install(
'grasswxpy', os.path.join(os.getenv(
"GISBASE"),
'locale'), unicode =
True)
120 opts, args = getopt.getopt(argv[1:],
"hw:",
121 [
"help",
"workspace"])
122 except getopt.error, msg:
126 print >> sys.stderr, err.msg
127 print >> sys.stderr,
"for help use --help"
132 app =
GMApp(workspaceFile)
138 if __name__ ==
"__main__":