Richard Lincoln | 17 Jul 16:58

[TraitsGUI] ChainedWizard _next_wizard_changed() method

I would like to create a chained wizard with a first page where I
select from a list of other wizards and this determines the next
wizard.  Please find attached an example of what I am trying to
achieve.

The problem that I have is that when the next_wizard trait of a
ChainedWizard is changed the _next_wizard_changed() method calls
_create_buttons().

    def _next_wizard_changed(self, old, new):
        """ Handle the next wizard being changed. """

        if new is not None:
            self.controller.next_controller = new.controller

#        if self.control is not None:
#            self._create_buttons(self.control)
#            self._update()

        return

As I understand it, _create_buttons() is normally called from
_create_contents() and returns a sizer which is then added to the main
sizer.  The _next_wizard_changed() method does not use the returned
sizer and the created buttons are placed in the top-left corner of the
dialog.  The main problem is that there is no end to the subsequent
pages of the wizard and I get the following traceback if I keep
clicking Next.

Traceback (most recent call last):
  File "/home/rwl/python/ets3-2.5-20004/ETS_3.0.0b1/TraitsBackendWX_3.0.0b1/enthought/pyface/ui/wx/wizard/wizard.py",
line 182, in _on_next
    self.next()
  File "/home/rwl/python/ets3-2.5-20004/ETS_3.0.0b1/TraitsGUI_3.0.0b1/enthought/pyface/wizard/i_wizard.py",
line 74, in next
    self._show_page(page)
  File "/home/rwl/python/ets3-2.5-20004/ETS_3.0.0b1/TraitsBackendWX_3.0.0b1/enthought/pyface/ui/wx/wizard/wizard.py",
line 109, in _show_page
    if not panel.has_layer(page.id):
AttributeError: 'NoneType' object has no attribute 'id'

If I comment the lines out as above I get no problems with my wizards
or with the example provided with Pyface.  I don't fully understand
how the wizards work, but can this be done?

Regards,

Richard
Attachment (test_chained_wizard.py): text/x-python, 3459 bytes
_______________________________________________
Enthought-dev mailing list
Enthought-dev@...
https://mail.enthought.com/mailman/listinfo/enthought-dev

Gmane