moved size_convert function and about dialog outside MVC scope
[findit] / src / mvc / controllers / application.py
1 from gtkmvc import Controller
2 import gtk
3
4 from filesearch import FilesearchCtrl
5 from debsearch import DebsearchCtrl
6
7 import misc.about
8
9
10 class ApplicationCtrl(Controller):
11     """Controller of the top-level window (application)"""
12
13     def __init__(self, model):
14         Controller.__init__(self, model)
15         self.filesearch = FilesearchCtrl(model.filesearch)
16         self.debsearch = DebsearchCtrl(model.debsearch)
17
18     def register_view(self, view):
19         """Creates subviews and connect signals"""
20         Controller.register_view(self, view)
21
22         self.view.create_sub_views('file', self.filesearch)
23 #        self.view.create_sub_views('deb', self.debsearch)
24
25         # connects the signals:
26         self.view['main_window'].connect('destroy', gtk.main_quit)
27         self.view['about_btn'].connect('clicked', self.on_about_btn_clicked)
28         self.view['quit_btn'].connect('clicked', self.on_quit_btn_clicked)
29
30     # -----------------------------------------------------
31     #                  user callbacks
32     # -----------------------------------------------------
33
34     def quit(self):
35         gtk.main_quit()
36
37     def run(self):
38         gtk.main()
39
40     # -----------------------------------------------------
41     #                    gtk signals
42     # -----------------------------------------------------
43
44     def on_about_btn_clicked(self, tb):
45         misc.about.About() # this runs in modal mode
46
47     def on_quit_btn_clicked(self, bt):
48         self.quit()
49
50     # -----------------------------------------------------
51     #                observable properties
52     # -----------------------------------------------------