[pygtk] Problem with Notebook
John Finlay
finlay at moeraki.com
Wed Dec 24 09:24:13 WST 2008
Frédéric wrote:
> 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,
>
>
Since you just want to stay on the same page (assuming you mean the
currently displayed page) then you should be able to stop the emission
of the 'switch-page' signal using:
self.notebook.stop_emission('switch-page')
which will prevent the page change.
John
More information about the pygtk
mailing list