173 @property |
173 @property |
174 def displayable_state(self): |
174 def displayable_state(self): |
175 return self.req._(self.state) |
175 return self.req._(self.state) |
176 |
176 |
177 def wf_state(self, statename): |
177 def wf_state(self, statename): |
178 rset = self.req.execute('Any S, SN WHERE S name %(n)s, S state_of E, E name %(e)s', |
178 rset = self.req.execute('Any S, SN WHERE S name SN, S name %(n)s, S state_of E, E name %(e)s', |
179 {'n': statename, 'e': str(self.e_schema)}) |
179 {'n': statename, 'e': str(self.e_schema)}) |
180 if rset: |
180 if rset: |
181 return rset.get_entity(0, 0) |
181 return rset.get_entity(0, 0) |
182 return None |
182 return None |
183 |
183 |
184 def wf_transition(self, trname): |
184 def wf_transition(self, trname): |
185 rset = self.req.execute('Any T, TN WHERE T name %(n)s, T transition_of E, E name %(e)s', |
185 rset = self.req.execute('Any T, TN WHERE T name TN, T name %(n)s, T transition_of E, E name %(e)s', |
186 {'n': trname, 'e': str(self.e_schema)}) |
186 {'n': trname, 'e': str(self.e_schema)}) |
187 if rset: |
187 if rset: |
188 return rset.get_entity(0, 0) |
188 return rset.get_entity(0, 0) |
189 return None |
189 return None |
190 |
190 |
366 |
366 |
367 class ProgressMixIn(object): |
367 class ProgressMixIn(object): |
368 """provide default implementations for IProgress interface methods""" |
368 """provide default implementations for IProgress interface methods""" |
369 |
369 |
370 @property |
370 @property |
371 @cached |
|
372 def cost(self): |
371 def cost(self): |
373 return self.progress_info()['estimated'] |
372 return self.progress_info()['estimated'] |
374 |
373 |
375 @property |
374 @property |
376 @cached |
|
377 def revised_cost(self): |
375 def revised_cost(self): |
378 return self.progress_info().get('estimatedcorrected', self.cost) |
376 return self.progress_info().get('estimatedcorrected', self.cost) |
379 |
377 |
380 @property |
378 @property |
381 @cached |
|
382 def done(self): |
379 def done(self): |
383 return self.progress_info()['done'] |
380 return self.progress_info()['done'] |
384 |
381 |
385 @property |
382 @property |
386 @cached |
|
387 def todo(self): |
383 def todo(self): |
388 return self.progress_info()['todo'] |
384 return self.progress_info()['todo'] |
389 |
385 |
390 @cached |
386 @cached |
391 def progress_info(self): |
387 def progress_info(self): |