[GRASS-SVN] r64527 - grass/trunk/gui/wxpython
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Feb 9 06:43:59 PST 2015
Author: martinl
Date: 2015-02-09 06:43:59 -0800 (Mon, 09 Feb 2015)
New Revision: 64527
Modified:
grass/trunk/gui/wxpython/wxgui.py
Log:
wxgui.py: go back to old version of splash screen (r64455)
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2015-02-09 12:44:14 UTC (rev 64526)
+++ grass/trunk/gui/wxpython/wxgui.py 2015-02-09 14:43:59 UTC (rev 64527)
@@ -5,9 +5,9 @@
Classes:
- wxgui::GMApp
- - wxgui::GSplashScreen
+ - wxgui::Usage
-(C) 2006-2015 by the GRASS Development Team
+(C) 2006-2011 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
@@ -21,19 +21,22 @@
import os
import sys
import getopt
-import time
from core import globalvar
from core.utils import _
-from core.debug import Debug
from grass.exceptions import Usage
from grass.script.core import set_raise_on_error
import wx
+try:
+ import wx.lib.agw.advancedsplash as SC
+except ImportError:
+ SC = None
from lmgr.frame import GMFrame
+
class GMApp(wx.App):
def __init__(self, workspace = None):
""" Main GUI class.
@@ -55,38 +58,36 @@
if not globalvar.CheckWxVersion([2, 9]):
wx.InitAllImageHandlers()
- splash = GSplashScreen(app=self, workspace=self.workspaceFile)
- splash.Show()
-
- return True
+ # create splash screen
+ introImagePath = os.path.join(globalvar.IMGDIR, "splash_screen.png")
+ introImage = wx.Image(introImagePath, wx.BITMAP_TYPE_PNG)
+ introBmp = introImage.ConvertToBitmap()
+ if SC and sys.platform != 'darwin':
+ # AdvancedSplash is buggy on the Mac as of 2.8.12.1
+ # and raises annoying (though seemingly harmless) errors everytime the GUI is started
+ splash = SC.AdvancedSplash(bitmap = introBmp,
+ timeout = 2000, parent = None, id = wx.ID_ANY)
+ splash.SetText(_('Starting GRASS GUI...'))
+ splash.SetTextColour(wx.Colour(45, 52, 27))
+ splash.SetTextFont(wx.Font(pointSize = 15, family = wx.DEFAULT, style = wx.NORMAL,
+ weight = wx.BOLD))
+ splash.SetTextPosition((150, 430))
+ else:
+ wx.SplashScreen (bitmap = introBmp, splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
+ milliseconds = 2000, parent = None, id = wx.ID_ANY)
-class GSplashScreen(wx.SplashScreen):
- """Create a splash screen widget
- """
- def __init__(self, parent=None, app=None, workspace=None):
- self.workspaceFile = workspace
- self.parent = parent
- self.app = app
-
- bitmap = wx.Image(name=os.path.join(globalvar.IMGDIR, "splash_screen.png")).ConvertToBitmap()
- wx.SplashScreen.__init__(self, bitmap=bitmap,
- splashStyle=wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
- milliseconds=1000, parent=parent)
- self.Bind(wx.EVT_CLOSE, self.OnExit)
-
wx.Yield()
- def OnExit(self, event):
# create and show main frame
- frame = GMFrame(parent = None, id = wx.ID_ANY,
- workspace = self.workspaceFile)
- self.app.SetTopWindow(frame)
-
- self.Hide()
- frame.Show()
-
- event.Skip() # make sure the default handler runs too
+ mainframe = GMFrame(parent = None, id = wx.ID_ANY,
+ workspace = self.workspaceFile)
+ mainframe.Show()
+ self.SetTopWindow(mainframe)
+
+ return True
+
+
def printHelp():
""" Print program help"""
print >> sys.stderr, "Usage:"
@@ -113,6 +114,7 @@
def main(argv = None):
+
if argv is None:
argv = sys.argv
try:
@@ -128,16 +130,12 @@
printHelp()
workspaceFile = process_opt(opts, args)[0]
-
- start = time.time()
-
+
app = GMApp(workspaceFile)
# suppress wxPython logs
q = wx.LogNull()
set_raise_on_error(True)
- Debug.msg(1, "wxGUI started in %.6f sec" % (time.time() - start))
-
app.MainLoop()
if __name__ == "__main__":
More information about the grass-commit
mailing list