Added full screen view button. Reordered table and single object view
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 29 Jan 2006 17:32:18 +0000 (17:32 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 29 Jan 2006 17:32:18 +0000 (17:32 +0000)
buttons. Moved up full screen menu entry to the same section as the
other view entries.

Removed obsolete thumbnail view code.

src/gkofoto/glade/gkofoto.glade
src/packages/kofoto/gkofoto/mainwindow.py
src/packages/kofoto/gkofoto/thumbnailview.py [deleted file]

index fc2aace..91a2137 100644 (file)
                <widget class="GtkMenu" id="menubarView_menu">
 
                  <child>
-                   <widget class="GtkRadioMenuItem" id="menubarThumbnailsView">
+                   <widget class="GtkRadioMenuItem" id="menubarTableView">
                      <property name="visible">True</property>
-                     <property name="label" translatable="yes">I_cons</property>
+                     <property name="label" translatable="yes">_Table</property>
                      <property name="use_underline">True</property>
-                     <property name="active">False</property>
-                     <signal name="activate" handler="on_icons_view_activate" last_modification_time="Sun, 11 Jul 2004 19:28:48 GMT"/>
+                     <property name="active">True</property>
+                     <signal name="activate" handler="on_table_view_activate" last_modification_time="Sun, 11 Jul 2004 19:28:48 GMT"/>
                    </widget>
                  </child>
 
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">_Image</property>
                      <property name="use_underline">True</property>
-                     <property name="active">False</property>
-                     <property name="group">menubarThumbnailsView</property>
+                     <property name="active">True</property>
+                     <property name="group">menubarTableView</property>
                      <signal name="activate" handler="on_image_view_activate" last_modification_time="Sun, 11 Jul 2004 19:28:48 GMT"/>
                    </widget>
                  </child>
 
                  <child>
-                   <widget class="GtkRadioMenuItem" id="menubarTableView">
+                   <widget class="GtkMenuItem" id="menubarFullScreenView">
                      <property name="visible">True</property>
-                     <property name="label" translatable="yes">_Table</property>
+                     <property name="label" translatable="yes">_Full screen</property>
                      <property name="use_underline">True</property>
-                     <property name="active">True</property>
-                     <property name="group">menubarThumbnailsView</property>
-                     <signal name="activate" handler="on_table_view_activate" last_modification_time="Sun, 11 Jul 2004 19:28:48 GMT"/>
+                     <signal name="activate" handler="on_menubarFullScreen_activate" last_modification_time="Mon, 23 Jan 2006 17:47:59 GMT"/>
+                     <accelerator key="F11" modifiers="0" signal="activate"/>
                    </widget>
                  </child>
 
                    </widget>
                  </child>
 
-                 <child>
-                   <widget class="GtkSeparatorMenuItem" id="separator11">
-                     <property name="visible">True</property>
-                   </widget>
-                 </child>
-
-                 <child>
-                   <widget class="GtkMenuItem" id="menubarFullScreen">
-                     <property name="visible">True</property>
-                     <property name="label" translatable="yes">_Full Screen</property>
-                     <property name="use_underline">True</property>
-                     <signal name="activate" handler="on_menubarFullScreen_activate" last_modification_time="Mon, 23 Jan 2006 17:47:59 GMT"/>
-                     <accelerator key="F11" modifiers="0" signal="activate"/>
-                   </widget>
-                 </child>
-
                </widget>
              </child>
            </widget>
                  <property name="show_arrow">True</property>
 
                  <child>
-                   <widget class="GtkToggleToolButton" id="thumbnailsViewToggleButton">
+                   <widget class="GtkToggleToolButton" id="tableViewToggleButton">
                      <property name="visible">True</property>
-                     <property name="tooltip" translatable="yes">View icons</property>
-                     <property name="label" translatable="yes">Thumbnails</property>
+                     <property name="tooltip" translatable="yes">Table view</property>
+                     <property name="label" translatable="yes">Table</property>
                      <property name="use_underline">True</property>
                      <property name="visible_horizontal">True</property>
                      <property name="visible_vertical">True</property>
                      <property name="is_important">False</property>
-                     <property name="active">False</property>
+                     <property name="active">True</property>
                    </widget>
                    <packing>
                      <property name="expand">False</property>
                  <child>
                    <widget class="GtkToggleToolButton" id="objectViewToggleButton">
                      <property name="visible">True</property>
-                     <property name="tooltip" translatable="yes">View single image</property>
+                     <property name="tooltip" translatable="yes">Single image view</property>
                      <property name="label" translatable="yes">Single image</property>
                      <property name="use_underline">True</property>
                      <property name="visible_horizontal">True</property>
                  </child>
 
                  <child>
-                   <widget class="GtkToggleToolButton" id="tableViewToggleButton">
+                   <widget class="GtkToolButton" id="fullScreenViewButton">
                      <property name="visible">True</property>
-                     <property name="tooltip" translatable="yes">View table</property>
-                     <property name="label" translatable="yes">Table</property>
+                     <property name="tooltip" translatable="yes">Full screen view</property>
+                     <property name="label" translatable="yes"></property>
                      <property name="use_underline">True</property>
                      <property name="visible_horizontal">True</property>
                      <property name="visible_vertical">True</property>
                      <property name="is_important">False</property>
-                     <property name="active">True</property>
                    </widget>
                    <packing>
                      <property name="expand">False</property>
index 3ec71dd..915294f 100644 (file)
@@ -8,7 +8,6 @@ from kofoto.gkofoto.categories import Categories
 from kofoto.gkofoto.albums import Albums
 from kofoto.gkofoto.environment import env
 from kofoto.gkofoto.tableview import TableView
-from kofoto.gkofoto.thumbnailview import ThumbnailView
 from kofoto.gkofoto.singleobjectview import SingleObjectView
 from kofoto.gkofoto.objectcollectionfactory import ObjectCollectionFactory
 from kofoto.gkofoto.registerimagesdialog import RegisterImagesDialog
@@ -29,18 +28,22 @@ class MainWindow(gtk.Window):
         self.__filterEntry = env.widgets["filterEntry"]
         self.__filterEntry.set_text(self.__persistentState.filterText)
         self.__isFilterEnabledCheckbox = env.widgets["isFilterEnabledCheckbox"]
+
         env.widgets["menubarViewTreePane"].connect("toggled", self._toggleTree)
         env.widgets["menubarViewDetailsPane"].connect("toggled", self._toggleDetails)
-#        env.widgets["thumbnailsViewToggleButton"].connect("clicked", self._toggleThumbnailsView)
-        env.widgets["thumbnailsViewToggleButton"].hide()
-        env.widgets["thumbnailsViewToggleButton"].set_sensitive(False)
-        env.widgets["thumbnailsViewToggleButton"].set_icon_widget(self.getIconImage("thumbnailsview.png"))
-        env.widgets["objectViewToggleButton"].connect("clicked", self._toggleObjectView)
-        env.widgets["objectViewToggleButton"].set_icon_widget(self.getIconImage("objectview.png"))
-        env.widgets["menubarObjectView"].connect("activate", self._toggleObjectView)
+
         env.widgets["tableViewToggleButton"].connect("clicked", self._toggleTableView)
         env.widgets["tableViewToggleButton"].set_icon_widget(self.getIconImage("tableview.png"))
         env.widgets["menubarTableView"].connect("activate", self._toggleTableView)
+
+        env.widgets["objectViewToggleButton"].connect("clicked", self._toggleObjectView)
+        env.widgets["objectViewToggleButton"].set_icon_widget(self.getIconImage("objectview.png"))
+        env.widgets["menubarObjectView"].connect("activate", self._toggleObjectView)
+
+        env.widgets["fullScreenViewButton"].connect("clicked", self._fullScreen)
+        env.widgets["fullScreenViewButton"].set_icon_widget(self.getIconImage("fullscreen-24.png"))
+        env.widgets["menubarFullScreenView"].connect("activate", self._fullScreen)
+
         env.widgets["previousButton"].set_sensitive(False)
         env.widgets["nextButton"].set_sensitive(False)
         env.widgets["zoom100"].set_sensitive(False)
@@ -54,14 +57,10 @@ class MainWindow(gtk.Window):
         env.widgets["menubarRevert"].set_sensitive(False)
         env.widgets["menubarQuit"].connect("activate", env.controller.quit_cb)
 
-        env.widgets["menubarThumbnailsView"].hide()
-
         env.widgets["menubarNextImage"].set_sensitive(False)
         env.widgets["menubarPreviousImage"].set_sensitive(False)
         env.widgets["menubarZoom"].set_sensitive(False)
 
-        env.widgets["menubarFullScreen"].connect("activate", self._fullScreen)
-
         env.widgets["menubarRegisterImages"].connect("activate", self.registerImages, None)
         env.widgets["menubarHandleModifiedOrRenamedImages"].connect(
             "activate", self.handleModifiedOrRenamedImages, None)
@@ -88,7 +87,6 @@ class MainWindow(gtk.Window):
         self.__factory = ObjectCollectionFactory()
         self.__categories = Categories(self)
         self.__albums = Albums(self)
-        self.__thumbnailView = ThumbnailView()
         self.__tableView = TableView()
         self.__singleObjectView = SingleObjectView()
         self.showTableView()
@@ -165,17 +163,12 @@ class MainWindow(gtk.Window):
 
     def showTableView(self):
         self._currentView = self.__tableView
-        self._hiddenViews = [self.__thumbnailView, self.__singleObjectView]
-        self._viewChanged()
-
-    def showThumbnailView(self):
-        self._currentView = self.__thumbnailView
-        self._hiddenViews = [self.__tableView, self.__singleObjectView]
+        self._hiddenViews = [self.__singleObjectView]
         self._viewChanged()
 
     def showSingleObjectView(self):
         self._currentView = self.__singleObjectView
-        self._hiddenViews = [self.__tableView, self.__thumbnailView]
+        self._hiddenViews = [self.__tableView]
         self._viewChanged()
 
     def _fullScreen(self, *unused):
@@ -194,27 +187,12 @@ class MainWindow(gtk.Window):
         else:
             self.__singleObjectView.hideDetailsPane()
 
-    def _toggleThumbnailsView(self, button):
-        if not self._toggleLock:
-            self._toggleLock = True
-            button.set_active(True)
-            env.widgets["thumbnailsViewToggleButton"].set_active(True)
-            env.widgets["objectViewToggleButton"].set_active(False)
-            env.widgets["tableViewToggleButton"].set_active(False)
-            env.widgets["menubarThumbnailsView"].set_active(True)
-            env.widgets["menubarObjectView"].set_active(False)
-            env.widgets["menubarTableView"].set_active(False)
-            self.showThumbnailView()
-            self._toggleLock = False
-
     def _toggleObjectView(self, button):
         if not self._toggleLock:
             self._toggleLock = True
             button.set_active(True)
-            env.widgets["thumbnailsViewToggleButton"].set_active(False)
             env.widgets["objectViewToggleButton"].set_active(True)
             env.widgets["tableViewToggleButton"].set_active(False)
-            env.widgets["menubarThumbnailsView"].set_active(False)
             env.widgets["menubarObjectView"].set_active(True)
             env.widgets["menubarTableView"].set_active(False)
             self.showSingleObjectView()
@@ -224,10 +202,8 @@ class MainWindow(gtk.Window):
         if not self._toggleLock:
             self._toggleLock = True
             button.set_active(True)
-            env.widgets["thumbnailsViewToggleButton"].set_active(False)
             env.widgets["objectViewToggleButton"].set_active(False)
             env.widgets["tableViewToggleButton"].set_active(True)
-            env.widgets["menubarThumbnailsView"].set_active(False)
             env.widgets["menubarObjectView"].set_active(False)
             env.widgets["menubarTableView"].set_active(True)
             self.showTableView()
diff --git a/src/packages/kofoto/gkofoto/thumbnailview.py b/src/packages/kofoto/gkofoto/thumbnailview.py
deleted file mode 100644 (file)
index db5b0f2..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-import gtk
-from kofoto.gkofoto.objectcollectionview import ObjectCollectionView
-from kofoto.gkofoto.objectcollection import ObjectCollection
-from kofoto.gkofoto.environment import env
-
-class ThumbnailView(ObjectCollectionView):
-
-###############################################################################
-### Public
-
-    def __init__(self):
-        env.debug("Init ThumbnailView")
-##        ObjectCollectionView.__init__(self,
-##                                      env.widgets["thumbnailList"])
-        ObjectCollectionView.__init__(self,
-                                      env.widgets["thumbnailView"])
-        self.__currentMaxWidth = env.thumbnailSize[0]
-        self.__selectionLocked = False
-##        self._viewWidget.connect("select_icon", self._widgetIconSelected)
-##        self._viewWidget.connect("unselect_icon", self._widgetIconUnselected)
-
-    def importSelection(self, objectSelection):
-        if not self.__selectionLocked:
-            env.debug("ThumbnailView is importing selection.")
-            self.__selectionLocked = True
-            self._viewWidget.unselect_all()
-            for rowNr in objectSelection:
-                self._viewWidget.select_icon(rowNr)
-            self.__selectionLocked = False
-        self._updateContextMenu()
-
-    def _showHelper(self):
-        env.enter("ThumbnailView.showHelper()")
-        env.widgets["thumbnailView"].show()
-        self._viewWidget.grab_focus()
-        self.__scrollToFirstSelectedObject()
-        env.exit("ThumbnailView.showHelper()")
-
-    def _hideHelper(self):
-        env.enter("ThumbnailView.hideHelper()")
-        env.widgets["thumbnailView"].hide()
-        env.exit("ThumbnailView.hideHelper()")
-
-    def _connectObjectCollectionHelper(self):
-        env.enter("Connecting ThumbnailView to object collection")
-        # The model is loaded in thawHelper instead.
-        env.exit("Connecting ThumbnailView to object collection")
-
-    def _disconnectObjectCollectionHelper(self):
-        env.enter("Disconnecting ThumbnailView from object collection")
-        # The model is unloaded in freezeHelper instead.
-        env.exit("Disconnecting ThumbnailView from object collection")
-
-    def _freezeHelper(self):
-        env.enter("ThumbnailView.freezeHelper()")
-        self._clearAllConnections()
-        self._viewWidget.clear()
-        env.exit("ThumbnailView.freezeHelper()")
-
-    def _thawHelper(self):
-        env.enter("ThumbnailView.thawHelper()")
-        model = self._objectCollection.getModel()
-        for row in model:
-            self.__loadRow(row)
-        self._connect(model, "row_inserted",   self._rowInserted_cb)
-        self._connect(model, "row_deleted",    self._rowDeleted_cb)
-        self._connect(model, "rows_reordered", self._rowsReordered_cb)
-        self._connect(model, "row_changed",    self._rowChanged_cb)
-        env.exit("ThumbnailView.thawHelper()")
-
-###############################################################################
-### Callback functions registered by this class but invoked from other classes.
-
-    def _rowChanged_cb(self, model, path, iterator):
-        env.debug("ThumbnailView row changed.")
-        self.__selectionLocked = True
-        self._viewWidget.remove(path[0])
-        # For some reason that I don't understand model[path].path != path
-        # Hence we pass by path as the location where the icon shall be
-        # inserted.
-        self.__loadRow(model[path[0]], path[0])
-        if path[0] in self._objectCollection.getObjectSelection():
-            self._viewWidget.select_icon(path[0])
-        self.__selectionLocked = False
-
-    def _rowInserted_cb(self, model, path, iterator):
-        env.debug("ThumbnailView row inserted.")
-        self.__loadRow(model[path])
-
-    def _rowsReordered_cb(self, model, b, c, d):
-        env.debug("ThumbnailView rows reordered.")
-        # TODO I Don't know how to parse which rows that has
-        #      been reordered. Hence I must reload all rows.
-        self._viewWidget.clear()
-        for row in self._objectCollection.getModel():
-            self.__loadRow(row)
-        self.importSelection(self._objectCollection.getObjectSelection())
-
-    def _rowDeleted_cb(self, model, path):
-        env.debug("ThumbnailView row deleted.")
-        self._viewWidget.remove(path[0])
-
-    def _widgetIconSelected_cb(self, widget, index, event):
-        if not self.__selectionLocked:
-            env.enter("ThumbnailView selection changed")
-            self.__selectionLocked = True
-            self._objectCollection.getObjectSelection().addSelection(index)
-            self.__selectionLocked = False
-
-    def _widgetIconUnselected_cb(self, widget, index, event):
-        if not self.__selectionLocked:
-            env.enter("ThumbnailView selection changed")
-            self.__selectionLocked = True
-            self._objectCollection.getObjectSelection().removeSelection(index)
-            self.__selectionLocked = False
-
-###############################################################################
-### Private
-
-    def __loadRow(self, row, location=None):
-        if location is None:
-            location = row.path[0]
-        if row[ObjectCollection.COLUMN_IS_ALBUM]:
-            text = row[ObjectCollection.COLUMN_ALBUM_TAG]
-        else:
-            # TODO Let configuration decide what to show...
-            text = row[ObjectCollection.COLUMN_OBJECT_ID]
-        pixbuf = row[ObjectCollection.COLUMN_THUMBNAIL]
-        if pixbuf == None:
-            # It is possible that we get the row inserted event before
-            # the thumbnail is loaded. The temporary icon will be removed
-            # when we receive the row changed event.
-            pixbuf = env.loadingPixbuf
-        self._viewWidget.insert_pixbuf(location, pixbuf, "", str(text))
-        self.__currentMaxWidth = max(self.__currentMaxWidth, pixbuf.get_width())
-        self._viewWidget.set_icon_width(self.__currentMaxWidth)
-
-    def __scrollToFirstSelectedObject(self):
-        numberOfIcons = self._viewWidget.get_num_icons()
-        if numberOfIcons > 1:
-            # First check that the widget contains icons because I don't know
-            # how icon_is_visible() is handled if the view is empty.
-            if (self._viewWidget.icon_is_visible(0) == gtk.VISIBILITY_FULL
-                and self._viewWidget.icon_is_visible(numberOfIcons - 1) == gtk.VISIBILITY_FULL):
-                # All icons already visible. No need to scroll widget.
-                pass
-            else:
-                # Scroll widget to first selected icon
-                rowNr = self._objectCollection.getObjectSelection().getLowestSelectedRowNr()
-                if rowNr is not None:
-                    self._viewWidget.moveto(rowNr, 0.4)