UI: Started basic window
[maevies] / ui / maeviesui / maeviesui / gui.py
1 # -*- coding: utf-8 -*-
2
3 ###########################################################################
4 #    Maevies
5 #    Copyright (C) 2010 Simón Pena <spenap@gmail.com>
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU General Public License as published by
9 #    the Free Software Foundation, either version 3 of the License, or
10 #    (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU General Public License for more details.
16 #
17 #    You should have received a copy of the GNU General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 ###########################################################################
20
21 import pygtk
22 pygtk.require("2.0")
23 import gtk
24
25 class Maevies(gtk.Window):
26
27
28     def __init__(self):
29         gtk.Window.__init__(self)
30         self.set_title("Maevies - 0.1")
31         self.connect('delete-event',
32                      lambda widget, event: gtk.main_quit())
33
34         self._contents = gtk.HBox()
35         self._contents.set_border_width(20)
36         self._contents.set_homogeneous(True)
37         self._contents.pack_start(self._get_content_box("On Theaters"),
38                                   expand=True, fill=True)
39         self._contents.pack_start(self._get_content_box("Favorites"),
40                                   expand=True, fill=True)
41         self._contents.pack_start(self._get_content_box("Search"),
42                                   expand=True, fill=True)
43
44         self.add(self._contents)
45
46         self.show_all()
47
48     def _get_content_box(self, text):
49         favorites = gtk.VBox()
50         favorites.set_border_width(20)
51
52         button = gtk.Button()
53         foot_label = gtk.Label()
54         foot_label.set_text(text)
55
56         favorites.pack_start(button,
57                              expand=True, fill=True)
58         favorites.pack_start(foot_label,
59                              expand=False, fill=False)
60
61         return favorites
62
63     def run(self):
64         gtk.main()
65
66
67 if __name__ == "__main__":
68     maevies = Maevies()
69     maevies.run()