瀏覽代碼

wxGUI: "Set color table" added to layer contextual menu
(merge from devbr6, https://trac.osgeo.org/grass/changeset/34156)


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

Martin Landa 16 年之前
父節點
當前提交
c687db22cf
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      gui/wxpython/gui_modules/wxgui_utils.py

+ 10 - 0
gui/wxpython/gui_modules/wxgui_utils.py

@@ -245,6 +245,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             self.popupID12 = wx.NewId()
             self.popupID13 = wx.NewId()
             self.popupID14 = wx.NewId()
+            self.popupID15 = wx.NewId()
 
         self.popupMenu = wx.Menu()
         # general item
@@ -335,6 +336,8 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             self.popupMenu.Append(self.popupID13, text=_("Set computational region from selected map (ignore NULLs)"))
             self.Bind(wx.EVT_MENU, self.OnSetCompRegFromRaster, id=self.popupID13)
             self.popupMenu.AppendSeparator()
+            self.popupMenu.Append(self.popupID15, _("Set color table"))
+            self.Bind (wx.EVT_MENU, self.OnColorTable, id=self.popupID15)
             self.popupMenu.Append(self.popupID4, _("Histogram"))
             self.Bind (wx.EVT_MENU, self.OnHistogram, id=self.popupID4)
             self.popupMenu.Append(self.popupID5, _("Profile"))
@@ -419,6 +422,13 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             # show new display
             self.profileFrame.Show()
         
+    def OnColorTable(self, event):
+        """Set color table for raster map"""
+        name = self.GetPyData(self.layer_selected)[0]['maplayer'].name
+        menuform.GUI().ParseCommand(['r.colors',
+                                     'map=%s' % name],
+                                    parentframe=self)
+        
     def OnHistogram(self, event):
         """
         Plot histogram for given raster map layer