1 # app - zavai main window
3 # Copyright (C) 2009 Enrico Zini <enrico@enricozini.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 class Zavai(gtk.Window, zavai.Resource):
24 def __init__(self, registry, name):
25 super(Zavai, self).__init__()
26 self.registry = registry
28 self.show_widget("menu.main")
30 def show_widget(self, name):
31 # Remove the current widget.
32 # If it is an Applet, stop it
33 if self.current is not None:
34 cur = self.registry.resource(self.current)
35 if isinstance(cur, zavai.Applet):
37 self.remove(self.get_child())
40 # Add the new widget. If it is an applet, start it
41 widget = self.registry.resource(name)
43 widget = self.registry.resource("menu.main")
46 if isinstance(widget, zavai.Applet):
55 class Applet(zavai.Resource):
56 def __init__(self, registry, name):
57 super(Applet, self).__init__()
58 self.zavai_registry = registry
59 self.zavai_name = name
61 def make_parent_link(self):
62 return zavai.LinkButton(self.zavai_registry, zavai.get_parent(self.zavai_name), _("Back"))
67 def start(self, *args):
70 def stop(self, *args):