[GRASS-SVN] r57698 - in grass/trunk/gui: images wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 15 18:13:00 PDT 2013


Author: annakrat
Date: 2013-09-15 18:13:00 -0700 (Sun, 15 Sep 2013)
New Revision: 57698

Added:
   grass/trunk/gui/images/arrow_ends.png
   grass/trunk/gui/images/both_ticks.png
   grass/trunk/gui/images/classic.png
   grass/trunk/gui/images/down_ticks.png
   grass/trunk/gui/images/full_checker.png
   grass/trunk/gui/images/hollow.png
   grass/trunk/gui/images/line.png
   grass/trunk/gui/images/mixed_checker.png
   grass/trunk/gui/images/part_checker.png
   grass/trunk/gui/images/solid.png
   grass/trunk/gui/images/tail_checker.png
   grass/trunk/gui/images/up_ticks.png
Modified:
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/gui_core/widgets.py
Log:
wxGUI: add barscale and arrow pictures to d.barscale gui (see #2077)

Added: grass/trunk/gui/images/arrow_ends.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/arrow_ends.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/both_ticks.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/both_ticks.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/classic.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/classic.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/down_ticks.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/down_ticks.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/full_checker.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/full_checker.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/hollow.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/hollow.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/line.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/line.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/mixed_checker.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/mixed_checker.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/part_checker.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/part_checker.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/solid.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/solid.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/tail_checker.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/tail_checker.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: grass/trunk/gui/images/up_ticks.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/images/up_ticks.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2013-09-15 21:29:02 UTC (rev 57697)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2013-09-16 01:13:00 UTC (rev 57698)
@@ -89,7 +89,8 @@
 from grass.script import core as grass
 from grass.script import task as gtask
 
-from gui_core.widgets import StaticWrapText, ScrolledPanel, ColorTablesComboBox
+from gui_core.widgets import StaticWrapText, ScrolledPanel, ColorTablesComboBox, \
+                             BarscalesComboBox, NArrowsComboBox
 from gui_core.ghelp   import HelpPanel
 from gui_core         import gselect
 from core             import gcmd
@@ -1062,6 +1063,15 @@
                                 cb = ColorTablesComboBox(parent=which_panel, value=p.get('default',''),
                                                          size=globalvar.DIALOG_COMBOBOX_SIZE,
                                                          choices=valuelist)
+                            elif self.task.name == 'd.barscale':
+                                if p['name'] == 'style':
+                                    cb = BarscalesComboBox(parent=which_panel, value=p.get('default',''),
+                                                           size=globalvar.DIALOG_COMBOBOX_SIZE,
+                                                           choices=valuelist)
+                                elif p['name'] == 'north_arrow':
+                                    cb = NArrowsComboBox(parent=which_panel, value=p.get('default',''),
+                                                         size=globalvar.DIALOG_COMBOBOX_SIZE,
+                                                         choices=valuelist)
                             else:
                                 cb = wx.ComboBox(parent=which_panel, id=wx.ID_ANY, value=p.get('default',''),
                                                  size=globalvar.DIALOG_COMBOBOX_SIZE,

Modified: grass/trunk/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/widgets.py	2013-09-15 21:29:02 UTC (rev 57697)
+++ grass/trunk/gui/wxpython/gui_core/widgets.py	2013-09-16 01:13:00 UTC (rev 57698)
@@ -16,8 +16,12 @@
  - widgets::GListCtrl
  - widgets::SearchModuleWidget
  - widgets::ManageSettingsWidget
+ - widgets::PictureComboBox
+ - widgets::ColorTablesComboBox
+ - widgets::BarscalesComboBox
+ - widgets::NArrowsComboBox
 
-(C) 2008-2012 by the GRASS Development Team
+(C) 2008-2013 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.
@@ -1187,10 +1191,10 @@
         
         return data
 
-class ColorTablesComboBox(wx.combo.OwnerDrawnComboBox):
-    """!ComboBox with drawn color tables (created by thumbnails.py).
-
-    Used in r(3).colors dialog.
+class PictureComboBox(wx.combo.OwnerDrawnComboBox):
+    """!Abstract class of ComboBox with pictures.
+    
+        Derived class has to specify has to specify _getPath method.
     """
     def OnDrawItem(self, dc, rect, item, flags):
         """!Overridden from OwnerDrawnComboBox.
@@ -1205,7 +1209,7 @@
         r.Deflate(3, 5)
 
         # for painting the items in the popup
-        bitmap = self.GetColorTableBitmap(self.GetString(item))
+        bitmap = self.GetPictureBitmap(self.GetString(item))
         if bitmap:
             dc.DrawBitmap(bitmap, r.x, r.y + (r.height - bitmap.GetHeight()) / 2)
         dc.DrawText(self.GetString(item),
@@ -1219,20 +1223,43 @@
         """
         return 24
 
-    def GetColorTableBitmap(self, colorTable):
-        """!Returns bitmap with colortable for given nacolor table name.
+    def GetPictureBitmap(self, name):
+        """!Returns bitmap for given picture name.
         
         @param colorTable name of color table        
         """
         if not hasattr(self, 'bitmaps'):
             self.bitmaps = {}
 
-        if colorTable in self.bitmaps:
-            return self.bitmaps[colorTable]
+        if name in self.bitmaps:
+            return self.bitmaps[name]
 
-        path = os.path.join(os.getenv("GISBASE"), "docs", "html", "Colortable_%s.png" % colorTable)
+        path = self._getPath(name)
         if os.path.exists(path):
             bitmap = wx.Bitmap(path)
-            self.bitmaps[colorTable] = bitmap
+            self.bitmaps[name] = bitmap
             return bitmap
         return None
+
+
+class ColorTablesComboBox(PictureComboBox):
+    """!ComboBox with drawn color tables (created by thumbnails.py).
+
+    Used in r(3).colors dialog."""
+    def _getPath(self, name):
+        return os.path.join(os.getenv("GISBASE"), "docs", "html", "Colortable_%s.png" % name)
+
+
+class BarscalesComboBox(PictureComboBox):
+    """!ComboBox with barscales for d.barscale."""
+    def _getPath(self, name):
+        return os.path.join(os.getenv("GISBASE"), "etc", "gui", "images", name + '.png')
+
+
+class NArrowsComboBox(PictureComboBox):
+    """!ComboBox with north arrows for d.barscale."""
+    def _getPath(self, name):
+        return os.path.join(os.getenv("GISBASE"), "etc", "gui", "images",
+                                      'symbols', 'n_arrows', 'n_arrow{name}.png'.format(name=name))
+    def OnMeasureItem(self, item):
+        return 32



More information about the grass-commit mailing list