[GRASS-SVN] r39298 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 26 18:16:56 EDT 2009


Author: cmbarton
Date: 2009-09-26 18:16:56 -0400 (Sat, 26 Sep 2009)
New Revision: 39298

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py
Log:
Second batch of fixes to profile module settings bugs. Backported from develbranch_6 r39294.

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py	2009-09-26 22:15:37 UTC (rev 39297)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py	2009-09-26 22:16:56 UTC (rev 39298)
@@ -134,6 +134,9 @@
             # first (default) profile line
             self.raster[idx]['pline'] = None
             self.raster[idx]['prop'] = UserSettings.Get(group='profile', key='raster' + str(idx))
+            # changing color string to tuple
+            colstr = str(self.raster[idx]['prop']['pcolor'])
+            self.raster[idx]['prop']['pcolor'] = tuple(int(colval) for colval in colstr.strip('()').split(','))
 
         # set raster map name (if given)
         for idx in range(len(rasterList)):
@@ -170,8 +173,15 @@
                                                     wx.FONTWEIGHT_NORMAL)
         
         self.properties['marker'] = UserSettings.Get(group='profile', key='marker')
+        # changing color string to tuple
+        colstr = str(self.properties['marker']['color'])
+        self.properties['marker']['color'] = tuple(int(colval) for colval in colstr.strip('()').split(','))
 
         self.properties['grid'] = UserSettings.Get(group='profile', key='grid')
+        # changing color string to tuple
+        colstr = str(self.properties['grid']['color'])
+        self.properties['grid']['color'] = tuple(int(colval) for colval in colstr.strip('()').split(','))
+                
         self.properties['x-axis'] = {}
         
         self.properties['x-axis']['prop'] = UserSettings.Get(group='profile', key='x-axis')
@@ -419,12 +429,12 @@
         region = grass.region()
         curr_res = min(float(region['nsres']),float(region['ewres']))
         transect_rec = 0
-        print "transect length=",self.transect_length
-        print "current res=",curr_res
+        print "transect length = "+str(self.transect_length)
+        print "current resolution = "+str(curr_res)
         if self.transect_length / curr_res > 500:
             transect_res = self.transect_length / 500
         else: transect_res = curr_res
-        print "transect res=",transect_res
+        print "transect resolution = "+str(transect_res)
                 
         try:
             p = grass.read_command("r.profile",
@@ -482,6 +492,18 @@
 
         # graph the distance, value pairs for the transect
         self.plotlist = []
+        if len(self.seglist) > 0 :
+            self.ppoints = plot.PolyMarker(self.seglist,
+                                           legend=' ' + self.properties['marker']['legend'],
+                                           colour=wx.Color(self.properties['marker']['color'][0],
+                                                           self.properties['marker']['color'][1],
+                                                           self.properties['marker']['color'][2],
+                                                           255),
+                                           size=self.properties['marker']['size'],
+                                           fillstyle=self.ptfilldict[self.properties['marker']['fill']],
+                                           marker=self.properties['marker']['type'])
+            self.plotlist.append(self.ppoints)
+
         for r in self.raster.itervalues():
             if len(r['datalist']) > 0:
                 col = wx.Color(r['prop']['pcolor'][0],
@@ -496,18 +518,6 @@
 
                 self.plotlist.append(r['pline'])
 
-        if len(self.seglist) > 0 :
-            self.ppoints = plot.PolyMarker(self.seglist,
-                                           legend=' ' + self.properties['marker']['legend'],
-                                           colour=wx.Color(self.properties['marker']['color'][0],
-                                                           self.properties['marker']['color'][1],
-                                                           self.properties['marker']['color'][2],
-                                                           255),
-                                           size=self.properties['marker']['size'],
-                                           fillstyle=self.ptfilldict[self.properties['marker']['fill']],
-                                           marker=self.properties['marker']['type'])
-            self.plotlist.append(self.ppoints)
-
         self.profile = plot.PlotGraphics(self.plotlist,
                                          self.ptitle,
                                          self.xlabel,
@@ -695,7 +705,11 @@
         dlg = OptDialog(parent=self, id=wx.ID_ANY, title=_('Profile settings'))
         btnval = dlg.ShowModal()
 
-        if btnval == wx.ID_SAVE or btnval == wx.ID_CANCEL:
+        if btnval == wx.ID_SAVE:
+            dlg.UpdateSettings()			
+            self.SetGraphStyle()			
+            dlg.Destroy()            
+        elif btnval == wx.ID_CANCEL:
             dlg.Destroy()
 
     def PrintMenu(self, event):



More information about the grass-commit mailing list