You need to connect to the delete-event of the subwindow and invoke
hide() in there to hide the window. Your delete callback must return
True to signalize that the windows is not to be destroyed.


Martin


2010/2/16, Max Usachev <[email protected]>:
> Hello!
> Please, help me with hiding stackable window.
> My app has Main mode and submodes.
> Each submode = class instance + its UI. Each mode has Activate method:
> if class instance is exists, then activate method must only show mode
> UI, else, if there is no instance, method must create class instance and
> its UI and show this UI. This is my code, and I can't show UI of
> existing mode second time:
>
> import gtk
> import hildon
>
> class SubMode:
>      def __init__(self):
>          self.window = None
>
>      def activate(self):
>          if not self.window:
>              self.window = hildon.StackableWindow()
>              self.window.set_title("SubMode")
>          self.window.show_all()
>
> class TestApp():
>      def __init__(self):
>          self.window = None
>          self.submode_object = None
>          self.create_ui()
>
>      def create_ui(self):
>          """Create Main mode UI."""
>          self.window = hildon.StackableWindow()
>          self.window.set_title('Main mode')
>          self.window.connect('destroy', gtk.main_quit)
>          vbox = gtk.VBox()
>          button = hildon.Button(gtk.HILDON_SIZE_AUTO, \
>              hildon.BUTTON_ARRANGEMENT_VERTICAL)
>          button.set_title("Activate SubMode")
>          button.connect('clicked', self.activate_submode)
>          vbox.pack_start(button)
>          self.window.add(vbox)
>          self.window.show_all()
>
>      def activate_submode(self, widget):
>          """Show submode."""
>          if not self.submode_object:
>              self.submode_object = SubMode()
>          self.submode_object.activate()
>
>
> if __name__ == "__main__":
>      TestApp()
>      gtk.main()
>
>
>
> Br,
> Max Usachev.
> _______________________________________________
> maemo-developers mailing list
> [email protected]
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>
_______________________________________________
maemo-developers mailing list
[email protected]
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to