[Greater-commits] r228 - in trunk/GREAT-ER/Greater: Dialogs Modules UI
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jun 22 09:58:01 CEST 2011
Author: aheinecke
Date: 2011-06-22 09:58:00 +0200 (Wed, 22 Jun 2011)
New Revision: 228
Modified:
trunk/GREAT-ER/Greater/Dialogs/opensession.py
trunk/GREAT-ER/Greater/Modules/analysis.py
trunk/GREAT-ER/Greater/Modules/model.py
trunk/GREAT-ER/Greater/Modules/session.py
trunk/GREAT-ER/Greater/UI/application.py
Log:
Update greater so that the postgresbackend can be used
Modified: trunk/GREAT-ER/Greater/Dialogs/opensession.py
===================================================================
--- trunk/GREAT-ER/Greater/Dialogs/opensession.py 2011-06-22 07:50:19 UTC (rev 227)
+++ trunk/GREAT-ER/Greater/Dialogs/opensession.py 2011-06-22 07:58:00 UTC (rev 228)
@@ -10,9 +10,9 @@
GREAT-ER open session dialog for wxPython
"""
-__version__ = "$Revision: 1.33 $"
+__version__ = "$Revision: 1.34 $"
# $Source: /home/greater/jail/greaterrepository/GREAT-ER/Greater/Dialogs/opensession.py,v $
-# $Id: opensession.py,v 1.33 2003/05/26 17:15:57 jan Exp $
+# $Id: opensession.py,v 1.34 2003/11/04 16:16:10 frank Exp $
from wxPython.wx import *
@@ -60,7 +60,7 @@
}) )
da_insert_group( DA_S_group({
'group_id': '4711',
- 'name': 'Kölsch Group',
+ 'name': 'Koelsch Group',
'admin': 'N',
'cre_date': '',
'mod_date': '',
@@ -87,10 +87,10 @@
wxDialog.__init__(self, parent, -1, title,
style=wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+ self.session_list = []
if len(sessions) < 1:
return
- self.session_list = []
if caller_user is not None:
# drop those where we don't have a right to write the session
# or substance and drop those where you have no read
Modified: trunk/GREAT-ER/Greater/Modules/analysis.py
===================================================================
--- trunk/GREAT-ER/Greater/Modules/analysis.py 2011-06-22 07:50:19 UTC (rev 227)
+++ trunk/GREAT-ER/Greater/Modules/analysis.py 2011-06-22 07:58:00 UTC (rev 228)
@@ -9,9 +9,9 @@
GREAT-ER Analysis-Management as an extension to Thuban.
"""
-__version__ = "$Revision: 1.55 $"
+__version__ = "$Revision: 1.56 $"
# $Source: /home/greater/jail/greaterrepository/GREAT-ER/Greater/Modules/analysis.py,v $
-# $Id: analysis.py,v 1.55 2003/09/29 10:45:31 jan Exp $
+# $Id: analysis.py,v 1.56 2003/10/10 08:00:46 jan Exp $
import os
@@ -22,12 +22,11 @@
from Thuban.UI.command import registry, Command, ToolCommand
from Thuban.UI.mainwindow import make_check_current_tool
-from Thuban.UI.view import Tool
+from Thuban.UI.view import CanvasPanTool
from Thuban.Model.color import Color
from Thuban.Model.layer import Layer
-from Thuban.Model.classgen import GenUniformDistribution, GenQuantiles, \
- GenSingletonsFromList, GreenToRedRamp, \
- GenQuantiles0
+from Thuban.Model.classgen import generate_uniform_distribution, generate_quantiles, \
+ generate_singletons, green_to_red_ramp
from Thuban.Model.transientdb import AutoTransientTable, TransientJoinedTable
from Thuban.Model.data import DerivedShapeStore
from Thuban.Model.range import Range
@@ -236,9 +235,9 @@
_list.append(results.StretchTable().ReadValue(i, colname))
_list.sort()
- quantiles, clazz = GenQuantiles(_list,
+ quantiles, clazz = generate_quantiles(_list,
[ 0.25, 0.50, 0.75, 1.0 ],
- GreenToRedRamp(),
+ green_to_red_ramp(),
Range(']0;oo['))
dg = clazz.GetDefaultGroup()
dg.GetProperties().SetLineColor(Color(0,0,1))
@@ -337,12 +336,12 @@
_list.sort()
if class_ranges[0]:
- quantiles, clazz, upper_class0 = GenQuantiles0(_list, class_ranges,
- GreenToRedRamp(),
+ quantiles, clazz, upper_class0 = generate_quantiles0(_list, class_ranges,
+ green_to_red_ramp(),
Range(']0;oo['))
else:
- quantiles, clazz = GenQuantiles(_list, class_ranges[1:],
- GreenToRedRamp(),
+ quantiles, clazz = generate_quantiles(_list, class_ranges[1:],
+ green_to_red_ramp(),
Range(']0;oo['))
dg = clazz.GetDefaultGroup()
dg.GetProperties().SetLineColor(Color(0,0,1))
@@ -396,8 +395,8 @@
# compute the flow classes
flow_classes = {}
min, max = rivrestable.ValueRange('q_mean')
- clazz = GenUniformDistribution(min, max, num_flow_classes,
- GreenToRedRamp())
+ clazz = generate_uniform_distribution(min, max, num_flow_classes,
+ green_to_red_ramp())
for i in range(rivrestable.NumRows()):
q_mean = rivrestable.ReadValue(i, 'q_mean')
stretch_id = rivrestable.ReadValue(i, 'stretch_id')
@@ -414,8 +413,8 @@
for i in range(restable.NumRows()):
_list.append(restable.ReadValue(i, 'CSIMINTERN_MEAN'))
_list.sort()
- quantiles, clazz = GenQuantiles(_list, [ 0.25, 0.50, 0.75, 1.0 ],
- GreenToRedRamp(), Range(']0;oo['))
+ quantiles, clazz = generate_quantiles(_list, [ 0.25, 0.50, 0.75, 1.0 ],
+ green_to_red_ramp(), Range(']0;oo['))
for i in range(restable.NumRows()):
csim_mean = restable.ReadValue(i, 'CSIMINTERN_MEAN')
stretch_id = restable.ReadValue(i, 'STRETCH_ID')
@@ -433,7 +432,10 @@
combined_classes = {}
combined_classes_dict = {}
for k in csim_classes.keys():
- if csim_classes[k] != -1:
+ # the has_key test is needed for simulation where
+ # the catchment has virtual stretches and an offset concentration
+ # has been specified.
+ if csim_classes[k] != -1 and flow_classes.has_key(k):
s = flow_classes[k] * (num_flow_classes+1) + \
csim_classes[k] * (num_csim_classes+1)*(num_csim_classes+1)
combined_classes[k] = s
@@ -462,8 +464,8 @@
numGroups = num_flow_classes * num_csim_classes
_list = combined_classes_dict.keys()
_list.sort()
- clazz = GenSingletonsFromList(_list,
- numGroups, GreenToRedRamp())
+ clazz = generate_singletons(_list,
+ numGroups, green_to_red_ramp())
dg = clazz.GetDefaultGroup()
dg.GetProperties().SetLineColor(Color(0,0,1))
dg.SetVisible(0)
@@ -822,8 +824,8 @@
'CSIMINFLUENT_MEAN'))
_list.sort()
- quantiles, clazz = GenQuantiles(_list, [ 0.25, 0.50, 0.75, 1.0 ],
- GreenToRedRamp(), Range(']0;oo['))
+ quantiles, clazz = generate_quantiles(_list, [ 0.25, 0.50, 0.75, 1.0 ],
+ green_to_red_ramp(), Range(']0;oo['))
dg = clazz.GetDefaultGroup()
dg.GetProperties().SetLineColor(Color(0,0,1))
dg.SetLabel('0')
@@ -890,8 +892,8 @@
'CSIMEFFLUENT_MEAN'))
_list.sort()
- quantiles, clazz = GenQuantiles(_list, [ 0.25, 0.50, 0.75, 1.0 ],
- GreenToRedRamp(), Range(']0;oo['))
+ quantiles, clazz = generate_quantiles(_list, [ 0.25, 0.50, 0.75, 1.0 ],
+ green_to_red_ramp(), Range(']0;oo['))
dg = clazz.GetDefaultGroup()
dg.GetProperties().SetLineColor(Color(0,0,1))
dg.SetLabel('0')
@@ -989,7 +991,7 @@
layer.SetGreaterLayerType('RIVERNETRISK')
# attach a classification to the layer
- clazz = GenUniformDistribution(1, 10, 2, GreenToRedRamp())
+ clazz = generate_uniform_distribution(1, 10, 2, green_to_red_ramp())
dg = clazz.GetDefaultGroup()
dg.GetProperties().SetLineColor(Color(0,0,1))
dg.SetVisible(0)
@@ -1021,14 +1023,14 @@
finally:
wxEndBusyCursor()
-class SelectTool(Tool):
+class SelectTool(CanvasPanTool):
"""Tool to pick an object and run a dialog"""
def __init__(self, view, name, context, function, layer_name = None):
"""layer_name may either be "PICS" (Pictures).
Anything else defeaults to RiverNetworkResults."""
- Tool.__init__(self, view)
+ CanvasPanTool.__init__(self, view)
self.name = name
self.context = context
self.function = function
Modified: trunk/GREAT-ER/Greater/Modules/model.py
===================================================================
--- trunk/GREAT-ER/Greater/Modules/model.py 2011-06-22 07:50:19 UTC (rev 227)
+++ trunk/GREAT-ER/Greater/Modules/model.py 2011-06-22 07:58:00 UTC (rev 228)
@@ -11,9 +11,9 @@
GREAT-ER Model Object.
"""
-__version__ = "$Revision: 1.87 $"
+__version__ = "$Revision: 1.88 $"
# $Source: /home/greater/jail/greaterrepository/GREAT-ER/Greater/Modules/model.py,v $
-# $Id: model.py,v 1.87 2003/09/30 13:04:09 frank Exp $
+# $Id: model.py,v 1.88 2003/11/05 14:07:59 frank Exp $
from wxPython.wx import wxMessageDialog, wxBeginBusyCursor, wxEndBusyCursor, \
wxProcess, wxExecute, wxOK, wxICON_INFORMATION, wxSleep, \
@@ -290,7 +290,7 @@
"""Represent the connection to a GREAT-ER simulation server"""
- def __init__(self, serverurl = '', useserver = 'no'):
+ def __init__(self, serverurl = '', useserver = 'no', db_api_module=None):
"""useserver is a 'yes'/'no' indicating whether the server is
to be contacted or the simulation is executed locally.
Anythin else than 'yes' defaults to 'no'.
@@ -299,6 +299,7 @@
"""
self.rpc = None
self.useserver = 'no'
+ self.db_api_module = db_api_module
self.reconnect(serverurl, useserver)
def reconnect(self, serverurl, useserver):
@@ -321,9 +322,9 @@
self.rpc = xmlrpclib.Server(self.serverurl)
else:
server = SchedulerProcess(port_scan_range = 500,
- allow_shutdown = 1)
+ allow_shutdown = 1, db_api_module = self.db_api_module)
server.start()
- worker = WorkerProcess(scheduler_port = server.real_worker_port)
+ worker = WorkerProcess(scheduler_port = server.real_worker_port, db_api_module = self.db_api_module)
worker.start()
server.wait_for_worker()
self.rpc = xmlrpclib.Server('http://localhost:%d' % \
@@ -735,7 +736,8 @@
if simserverconnection is None:
context.session.SetSimulationServerConnection(\
- SimulationServerConnection(result[0], result[1]))
+ SimulationServerConnection(result[0], result[1],
+ db_api_module=context.mainwindow.application.get_db_api_module()))
else:
simserverconnection.reconnect(result[0], result[1])
context.session.UnsetModified()
Modified: trunk/GREAT-ER/Greater/Modules/session.py
===================================================================
--- trunk/GREAT-ER/Greater/Modules/session.py 2011-06-22 07:50:19 UTC (rev 227)
+++ trunk/GREAT-ER/Greater/Modules/session.py 2011-06-22 07:58:00 UTC (rev 228)
@@ -9,9 +9,9 @@
"""GREAT-ER Session management"""
-__version__ = "$Revision: 1.124 $"
+__version__ = "$Revision: 1.125 $"
# $Source: /home/greater/jail/greaterrepository/GREAT-ER/Greater/Modules/session.py,v $
-# $Id: session.py,v 1.124 2003/06/25 16:07:01 jan Exp $
+# $Id: session.py,v 1.125 2003/12/08 14:35:04 frank Exp $
from wxPython.wx import wxMessageDialog, wxBeginBusyCursor, wxEndBusyCursor, \
wxSafeYield, wxYES_NO, wxCANCEL, wxID_NO, wxID_YES, wxID_CANCEL, \
@@ -93,7 +93,9 @@
# Actually start scheduler and worker
context.mainwindow.Disable()
context.session.SetSimulationServerConnection(\
- SimulationServerConnection())
+ SimulationServerConnection(
+ db_api_module=context.mainwindow.application.get_db_api_module()
+ ))
context.mainwindow.Enable(True)
finally:
wxEndBusyCursor()
Modified: trunk/GREAT-ER/Greater/UI/application.py
===================================================================
--- trunk/GREAT-ER/Greater/UI/application.py 2011-06-22 07:50:19 UTC (rev 227)
+++ trunk/GREAT-ER/Greater/UI/application.py 2011-06-22 07:58:00 UTC (rev 228)
@@ -11,9 +11,9 @@
GREAT-ER's application object and main entry point
"""
-__version__ = "$Revision: 1.53 $"
+__version__ = "$Revision: 1.54 $"
# $Source: /home/greater/jail/greaterrepository/GREAT-ER/Greater/UI/application.py,v $
-# $Id: application.py,v 1.53 2003/09/24 13:32:24 bh Exp $
+# $Id: application.py,v 1.54 2003/11/05 14:07:59 frank Exp $
import sys
import os
@@ -185,6 +185,12 @@
# collected early enough.
sys.last_type = sys.last_value = sys.last_traceback = None
+ def set_db_api_module(self, db_api_module):
+ self.db_api_module=db_api_module
+
+ def get_db_api_module(self):
+ return self.db_api_module
+
def main():
"""Instantiate the application object and run the application"""
@@ -195,7 +201,7 @@
stub_auto_login = 0
db_auto_login = 0
alpha_mode = False
- db_api_module = "_dagreater"
+ db_api_module = "_dagreater_pg"
opts, args = getopt.getopt(sys.argv[1:], '', ['stub-auto-login',
'alpha',
'db-auto-login',
@@ -262,6 +268,7 @@
app.top.ShowLegend()
GreaterDB.interface.set_api_interface(db_api_module)
+ app.set_db_api_module(db_api_module)
logged_in = 0
if stub_auto_login:
@@ -320,7 +327,7 @@
app.top.Disable()
# Actually start scheduler and worker
app.Session().SetSimulationServerConnection(\
- SimulationServerConnection())
+ SimulationServerConnection(db_api_module=db_api_module))
app.top.Enable(True)
app.Session().changed()
More information about the Greater-commits
mailing list