From: Kristoffer Grönlund Date: Tue, 5 Jan 2010 16:26:17 +0000 (+0100) Subject: LOL, helldon. though there's something bad going on with gthreads. X-Git-Url: https://vcs.maemo.org/git/?p=jamaendo;a=commitdiff_plain;h=492c66ab47d14690ad5b20ec9cef50d17d00a326 LOL, helldon. though there's something bad going on with gthreads. --- diff --git a/helldon/__init__.py b/helldon/__init__.py index d3aa134..cf817d7 100644 --- a/helldon/__init__.py +++ b/helldon/__init__.py @@ -29,27 +29,55 @@ class Program(gtk.Window): self.add(self._vbox) self.show_all() Program.instance = self + self._backbtn.connect('clicked', self.on_back) + + self._stack = [] def add_window(self, wnd): pass - def add_stackable(self, wnd): + def push_stackable(self, wnd): + while self._notebook.get_n_pages() > 0: + p = self._notebook.get_nth_page(0) + self._stack.append(p) + self._notebook.remove_page(0) + p.hide() + idx = self._notebook.append_page(wnd) self._notebook.set_current_page(idx) wnd.show_all() wnd._nb_index = idx + def popped_stackable(self, wnd=None): + pass + + def pop_stackable(self): + while self._notebook.get_n_pages() > 0: + p = self._notebook.get_nth_page(0) + self._notebook.remove_page(0) + p.hide() + if len(self._stack): + tail = self._stack.pop() + self.push_stackable(tail) + + def on_back(self, *args): + self.pop_stackable() + class StackableWindow(gtk.Frame): def __init__(self): gtk.Frame.__init__(self) self._nb_index = 0 - Program.instance.add_stackable(self) + Program.instance.push_stackable(self) + self.connect('destroy', self.on_destroy) def set_app_menu(self, menu): pass def set_title(self, title): Program.instance._title.set_text(title)#_notebook.set_tab_label_text(self, title) + def on_destroy(self, *args): + Program.instance.popped_stackable(self) + class AppMenu(object): def __init__(self): pass diff --git a/jamaui/listbox.py b/jamaui/listbox.py index bc34d09..c74f1d8 100644 --- a/jamaui/listbox.py +++ b/jamaui/listbox.py @@ -2,8 +2,10 @@ import gtk try: import hildon + _using_helldon = False except: import helldon as hildon + _using_helldon = True class ListBox(gtk.TreeView): def __init__(self): @@ -42,7 +44,7 @@ class ListBox(gtk.TreeView): class ListDialog(gtk.Dialog): def __init__(self, title, parent=None): - gtk.Dialog.__init__(self, title, parent) + gtk.Dialog.__init__(self, title, parent if not _using_helldon else None) self.listbox = ListBox() panarea = hildon.PannableArea() panarea.add(self.listbox) @@ -59,7 +61,7 @@ class ListDialog(gtk.Dialog): class ButtonListDialog(gtk.Dialog): def __init__(self, title, parent=None): - gtk.Dialog.__init__(self, title, parent) + gtk.Dialog.__init__(self, title, parent if not _using_helldon else None) self.panarea = hildon.PannableArea() self.panarea.set_size_request(800, 400) self.buttons = gtk.VBox(False, 0)