from gtkmvc import View
-import os.path
import gtk
+from filesearch import FilesearchView
+
class ApplicationView(View):
"""A view for the top level window (application)"""
def __init__(self, ctrl):
View.__init__(self, ctrl, register=False)
+ self.filesearch = None
+ self.__build_widgets()
+ ctrl.register_view(self)
+ return
- window = gtk.Window()
- window.set_border_width(4)
+ def __build_widgets(self):
+ self['main_window'] = gtk.Window()
+ self['main_window'].set_default_size(500, 350)
+ self['main_window'].set_border_width(4)
- hbox = gtk.HBox(4, True)
+ self['about_btn'] = gtk.Button('About')
+ self['quit_btn'] = gtk.Button('Exit')
- about_btn = gtk.Button('About')
- quit_btn = gtk.Button('Exit')
+ self['about_btn'].set_size_request(100, 50)
+ self['quit_btn'].set_size_request(100, 50)
- about_btn.set_size_request(100, 150)
- quit_btn.set_size_request(100, 150)
+ hbox = gtk.HBox(True, 4)
+ hbox.pack_start(self['about_btn'])
+ hbox.pack_start(self['quit_btn'])
- hbox.pack_start(about_btn, True, True, 0)
- hbox.pack_start(quit_btn, True, True, 0)
+ self['vbox'] = gtk.VBox(False, 4)
+ self['vbox'].pack_start(hbox, False, False, 0)
- window.add(hbox)
- window.show_all()
+ self['main_window'].add(self['vbox'])
+ self['main_window'].show_all()
- self['main_window'] = window
- self['about_btn'] = about_btn
- self['quit_btn'] = quit_btn
+ return
- ctrl.register_view(self)
+ def create_sub_views(self, filesearch_ctrl):
+ """Creates and connects sub views"""
+ self.filesearch = FilesearchView(filesearch_ctrl) # not a top level
+ self['vbox'].pack_start(self.filesearch['vbox'])
return
pass # end of class