Added the concept of 'fake' workflow transitions: when a user can't trigger a transition but needs an explanation about why he can't, a fake button is shown, with a explanation.

This commit is contained in:
Gaetan Delannay 2011-02-01 11:09:54 +01:00
parent b48525c5bb
commit 77112c45be
11 changed files with 141 additions and 34 deletions

View file

@ -2054,6 +2054,13 @@ class Transition:
Else, returns False.'''
return isinstance(self.states[0], State)
def isShowable(self, workflow, obj):
'''Is this transition showable?'''
if callable(self.show):
return self.show(workflow, obj.appy())
else:
return self.show
def getStates(self, fromStates=True):
'''Returns the fromState(s) if p_fromStates is True, the toState(s)
else. If you want to get the states grouped in tuples
@ -2204,4 +2211,6 @@ class Config:
# define it, we will add a copy of the instance defined below.
title = String(multiplicity=(1,1), show='edit')
title.init('title', None, 'appy')
state = String()
state.init('state', None, 'appy')
# ------------------------------------------------------------------------------