[GRASS-SVN] r52611 - in grass/trunk/gui/wxpython: . swipe

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 9 04:55:52 PDT 2012


Author: annakrat
Date: 2012-08-09 04:55:52 -0700 (Thu, 09 Aug 2012)
New Revision: 52611

Modified:
   grass/trunk/gui/wxpython/swipe/dialogs.py
   grass/trunk/gui/wxpython/swipe/frame.py
   grass/trunk/gui/wxpython/swipe/toolbars.py
   grass/trunk/gui/wxpython/wxpythonlib.dox
Log:
wxGUI/swipe: added quit button and other cosmetics

Modified: grass/trunk/gui/wxpython/swipe/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/swipe/dialogs.py	2012-08-09 11:54:31 UTC (rev 52610)
+++ grass/trunk/gui/wxpython/swipe/dialogs.py	2012-08-09 11:55:52 UTC (rev 52611)
@@ -23,7 +23,7 @@
 class SwipeMapDialog(ElementDialog):
     """!Dialog used to select raster maps"""
     def __init__(self, parent, title = _("Select raster maps"), id =  wx.ID_ANY, first = None, second = None):
-        ElementDialog.__init__(self, parent, title, label = _("Name of first raster map:"))
+        ElementDialog.__init__(self, parent, title, label = _("Name of top/left raster map:"))
 
         self.element = gselect.Select(parent = self.panel, type = 'raster',
                                       size = globalvar.DIALOG_GSELECT_SIZE)
@@ -47,7 +47,7 @@
                            flag = wx.EXPAND | wx.ALL, border = 1)
  
         self.dataSizer.Add(wx.StaticText(parent = self.panel, id = wx.ID_ANY,
-                                         label = _("Name of second raster map:")), proportion = 0,
+                                         label = _("Name of bottom/right raster map:")), proportion = 0,
                            flag = wx.EXPAND | wx.ALL, border = 1)
 
         self.dataSizer.Add(self.element2, proportion = 0,

Modified: grass/trunk/gui/wxpython/swipe/frame.py
===================================================================
--- grass/trunk/gui/wxpython/swipe/frame.py	2012-08-09 11:54:31 UTC (rev 52610)
+++ grass/trunk/gui/wxpython/swipe/frame.py	2012-08-09 11:55:52 UTC (rev 52611)
@@ -13,7 +13,7 @@
 from core.debug         import Debug
 from mapdisp.statusbar  import EVT_AUTO_RENDER
 
-from swipe.toolbars  import SwipeMapToolbar, SwipeMainToolbar
+from swipe.toolbars  import SwipeMapToolbar, SwipeMainToolbar, SwipeMiscToolbar
 from swipe.mapwindow import SwipeBufferedWindow, EVT_MOTION
 from swipe.dialogs   import SwipeMapDialog
 
@@ -26,7 +26,7 @@
         #
         # Add toolbars
         #
-        toolbars = ['swipeMap', 'swipeMain']
+        toolbars = ['swipeMisc', 'swipeMap', 'swipeMain']
         if sys.platform == 'win32':
             self.AddToolbar(toolbars.pop(1))
             toolbars.reverse()
@@ -211,6 +211,18 @@
                       CloseButton(False).Layer(2).Row(1).
                       BestSize((self.toolbars[name].GetBestSize())))
 
+        if name == "swipeMisc":
+            self.toolbars[name] = SwipeMiscToolbar(self)
+
+            self._mgr.AddPane(self.toolbars[name],
+                      wx.aui.AuiPaneInfo().
+                      Name(name).Caption(_("Misc Toolbar")).
+                      ToolbarPane().Top().
+                      LeftDockable(False).RightDockable(False).
+                      BottomDockable(False).TopDockable(True).
+                      CloseButton(False).Layer(2).Row(1).
+                      BestSize((self.toolbars[name].GetBestSize())))
+
     def _addPanes(self):
         """!Add splitter window and sliders to aui manager"""
         # splitter window
@@ -347,7 +359,10 @@
 
         return True
 
+    def OnCloseWindow(self, event):
+        self.Destroy()
 
+
 class MapSplitter(wx.SplitterWindow):
     """!Splitter window for displaying two maps"""
     def __init__(self, parent, id):

Modified: grass/trunk/gui/wxpython/swipe/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/swipe/toolbars.py	2012-08-09 11:54:31 UTC (rev 52610)
+++ grass/trunk/gui/wxpython/swipe/toolbars.py	2012-08-09 11:55:52 UTC (rev 52611)
@@ -4,8 +4,9 @@
 @brief Map Swipe toolbars and icons.
 
 Classes:
- - toolbars::swipeMapToolbar
- - toolbars::swipeMainToolbar
+ - toolbars::SwipeMapToolbar
+ - toolbars::SwipeMainToolbar
+ - toolbars::SwipeMiscToolbar
 
 (C) 2006-2012 by the GRASS Development Team
 This program is free software under the GNU General Public
@@ -21,7 +22,9 @@
 from icons.icon import MetaIcon
 
 swipeIcons = {
-        'tools': MetaIcon(img = 'tools', label = _('Tools')),
+        'tools': MetaIcon(img = 'tools', label = _("Tools")),
+        'quit' : BaseIcons['quit'].SetLabel(_("Quit Map Swipe")),
+        'addRast' : BaseIcons['addRast'].SetLabel(_("Select raster maps")),
         }
 
 class SwipeMapToolbar(BaseToolbar):
@@ -93,7 +96,7 @@
     def _toolbarData(self):
         """!Toolbar data"""
         icons = swipeIcons
-        return self._getToolbarData((("addRaster", BaseIcons['addRast'],
+        return self._getToolbarData((("addRaster", swipeIcons['addRast'],
                                       self.parent.OnSelectRasters),
                                      (None, ),
                                      ("tools", swipeIcons['tools'],
@@ -121,3 +124,23 @@
         # will be called before PopupMenu returns.
         self.parent.GetWindow().PopupMenu(toolMenu)
         toolMenu.Destroy()
+
+
+class SwipeMiscToolbar(BaseToolbar):
+    """!Toolbar with miscellaneous tools related to app
+    """
+    def __init__(self, parent):
+        """!Toolbar constructor
+        """
+        BaseToolbar.__init__(self, parent)
+        
+        self.InitToolbar(self._toolbarData())
+        # realize the toolbar
+        self.Realize()
+        
+    def _toolbarData(self):
+        """!Toolbar data"""
+        icons = BaseIcons
+        return self._getToolbarData((("quit", swipeIcons['quit'],
+                                      self.parent.OnCloseWindow),
+                                     ))

Modified: grass/trunk/gui/wxpython/wxpythonlib.dox
===================================================================
--- grass/trunk/gui/wxpython/wxpythonlib.dox	2012-08-09 11:54:31 UTC (rev 52610)
+++ grass/trunk/gui/wxpython/wxpythonlib.dox	2012-08-09 11:55:52 UTC (rev 52611)
@@ -491,6 +491,7 @@
 - swipe::toolbars
  - toolbars::SwipeMapToolbar
  - toolbars::SwipeMainToolbar
+ - toolbars::SwipeMiscToolbar
 
 \subsection other Other GUI modules
 



More information about the grass-commit mailing list