فهرست منبع

wxGUI: add new modeler icons (thanks to Robert Szczepanek)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@43052 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 سال پیش
والد
کامیت
4cf4c5a307

BIN
gui/icons/grass2/modeler-main.png


BIN
gui/icons/grass2/modeler-variables.png


+ 4 - 0
gui/wxpython/gui_modules/gmodeler.py

@@ -615,6 +615,10 @@ class ModelFrame(wx.Frame):
         else:
             self.SetTitle(self.baseTitle)
         
+    def OnVariables(self, event):
+        """!Switch to variables page"""
+        self.notebook.SetSelection(2)
+        
     def OnRemoveItem(self, event):
         """!Remove shape
         """

+ 8 - 2
gui/wxpython/gui_modules/toolbars.py

@@ -81,7 +81,6 @@ class AbstractToolbar(wx.ToolBar):
         if label:
             Debug.msg(3, "CreateTool(): tool=%d, label=%s bitmap=%s" % \
                   (tool, label, bitmap))
-            
             toolWin = self.AddLabelTool(tool, label, bitmap,
                                         bmpDisabled, kind,
                                         shortHelp, longHelp)
@@ -1632,6 +1631,9 @@ class ModelToolbar(AbstractToolbar):
              wx.ITEM_NORMAL, Icons['modelRun'].GetLabel(), Icons['modelRun'].GetDesc(),
              self.parent.OnRunModel),
             ('', '', '', '', '', '', ''),
