Browse Source

wxGUI: improve splash screen
clean up images


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45587 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 14 năm trước cách đây
mục cha
commit
27f6def49a

+ 8 - 5
gui/images/Makefile

@@ -1,12 +1,15 @@
 MODULE_TOPDIR = ../..
 
-include $(MODULE_TOPDIR)/include/Make/Dir.make
+include $(MODULE_TOPDIR)/include/Make/Other.make
 
-default:
-	$(MAKE) $(ETC)/gui/images/startup_banner.png
+ETCDIR = $(ETC)/gui/images
 
-$(ETC)/gui/images/%: % | $(ETC)/gui/images
+FILES := $(wildcard *.png)
+
+default: $(patsubst %,$(ETCDIR)/%,$(FILES))
+
+$(ETCDIR)/%.png: %.png | $(ETCDIR)
 	$(INSTALL_DATA) $< $@
 
-$(ETC)/gui/images:
+$(ETCDIR):
 	$(MKDIR) $@

gui/wxpython/images/__init__.py → gui/images/__init__.py


gui/wxpython/images/grass_form.png → gui/images/grass_form.png


BIN
gui/images/grass_splash.png


BIN
gui/wxpython/images/grass_splash.xcf


gui/wxpython/images/loc_wizard.png → gui/images/loc_wizard.png


gui/wxpython/images/loc_wizard_qgis.png → gui/images/loc_wizard_qgis.png


gui/wxpython/images/qgis_world.png → gui/images/qgis_world.png


BIN
gui/images/silesia_splash.png


gui/wxpython/images/small_down_arrow.png → gui/images/small_down_arrow.png


gui/wxpython/images/small_up_arrow.png → gui/images/small_up_arrow.png


+ 2 - 2
gui/wxpython/Makefile

@@ -9,10 +9,10 @@ include $(MODULE_TOPDIR)/include/Make/Python.make
 
 ETCDIR = $(ETC)/gui/wxpython
 
