[Greater-commits] r3650 - in branches/3.0.0-all-models/GREAT-ER: . Greater/Modules Greater/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Jul 25 15:33:55 CEST 2011


Author: aheinecke
Date: 2011-07-25 15:33:54 +0200 (Mon, 25 Jul 2011)
New Revision: 3650

Modified:
   branches/3.0.0-all-models/GREAT-ER/
   branches/3.0.0-all-models/GREAT-ER/ChangeLog
   branches/3.0.0-all-models/GREAT-ER/Greater/Modules/analysis.py
   branches/3.0.0-all-models/GREAT-ER/Greater/Modules/catchment.py
   branches/3.0.0-all-models/GREAT-ER/Greater/UI/application.py
   branches/3.0.0-all-models/GREAT-ER/Greater/UI/session.py
Log:
Merged revisions 312-315 via svnmerge from 
svn+ssh://wald.intevation.org/greater/trunk/GREAT-ER

........
  r312 | aheinecke | 2011-06-30 11:21:51 +0200 (Thu, 30 Jun 2011) | 3 lines
  
  - Do not use a green to red ramp instance but hand over a reference to the class
  - Use the new setclassificationcolumn function instead of setfield
........
  r313 | aheinecke | 2011-06-30 11:25:34 +0200 (Thu, 30 Jun 2011) | 3 lines
  
  setField no longer exists for a classification it is now stored
  directly at the layer and can be accessed as ClassificationColumn
........
  r314 | aheinecke | 2011-06-30 11:26:14 +0200 (Thu, 30 Jun 2011) | 2 lines
  
  Do not crash if there is no simulation server
........
  r315 | aheinecke | 2011-06-30 11:30:41 +0200 (Thu, 30 Jun 2011) | 4 lines
  
  Write encoding files after the catchment files have been pulled from
  the database.
  This is currently based on the assumption that we only use UTF-8 encoding.
........



Property changes on: branches/3.0.0-all-models/GREAT-ER
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk/GREAT-ER:1-232,310
   + /trunk/GREAT-ER:1-232,310,312-315

Modified: branches/3.0.0-all-models/GREAT-ER/ChangeLog
===================================================================
--- branches/3.0.0-all-models/GREAT-ER/ChangeLog	2011-07-25 13:30:05 UTC (rev 3649)
+++ branches/3.0.0-all-models/GREAT-ER/ChangeLog	2011-07-25 13:33:54 UTC (rev 3650)
@@ -1,10 +1,15 @@
 2011-07-25  Andre Heinecke <aheinecke at intevation.de>
 
-	* Greater/UI/application.py: Use _dagreater_pg as default backend
+	* Greater/UI/application.py:
+		- Use _dagreater_pg as default backend
+		- Check if sim_server exists before accessing it
 	* Greater/Modules/analysis.py: Change classnames to Thuban 1.2 names
 	* Greater/Dialogs/opensession.py: Add encoding line
 	* Greater/UI/session.py: Change classgen classnames to Thuban 1.2
-	* Greater/Modules/catchment.py: Change classgen classnames to Thuban 1.2
+	* Greater/Modules/catchment.py: 
+		- Change classgen classnames to Thuban 1.2
+		- Write encoding files for shapelib with the assumption that
+		  the Database delivers UTF-8 encoded data.
 	* Greater/Dialogs/editdischargedata.py: Add encoding line
 	* Greater/Dialogs/editsubstance.py: Add encoding line
 	* Greater/Dialogs/editenvironment.py: Add encoding line

Modified: branches/3.0.0-all-models/GREAT-ER/Greater/Modules/analysis.py
===================================================================
--- branches/3.0.0-all-models/GREAT-ER/Greater/Modules/analysis.py	2011-07-25 13:30:05 UTC (rev 3649)
+++ branches/3.0.0-all-models/GREAT-ER/Greater/Modules/analysis.py	2011-07-25 13:33:54 UTC (rev 3650)
@@ -392,8 +392,7 @@
         context.session.AddShapeStore(layer.ShapeStore())
        
         # update the classification
-        clazz = layer.GetClassification()
-        clazz.SetField(colname)
+        layer.SetClassificationColumn(colname)
     finally:
         wxEndBusyCursor()
 
@@ -501,8 +500,7 @@
         layer.SetTitle(layer_title)
     
         # update the classification
