Frédéric wrote:
> On mardi 23 décembre 2008, John Ehresman wrote:
> 
>> This is almost certainly due to being in a signal handler of the
>> notebook widget and how the switch-page operation is implemented in the
>> gtk notebook C code.  The probable solution is to display the dialog,
>> but don't block.  Then switch the page when the dialog is closed.
> 
> I think this is more or less what I do... What do you have in mind, 
> exactly? How can I switch the page, as the set_current_page() does not 
> work?

Does controller.run() block?  If so, change the call to something that 
does not block and put the self.notebook.set_current_page(1) into a 
function / method that invoked later.

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!!!

If .run() already does not block, call self.notebook.set_current_page(1) 
from an idle call; e.g. something like
         controller.run()
         def on_idle():
             self.notebook.set_current_page(1)
         gtk.idle_add(on_idle) # <-- I think there's a newer api for this

Note that care should be taken that things aren't destroyed or changed 
before on_idle is invoked.

John
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to