[Mpuls-commits] r1744 - wasko/branches/2.0/mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Feb 24 12:51:02 CET 2010
Author: torsten
Date: 2010-02-24 12:51:01 +0100 (Wed, 24 Feb 2010)
New Revision: 1744
Modified:
wasko/branches/2.0/mpulsweb/model/phase.py
Log:
* mpulsweb/model/phase.py (PhaseList.get_current_phase_id): Added
function to return the id of the current active phasepart
Modified: wasko/branches/2.0/mpulsweb/model/phase.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/phase.py 2010-02-24 11:27:33 UTC (rev 1743)
+++ wasko/branches/2.0/mpulsweb/model/phase.py 2010-02-24 11:51:01 UTC (rev 1744)
@@ -26,7 +26,14 @@
return self.phases
class PhaseList(list):
- pass
+
+ def get_current_phase_id(self):
+ '''Returns id of current active phasepart'''
+ for phase in self:
+ p1, p2 = phase.getStart(), phase.getEnd()
+ if p1.is_active(): return p1.id
+ if p2.is_active(): return p2.id
+ return None
class Phase:
@@ -58,7 +65,7 @@
class PhasePart:
def __init__(self, id, it):
self.id = id
- self.running = False
+ self.active = False
self.fields = []
pfields = g.mpuls_config.get('phases', 'fields')[0]
for phasepart, fields in pfields.iteritems():
@@ -74,7 +81,7 @@
case_id = it.getRootNode().getIdentifier()
realid = "%s:%s" % (PHASEFIELD, case_id)
field = it.getItem(realid)
- self.running = field.getValue() == int(self.id)
+ self.active = field.getValue() == int(self.id)
def getLinks(self):
out = []
@@ -88,6 +95,9 @@
def getTime(self):
return ""
+ def is_active(self):
+ return self.active
+
def is_ok(self):
for field in self.fields:
if not field.is_ok(): return False
More information about the Mpuls-commits
mailing list