1 from gtkmvc import View
4 from filesearch import FilesearchView
7 class ApplicationView(View):
8 """A view for the top level window (application)"""
10 def __init__(self, ctrl):
11 View.__init__(self, ctrl, register=False)
12 self.filesearch = None
13 self.__build_widgets()
14 ctrl.register_view(self)
17 def __build_widgets(self):
18 self['main_window'] = gtk.Window()
19 self['main_window'].set_default_size(500, 350)
20 self['main_window'].set_border_width(4)
22 self['about_btn'] = gtk.Button('About')
23 self['quit_btn'] = gtk.Button('Exit')
25 self['about_btn'].set_size_request(100, 50)
26 self['quit_btn'].set_size_request(100, 50)
28 hbox = gtk.HBox(True, 4)
29 hbox.pack_start(self['about_btn'])
30 hbox.pack_start(self['quit_btn'])
32 self['vbox'] = gtk.VBox(False, 4)
33 self['vbox'].pack_start(hbox, False, False, 0)
35 self['main_window'].add(self['vbox'])
36 self['main_window'].show_all()
40 def create_sub_views(self, filesearch_ctrl):
41 """Creates and connects sub views"""
42 self.filesearch = FilesearchView(filesearch_ctrl) # not a top level
43 self['vbox'].pack_start(self.filesearch['vbox'])