瀏覽代碼

wxGUI/mapdisp: using giface to initialize wxplot histogram (histogram works for d.mon); small improvements in histogram multiple raster handling

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54896 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 12 年之前
父節點
當前提交
3ea93a89b9
共有 3 個文件被更改,包括 14 次插入6 次删除
  1. 3 4
      gui/wxpython/mapdisp/frame.py
  2. 5 1
      gui/wxpython/wxplot/dialogs.py
  3. 6 1
      gui/wxpython/wxplot/histogram.py

+ 3 - 4
gui/wxpython/mapdisp/frame.py

@@ -1078,10 +1078,9 @@ class MapFrame(SingleMapFrame):
         """
         raster = []
 
-        for layer in self.tree.GetSelections():
-            if self.tree.GetLayerInfo(layer, key = 'maplayer').GetType() != 'raster':
-                continue
-            raster.append(self.tree.GetLayerInfo(layer, key = 'maplayer').GetName())
+        for layer in self._giface.GetLayerList().GetSelectedLayers():
+            if layer.maplayer.GetType() == 'raster':
+                raster.append(layer.maplayer.GetName())
 
         win = Histogram2Frame(parent = self, rasterList = raster)
         win.CentreOnParent()

+ 5 - 1
gui/wxpython/wxplot/dialogs.py

@@ -360,7 +360,11 @@ class HistRasterDialog(wx.Dialog):
         if self.groupRadio.GetValue() == True: 
             self.rselection.Disable()
         else:
-            if len(self.rasterList) > 0: self.rselection.SetValue(self.rasterList[0])
+            rastText = ''
+            for r in self.rasterList:
+                rastText += '%s,' % r
+            rastText = rastText.rstrip(',')
+            self.rselection.SetValue(rastText)
         box.Add(item = self.rselection, pos = (1, 1))       
 
         #

+ 6 - 1
gui/wxpython/wxplot/histogram.py

@@ -115,7 +115,12 @@ class Histogram2Frame(BasePlotFrame):
         if self.maptype == 'group':
             self.ptitle = _('Histogram of %s') % self.group.split('@')[0] 
         else: 
-            self.ptitle = _('Histogram of %s') % self.rasterList[0].split('@')[0] 
+            rastText = ''
+            for r in self.rasterList:
+                rs = r.split('@')[0]
+                rastText += '%s, ' % rs
+            rastText = rastText.rstrip(', ')
+            self.ptitle = _('Histogram of %s') % rastText
 
         
         #