Refactor field and function names
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 28 Jun 2008 18:27:52 +0000 (20:27 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 28 Jun 2008 18:27:52 +0000 (20:27 +0200)
src/packages/kofoto/gkofoto/fullscreenwindow.py

index 4f2810a..6cd07ae 100644 (file)
@@ -43,21 +43,22 @@ class FullScreenWindow(gtk.Window):
         self._image_view.modify_bg(gtk.STATE_NORMAL, bg_color)
         vbox.pack_start(self._image_view)
 
-        # Add informative label.
-        self._info_label = gtk.Label()
-        self._info_label.set_text(
+        # Add end screen label.
+        label = gtk.Label()
+        label.set_text(
             "No more images.\nPress escape to get back to GKofoto.")
-        self._info_label.set_justify(gtk.JUSTIFY_CENTER)
-        self._info_label.modify_fg(gtk.STATE_NORMAL, fg_color)
-        vbox.pack_start(self._info_label)
+        label.set_justify(gtk.JUSTIFY_CENTER)
+        label.modify_fg(gtk.STATE_NORMAL, fg_color)
+        vbox.pack_start(label)
+        self._end_screen_label = label
 
-        # Add categories display field.
-        self._categories_label = gtk.Label()
-        label = self._categories_label
+        # Add image categories label.
+        label = gtk.Label()
         label.modify_fg(gtk.STATE_NORMAL, fg_color)
         vbox.pack_start(label, False)
+        self._image_categories_label = label
 
-        # Add categorization field.
+        # Add categorization form.
         self._categorization_hbox = gtk.HBox()
         self._categorization_hbox.set_spacing(5)
         vbox.pack_start(self._categorization_hbox, False)
@@ -162,17 +163,17 @@ class FullScreenWindow(gtk.Window):
     def _display_end_screen(self):
         self._maybe_cancel_load()
         self._image_view.hide()
-        self._info_label.show()
+        self._end_screen_label.show()
         self._categorization_hbox.hide_all()
-        self._categories_label.hide()
+        self._image_categories_label.hide()
 
     def _display_image(self):
         self._image_view.set_image(self._get_image_async_cb)
         self._image_view.show()
-        self._info_label.hide()
+        self._end_screen_label.hide()
         self._categorization_hbox.hide_all()
-        self._categories_label.show()
-        self._update_categories_label()
+        self._image_categories_label.show()
+        self._update_image_categories_label()
 
     def _get_image_async_cb(self, size):
         path = self._image_versions[self._current_index].getLocation()
@@ -221,7 +222,7 @@ class FullScreenWindow(gtk.Window):
             # Showing category entry -- disable bindings except escape.
             #
             if e in [(k.Escape, 0), (k.t, CTRL)]:
-                self._toggle_categorization_field()
+                self._toggle_categorization_form()
                 return True
             else:
                 return False
@@ -257,10 +258,10 @@ class FullScreenWindow(gtk.Window):
             self._image_view.zoom_to_fit()
             return True
         if e == (k.c, CTRL):
-            self._toggle_categories_field()
+            self._toggle_image_categories()
             return True
         if e == (k.t, CTRL):
-            self._toggle_categorization_field()
+            self._toggle_categorization_form()
             return True
         return False
 
@@ -284,14 +285,7 @@ class FullScreenWindow(gtk.Window):
                 else:
                     env.pixbufLoader.unload(location, size)
 
-    def _toggle_categories_field(self):
-        cl = self._categories_label
-        if cl.props.visible:
-            cl.hide()
-        else:
-            cl.show()
-
-    def _toggle_categorization_field(self):
+    def _toggle_categorization_form(self):
         if not self._image_view.props.visible:
             # Display end screen.
             return
@@ -301,14 +295,21 @@ class FullScreenWindow(gtk.Window):
             self._categorization_hbox.show_all()
             self._category_entry.grab_focus()
 
+    def _toggle_image_categories(self):
+        cl = self._image_categories_label
+        if cl.props.visible:
+            cl.hide()
+        else:
+            cl.show()
+
     def _unload(self, size):
         self._preload_or_unload(size, False)
 
-    def _update_categories_label(self):
+    def _update_image_categories_label(self):
         image = self._image_versions[self._current_index].getImage()
         categories = image.getCategories()
         texts = sorted(x.getTag() for x in categories)
         markup = u" | ".join(u"<b>%s</b>" % x for x in texts)
-        self._categories_label.set_markup(markup)
+        self._image_categories_label.set_markup(markup)
 
 gobject.type_register(FullScreenWindow) # TODO: Not needed in PyGTK 2.8.