+            (self.variables, "variables", Icons["modelVariables"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["modelVariables"].GetLabel(), Icons["modelVariables"].GetDesc(),
+             self.parent.OnVariables),
             (self.settings, "settings", Icons["modelSettings"].GetBitmap(),
              wx.ITEM_NORMAL, Icons["modelSettings"].GetLabel(), Icons["modelSettings"].GetDesc(),
              self.parent.OnPreferences),
@@ -1698,7 +1700,7 @@ class LayerManagerToolbar(AbstractToolbar):
         
         # realize the toolbar
         self.Realize()
-        
+
     def ToolbarData(self):
         """!Toolbar data"""
         self.newdisplay = wx.NewId()
@@ -1716,6 +1718,7 @@ class LayerManagerToolbar(AbstractToolbar):
         self.delcmd = wx.NewId()
         self.attribute = wx.NewId()
         self.preferences = wx.NewId()
+        self.modeler = wx.NewId() 
         
         # tool, label, bitmap, kind, shortHelp, longHelp, handler
         return (
@@ -1765,6 +1768,9 @@ class LayerManagerToolbar(AbstractToolbar):
              wx.ITEM_NORMAL, Icons["attrtable"].GetLabel(), Icons["attrtable"].GetDesc(),
              self.parent.OnShowAttributeTable),
             ('', '', '', '', '', '', ''),
+            (self.modeler, 'modeler', Icons["modeler"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["modeler"].GetLabel(), Icons["modeler"].GetDesc(),
+             self.parent.OnGModeler),
             (self.preferences, 'preferences', Icons["settings"].GetBitmap(),
              wx.ITEM_NORMAL, Icons["settings"].GetLabel(), Icons["settings"].GetDesc(),
              self.parent.OnPreferences)

+ 2 - 0
gui/wxpython/icons/grass2_icons.py

@@ -86,6 +86,7 @@ IconsGrass2 = {
     "addthematic": 'layer-vector-thematic-add.png',
     "addchart"   : 'layer-vector-chart-add.png',
     "layeropts"  : 'options.png',
+    "modeler"    : 'modeler-main.png',
     # profile analysis
     "transect"     : 'layer-raster-profile.png',
     "profiledraw"  : 'show.png',
@@ -107,6 +108,7 @@ IconsGrass2 = {
     "imageSave"      : 'image-export.png',
     "pythonSave"     : 'python-export.png',
     "modelProperties" : 'options.png',
+    "modelVariables" : 'modeler-variables.png',
     # various
     "settings"       : 'settings.png',
     'redraw'         : 'redraw.png',

+ 2 - 0
gui/wxpython/icons/grass_icons.py

@@ -79,6 +79,7 @@ IconsGrass = {
     "addbarscale": 'module-d.barscale.gif',
     "addlegend"  : 'module-d.legend.gif',
     "quit"       : 'gui-exit.gif',
+    "modeler"    : wx.ART_ERROR,
     # analyze raster
     "analyze"    : 'gui-rastanalyze.gif',
     "measure"    : 'gui-measure.gif',
@@ -109,6 +110,7 @@ IconsGrass = {
     "imageSave"      : wx.ART_ERROR,
     "pythonSave"     : wx.ART_ERROR,
     "modelProperties" : wx.ART_ERROR,
+    "modelVariables" : wx.ART_ERROR,
     # various
     "settings"       : 'edit-color.gif',
     "redraw"         : 'gui-display.gif',

+ 18 - 17
gui/wxpython/icons/icon.py

@@ -81,10 +81,9 @@ except:
     sys.exit(1)
 
 class MetaIcon:
+    """!Handle icon metadata (image path, tooltip, ...)
     """
-    Handle icon metadata (image path, tooltip, ...)
-    """
-    def __init__(self, img, label, desc=None):
+    def __init__(self, img, label, desc = None):
         self.imagepath = img
         if not self.imagepath:
             self.type = 'unknown'
@@ -93,41 +92,41 @@ class MetaIcon:
                 self.type = 'wx'
             else:
                 self.type = 'img'
-
+        
         self.label = label
-
+        
         if desc:
             self.description = desc
         else:
             self.description = ''
-
+        
     def __str__(self):
         """!Debugging"""
         return "label=%s, img=%s, type=%s" % (self.label, self.imagepath, self.type)
 
-    def GetBitmap(self, size=None):
+    def GetBitmap(self, size = None):
         """!Get bitmap"""
         bmp = None
-
+        
         if self.type == 'wx':
-            bmp = wx.ArtProvider.GetBitmap(id=self.imagepath, client=wx.ART_TOOLBAR, size=size)
+            bmp = wx.ArtProvider.GetBitmap(id = self.imagepath, client = wx.ART_TOOLBAR, size = size)
         elif self.type == 'img':
             if os.path.isfile(self.imagepath) and os.path.getsize(self.imagepath):
                 if size and len(size) == 2:
-                    image = wx.Image (name=self.imagepath)
-                    image.Rescale (size[0], size[1])
+                    image = wx.Image(name = self.imagepath)
+                    image.Rescale(size[0], size[1])
                     bmp = image.ConvertToBitmap()
                 elif self.imagepath:
-                    bmp = wx.Bitmap (name=self.imagepath)
-
+                    bmp = wx.Bitmap(name = self.imagepath)
+        
         return bmp
-
+    
     def GetLabel(self):
         return self.label
-
+    
     def GetDesc(self):
         return self.description
-
+    
     def GetImageName(self):
         return os.path.basename(self.imagepath)
 
@@ -343,6 +342,8 @@ Icons = {
                           label=_("Quit 3D view mode"),
                           desc=_("Switch back to 2D view mode")),
     # modeler
+    "modeler" : MetaIcon (img=Icons["modeler"],
+                          label=_("Start Graphical Modeler")),
     "modelNew" : MetaIcon (img=Icons["fileNew"],
                            label=_("Create new model (Ctrl+N)")),
     "modelOpen" : MetaIcon (img=Icons["fileOpen"],
@@ -367,7 +368,7 @@ Icons = {
                                 label=_("Show modeler settings")),
     "modelProperties" : MetaIcon (img=Icons["modelProperties"],
                                   label=_("Show model properties")),
-    "modelVariables" : MetaIcon (img=Icons["modelProperties"],
+    "modelVariables" : MetaIcon (img=Icons["modelVariables"],
                                  label=_("Manage model variables")),
     "modelRedraw" : MetaIcon (img=Icons["redraw"],
                               label=_("Redraw model canvas")),

+ 2 - 0
gui/wxpython/icons/silk_icons.py

@@ -89,6 +89,7 @@ IconsSilk = {
     "addthematic": 'thematic.png',
     "addchart"   : 'chart_bar.png',
     "layeropts"  : 'map_edit.png',
+    "modeler"    : wx.ART_ERROR,
     # profile analysis
     "transect"   : 'image_edit.png',
     "profiledraw"  : 'arrow_refresh.png',
@@ -111,6 +112,7 @@ IconsSilk = {
     "imageSave"      : wx.ART_ERROR,
     "pythonSave"     : wx.ART_ERROR,
     "modelProperties" : wx.ART_ERROR,
+    "modelVariables" : wx.ART_ERROR,
     # various
     "settings"     : 'color_swatch.png',
     "redraw"       : 'arrow_refresh.png',

+ 1 - 1
gui/wxpython/wxgui.py

@@ -100,7 +100,7 @@ class GMFrame(wx.Frame):
     """
     def __init__(self, parent, id = wx.ID_ANY, title = _("GRASS GIS Layer Manager"),
                  workspace = None,
-                 size = (575, 450), style = wx.DEFAULT_FRAME_STYLE, **kwargs):
+                 size = (600, 450), style = wx.DEFAULT_FRAME_STYLE, **kwargs):
         self.parent    = parent
         self.baseTitle = title
         self.iconsize  = (16, 16)