El 08/05/15 a les 09:07, Raimon Esteve ha escrit:
Hie,
I like to call a wizard GUI (popup) from a custom method. My scenario:
1- A button, call a method example().
2. The method example(), depend state, call other method. For example:
- Draft state call example_draft()
- Done state call example_done()
About example method:
def example():
if state == 'done':
example_done()
else:
example_draft()
Now, in case is done(), I like to open a GUI wizard. For example:
def example_done():
# Here I check some parts
...
if someting:
# Call a wizard GUI. How do it?
else:
# Not do nothing
return
Of course calling Wizard.create() and Wizard.execute() don't open
wizard GUI. I like to do similar @ModelView.button_action but inside a
method.
Is it possible to do it?
AFAIU what you wan't is a StateAction that call your wizard. Once you
have this, on your transition simply return the state name of the
StateAction that points to the wizard and the client will open it.
Example:
class Wizard(Wizard):
start = StateTransition()
open_wizard = StateAction('xml_id_of_your_wizard')
def transition_start(self):
return 'open_wizard'
Hope it helps.
--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk