[pygtk] Problem with Notebook

Frédéric frederic.mantegazza at gbiloba.org
Tue Dec 23 23:46:12 WST 2008


Hello,

I use a Notebook widget. I added the following callback to 
the 'switch-page' signal:

def __onNoteBookSwitchedPage(self, widget, page, page_num):
    if page_num == 0 and self._model.camera.lens.type_ == 'fisheye':
        controller = WarningMessageController(_("Warning"),
                                              _("Can't set shooting mode"))
        controller.run()
        self.notebook.set_current_page(1) # Does not work!!!
    else:
        if page_num == 0:
            self._model.mode = 'mosaic'
        else:
            self._model.mode = 'preset'

As you can see, depending of a config. parameter 
(self._model.camera.lens.type_), I show a warning saying that the selected 
TAB can't be used. I would like to stay on the current tab, but as soon as 
the warning is closed, the selected tab is shown; the 
self.notebook.set_current_page(1) call does not seem to work. Why ? If I 
change some widgets, here, it works; why not the Notebook?

Thanks,

-- 
    Frédéric

    http://www.gbiloba.org


More information about the pygtk mailing list