-SRCFILES := $(wildcard scripts/* compat/* gui_modules/* icons/*.* images/* xml/*) gis_set.py gis_set_error.py wxgui.py README
+SRCFILES := $(wildcard scripts/* compat/* gui_modules/* icons/*.* xml/*) gis_set.py gis_set_error.py wxgui.py README
 DSTFILES := $(patsubst %,$(ETCDIR)/%,$(SRCFILES)) $(patsubst %.py,$(ETCDIR)/%.pyc,$(filter %.py,$(SRCFILES)))
 
-DSTDIRS := $(patsubst %,$(ETCDIR)/%,compat gui_modules icons images scripts xml)
+DSTDIRS := $(patsubst %,$(ETCDIR)/%,compat gui_modules icons scripts xml)
 
 default: $(DSTFILES) menustrings.py
 	$(MAKE) parsubdirs

+ 3 - 6
gui/wxpython/gui_modules/gcpmanager.py

@@ -59,10 +59,7 @@ except:
     sys.path.append(CompatPath)
     from compat import subprocess
 
-gmpath = os.path.join(globalvar.ETCWXDIR, "icons")
-sys.path.append(gmpath)
-
-imgpath = os.path.join(globalvar.ETCWXDIR, "images")
+sys.path.append(os.path.join(globalvar.ETCWXDIR, "icons"))
 
 #
 # global variables
@@ -76,7 +73,7 @@ tgt_map = ''
 maptype = 'cell'
 
 def getSmallUpArrowImage():
-    stream = open(os.path.join(imgpath, 'small_up_arrow.png'), 'rb')
+    stream = open(os.path.join(globalvar.ETCIMGDIR, 'small_up_arrow.png'), 'rb')
     try:
         img = wx.ImageFromStream(stream)
     finally:
@@ -84,7 +81,7 @@ def getSmallUpArrowImage():
     return img
 
 def getSmallDnArrowImage():
-    stream = open(os.path.join(imgpath, 'small_down_arrow.png'), 'rb')
+    stream = open(os.path.join(globalvar.ETCIMGDIR, 'small_down_arrow.png'), 'rb')
     try:
         img = wx.ImageFromStream(stream)
     finally:

+ 0 - 7
gui/wxpython/gui_modules/gcpmapdisp.py

@@ -63,13 +63,6 @@ from preferences import globalSettings as UserSettings
 from mapdisp_command import Command
 from mapdisp_window import BufferedWindow
 
-import images
-imagepath = images.__path__[0]
-sys.path.append(imagepath)
-
-###
-### global variables
-###
 # for standalone app
 cmdfilename = None
 

+ 1 - 0
gui/wxpython/gui_modules/globalvar.py

@@ -28,6 +28,7 @@ gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unico
 ETCDIR = os.path.join(os.getenv("GISBASE"), "etc")
 ETCICONDIR = os.path.join(os.getenv("GISBASE"), "etc", "gui", "icons")
 ETCWXDIR = os.path.join(ETCDIR, "gui", "wxpython")
+ETCIMGDIR = os.path.join(ETCDIR, "gui", "images")
 
 sys.path.append(os.path.join(ETCDIR, "python"))
 import grass.script as grass

+ 3 - 3
gui/wxpython/gui_modules/location_wizard.py

@@ -1729,7 +1729,7 @@ class LocationWizard(wx.Object):
         #
         # define wizard image
         #
-        imagePath = os.path.join(globalvar.ETCWXDIR, "images", "loc_wizard_qgis.png")
+        imagePath = os.path.join(globalvar.ETCIMGDIR, "loc_wizard_qgis.png")
         wizbmp = wx.Image(imagePath, wx.BITMAP_TYPE_PNG)
         wizbmp = wizbmp.ConvertToBitmap()
         
@@ -2143,8 +2143,8 @@ class RegionDef(BaseClass, wx.Frame):
         #
         # image
         #
-        self.img = wx.Image(os.path.join(globalvar.ETCWXDIR, "images",
-                                         "qgis_world.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
+        self.img = wx.Image(os.path.join(globalvar.ETCIMGDIR, "qgis_world.png"),
+                            wx.BITMAP_TYPE_PNG).ConvertToBitmap()
         
         #
         # set current working environment to PERMANENT mapset

+ 0 - 7
gui/wxpython/gui_modules/mapdisp.py

@@ -71,13 +71,6 @@ from preferences import globalSettings as UserSettings
 from mapdisp_command import Command
 from mapdisp_window import BufferedWindow
 
-import images
-imagepath = images.__path__[0]
-sys.path.append(imagepath)
-
-###
-### global variables
-###
 # for standalone app
 cmdfilename = None
 

+ 2 - 4
gui/wxpython/gui_modules/menuform.py

@@ -96,8 +96,6 @@ else:
     wxbase = os.path.join(globalvar.ETCWXDIR)
 
 sys.path.append(wxbase)
-imagepath = os.path.join(wxbase, "images")
-sys.path.append(imagepath)
 
 from grass.script import core as grass
 
@@ -772,8 +770,8 @@ class mainFrame(wx.Frame):
         
         # GRASS logo
         self.logo = wx.StaticBitmap(parent = self.panel,
-                                    bitmap = wx.Bitmap(name = os.path.join(imagepath,
-                                                                       'grass_form.png'),
+                                    bitmap = wx.Bitmap(name = os.path.join(globalvar.ETCIMGDIR,
+                                                                           'grass_form.png'),
                                                      type = wx.BITMAP_TYPE_PNG))
         topsizer.Add(item = self.logo, proportion = 0, border = 3,
                      flag = wx.ALL | wx.ALIGN_CENTER_VERTICAL)

BIN
gui/wxpython/images/grass_splash.png


+ 2 - 2
gui/wxpython/scripts/r.li.setup.py

@@ -119,7 +119,7 @@ class LocationWizard(wx.Object):
         #
         # file = "loc_wizard.png"
         file = "loc_wizard_qgis.png"
-        imagePath = os.path.join(globalvar.ETCWXDIR, "images", file)
+        imagePath = os.path.join(globalvar.ETCIMGDIR, file)
         wizbmp = wx.Image(imagePath, wx.BITMAP_TYPE_PNG)
         # wizbmp.Rescale(250,600)
         wizbmp = wizbmp.ConvertToBitmap()
@@ -728,4 +728,4 @@ if __name__ == "__main__":
     app = wx.App()
     gWizard = LocationWizard(None)
 #    gWizard.Show()
-    app.MainLoop()
+    app.MainLoop()

+ 19 - 3
gui/wxpython/wxgui.py

@@ -57,6 +57,11 @@ except ImportError:
     import wx.lib.customtreectrl as CT
     import wx.lib.flatnotebook   as FN
 
+try:
+    import wx.lib.agw.advancedsplash as SC
+except ImportError:
+    SC = None
+
 sys.path.append(os.path.join(globalvar.ETCDIR, "python"))
 from grass.script import core as grass
 
@@ -1474,11 +1479,22 @@ class GMApp(wx.App):
         wx.InitAllImageHandlers()
 
         # create splash screen
-        introImagePath = os.path.join(globalvar.ETCWXDIR, "images", "grass_splash.png")
+        introImagePath = os.path.join(globalvar.ETCIMGDIR, "grass_splash.png")
         introImage     = wx.Image(introImagePath, wx.BITMAP_TYPE_PNG)
         introBmp       = introImage.ConvertToBitmap()
-        wx.SplashScreen (bitmap = introBmp, splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
-                         milliseconds = 2000, parent = None, id = wx.ID_ANY)
+        if SC:
+            splash = SC.AdvancedSplash(bitmap = introBmp, 
+                                       extrastyle = SC.AS_TIMEOUT | SC.AS_CENTER_ON_SCREEN,
+                                       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)
+        
         wx.Yield()
         
         w, h = wx.GetDisplaySize()