ui: Added MovieWindow
authorSimón Pena <spenap@gmail.com>
Tue, 25 May 2010 22:01:25 +0000 (00:01 +0200)
committerSimón Pena <spenap@gmail.com>
Tue, 25 May 2010 22:09:11 +0000 (00:09 +0200)
Created a new Window to display the details of a movie found. Added
some Lorem Ipsum text to test the window, and a fake movie.

ui/maeviesui/maeviesui/gui.py
ui/maeviesui/util/constants.py

index 175f1a0..c3efc05 100644 (file)
@@ -167,12 +167,18 @@ class ResultsWindow(hildon.StackableWindow):
         self._simulate_search()
         content_area = hildon.PannableArea()
         self._movies_view = MoviesView()
+        self._movies_view.connect('row-activated', self._row_activated_cb)
 
         content_area.add(self._movies_view)
         self.add(content_area)
 
         self.show_all()
 
+    def _row_activated_cb(self, view, path, column):
+        #movie = view.get_movie_from_path(path)
+        MovieWindow(None)
+
+
     def _simulate_search(self):
         self._show_banner()
         hildon.hildon_gtk_window_set_progress_indicator(self, True)
@@ -278,6 +284,51 @@ class MovieDecorator:
         pixbuf = gtk.IconTheme().load_icon('general_video_file', 48, 0)
         return pixbuf
 
+class MovieWindow(hildon.StackableWindow):
+
+    _zombieland = {'Title' : "Zombieland", 'Release date' : "27 November 2009",
+                   'Genre' : "Action | Adventure | Comedy", 'Score' : "7.8",
+                   'Popularity' : "down 4%", 'Overview' : constants.LOREM_IPSUM}
+
+    def _create_contents(self, movie):
+        main_area = hildon.PannableArea()
+
+        main_box = gtk.VBox(False, 20)
+        main_box.set_border_width(20)
+        upper_content = gtk.HBox(False, 20)
+        upper_content.set_border_width(20)
+
+        image = gtk.Image()
+        image.set_from_pixbuf(gtk.IconTheme().load_icon('mediaplayer_default_album', 256, 0))
+
+        side_content = gtk.VBox(False, 30)
+
+        for key in ["Title", "Release date", "Genre", "Score", "Popularity"]:
+            label = gtk.Label()
+            label.set_markup("<b>%(field)s:</b> <small>%(value)s</small>" % {'field' : key,
+                                                                             'value' : movie[key]})
+            label.set_alignment(constants.LEFT_ALIGNMENT, constants.CENTER_ALIGNMENT)
+            side_content.pack_start(label, False, False)
+
+        upper_content.pack_start(image, False, False)
+        upper_content.pack_start(side_content, True, True)
+
+        label = gtk.Label()
+        label.set_markup("<b>%(field)s:</b>\n %(value)s" % {'field' : 'Overview',
+                                                            'value' : movie['Overview']})
+        label.set_alignment(constants.LEFT_ALIGNMENT, constants.CENTER_ALIGNMENT)
+
+        main_box.pack_start(upper_content, False, False)
+        main_box.pack_start(label, False, False)
+
+        main_area.add_with_viewport(main_box)
+        return main_area
+
+    def __init__(self, movie):
+        super(MovieWindow, self).__init__()
+        self.add(self._create_contents(self._zombieland))
+        self.show_all()
+
 if __name__ == "__main__":
     maevies = Maevies()
     maevies.run()
index d46df6f..7b71306 100644 (file)
@@ -26,3 +26,13 @@ LOCAL_DATA_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                               os.pardir,
                                               'data'))
 TIMEOUT_TIME_MILLIS = 500
+LEFT_ALIGNMENT = 0
+CENTER_ALIGNMENT = 0.5
+LOREM_IPSUM = """Lorem ipsum dolor sit amet, consectetur adipiscing 
+elit. Vestibulum sit amet dolor sit amet enim ultricies iaculis eu 
+sed leo. Donec ultrices massa ut leo porttitor facilisis. Fusce 
+neque nisl, varius id vestibulum non, tincidunt eu magna. 
+Curabitur consectetur, nisl nec volutpat iaculis, odio neque 
+venenatis diam, vitae cursus lectus orci a felis. Pellentesque 
+sit amet elementum lorem. Duis tempor pulvinar augue nec bibendum. 
+Suspendisse sit amet placerat lectus."""