-        clazz = layer.GetClassification()
-        clazz.SetField(colname)
+        layer.SetClassificationColumn(colname)
     finally:
         wxEndBusyCursor()
 
@@ -631,8 +629,7 @@
         context.session.AddShapeStore(store)
     
         # update the classification
-        clazz = layer.GetClassification()
-        clazz.SetField('combined_class')
+        layer.SetClassificationColumn('combined_class')
     finally:
         wxEndBusyCursor()
 
@@ -1008,8 +1005,7 @@
         context.session.AddShapeStore(store)
     
         # update the classification
-        clazz = layer.GetClassification()
-        clazz.SetField('CSIMINFLUENT_MEAN')
+        layer.SetClassificationColumn('CSIMINFLUENT_MEAN')
     finally:
         wxEndBusyCursor()
 
@@ -1076,8 +1072,7 @@
         context.session.AddShapeStore(store)
     
         # update the classification
-        clazz = layer.GetClassification()
-        clazz.SetField('CSIMEFFLUENT_MEAN')
+        layer.SetClassificationColumn('CSIMEFFLUENT_MEAN')
     finally:
         wxEndBusyCursor()
 
@@ -1164,8 +1159,7 @@
         context.session.AddShapeStore(store)
         
         # update the classification
-        clazz = layer.GetClassification()
-        clazz.SetField('RISK')
+        layer.SetClassificationColumn('RISK')
     finally:
         wxEndBusyCursor()
 

Modified: branches/3.0.0-all-models/GREAT-ER/Greater/Modules/catchment.py
===================================================================
--- branches/3.0.0-all-models/GREAT-ER/Greater/Modules/catchment.py	2011-07-25 13:30:05 UTC (rev 3649)
+++ branches/3.0.0-all-models/GREAT-ER/Greater/Modules/catchment.py	2011-07-25 13:33:54 UTC (rev 3650)
@@ -654,6 +654,14 @@
             shapefiles[o.obj_sub_type] = filename
             if o.obj_sub_type == 'PICS':
                 pics_present = 1
+    # Write encoding files
+    # TODO make codepages dynamic
+    for fname in os.listdir(shapefile_dir):
+        if fname.endswith(".shp"):
+            fptr = open(os.path.join(shapefile_dir,
+                                     fname.replace(".shp", ".cpg")), "w")
+            fptr.write("UTF-8")
+            fptr.close()
 
     if pics_present:
         xmldata = xmldata_start + xmldata_pics + xmldata_end

Modified: branches/3.0.0-all-models/GREAT-ER/Greater/UI/application.py
===================================================================
--- branches/3.0.0-all-models/GREAT-ER/Greater/UI/application.py	2011-07-25 13:30:05 UTC (rev 3649)
+++ branches/3.0.0-all-models/GREAT-ER/Greater/UI/application.py	2011-07-25 13:33:54 UTC (rev 3650)
@@ -72,7 +72,7 @@
     # They differ for GNU/Linux/Win32.
     elif error[0] == 'GreaterModelError':
         sim_server = app.Session().SimulationServerConnection()
-        if not sim_server.UseServer():
+        if not sim_server or not sim_server.UseServer():
             scheduler = 'local running scheduler'
         else:
             scheduler = 'scheduler running '\

Modified: branches/3.0.0-all-models/GREAT-ER/Greater/UI/session.py
===================================================================
--- branches/3.0.0-all-models/GREAT-ER/Greater/UI/session.py	2011-07-25 13:30:05 UTC (rev 3649)
+++ branches/3.0.0-all-models/GREAT-ER/Greater/UI/session.py	2011-07-25 13:33:54 UTC (rev 3650)
@@ -280,7 +280,7 @@
                 _list.sort()
                 quantiles, clazz = generate_quantiles(_list,
                                                 [ 0.25, 0.50, 0.75, 1.0 ],
-                                                green_to_red_ramp(),
+                                                green_to_red_ramp,
                                                 Range(']0;oo['))
                 dg = clazz.GetDefaultGroup()
                 dg.GetProperties().SetLineColor(Color(0,0,1))
@@ -313,8 +313,7 @@
             self.AddShapeStore(store)
 
             # update the classification
-            clazz = layer.GetClassification()
-            clazz.SetField('CSIMINTERN_MEAN')
+            layer.SetClassificationColumn('CSIMINTERN_MEAN')
         finally:
             wxEndBusyCursor()
 



More information about the Greater-commits mailing list