gnome-specimen r28 - branches/import-from-bzr



Author: wbolster
Date: Tue Jun 17 18:52:18 2008
New Revision: 28
URL: http://svn.gnome.org/viewvc/gnome-specimen?rev=28&view=rev

Log:
* specimenwindow.py:
  - Added a num_previews() method and made delete_selected()
    use it.


Modified:
   branches/import-from-bzr/   (props changed)
   branches/import-from-bzr/specimenwindow.py

Modified: branches/import-from-bzr/specimenwindow.py
==============================================================================
--- branches/import-from-bzr/specimenwindow.py	(original)
+++ branches/import-from-bzr/specimenwindow.py	Tue Jun 17 18:52:18 2008
@@ -238,6 +238,11 @@
         'Clears all previews'
         self.previews_store.clear()
 
+    def num_previews(self):
+        'Returns the number of previews'
+        number_of_rows = self.previews_store.iter_n_children(None)
+        return number_of_rows / 2
+
     def delete_selected(self):
         (model, iter) = self.previews_treeview.get_selection().get_selected()
         if iter is not None:
@@ -257,10 +262,10 @@
                 # The iter is no longer valid. In our case this means the
                 # bottom row in the treeview was deleted. Set the cursor to the
                 # new bottom font name row.
-                number_of_rows = self.previews_store.iter_n_children(None)
+                num_previews = self.num_previews()
                 # Subtract 2 because all previews have 2 rows and we want the
                 # bottom name row.
-                new_path = (number_of_rows - 2,)
+                new_path = (2 * num_previews - 2,)
 
             # Finally, set the cursor. In some cases the path contains a
             # negative value. Just ignore it.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]