[Pkg-bazaar-commits] ./bzr-gtk/unstable r585: Merge of Olive bookmarks makeover
Jasper Groenewegen
colbrac at xs4al.nl
Fri Apr 10 07:50:46 UTC 2009
------------------------------------------------------------
revno: 585
committer: Jasper Groenewegen <colbrac at xs4al.nl>
branch nick: trunk
timestamp: Sun 2008-08-03 10:32:49 +0200
message:
Merge of Olive bookmarks makeover
modified:
NEWS
olive/__init__.py
olive/window.py
------------------------------------------------------------
revno: 560.11.1
committer: Jasper Groenewegen <colbrac at xs4all.nl>
branch nick: redo-bookmarks
timestamp: Sun 2008-07-20 18:59:34 +0200
message:
Replace Bookmarks tree with list + folder icons
Remove code duplication issue _load_left/refresh_left by moving list creation to OliveGui
modified:
olive/__init__.py
olive/window.py
------------------------------------------------------------
revno: 560.11.2
committer: Jasper Groenewegen <colbrac at xs4all.nl>
branch nick: redo-bookmarks
timestamp: Sun 2008-07-20 19:42:17 +0200
message:
treeview_left -> window.treeview_left
modified:
olive/__init__.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2008-08-03 08:14:24 +0000
+++ b/NEWS 2008-08-03 08:32:49 +0000
@@ -28,6 +28,8 @@
* Add new dialog to browse looms and switch to threads in loom branches. (Jelmer Vernooij)
* Show status for folders in Olive file list (Jasper Groenewegen)
+
+ * Change appearance Olive bookmarks (Jasper Groenewegen)
BUG FIXES
=== modified file 'olive/__init__.py'
--- a/olive/__init__.py 2008-08-03 08:14:24 +0000
+++ b/olive/__init__.py 2008-08-03 08:32:49 +0000
@@ -96,9 +96,6 @@
# Initialize the statusbar
self.context_id = self.window.statusbar.get_context_id('olive')
- # Get the TreeViews
- self.treeview_left = self.window.treeview_left
-
# Get the drive selector
self.combobox_drive = gtk.combo_box_new_text()
self.combobox_drive.connect("changed", self._refresh_drives)
@@ -141,7 +138,7 @@
# Acceptable errors when loading files/folders in the treeviews
self.acceptable_errors = (errno.ENOENT, errno.ELOOP)
- self._load_left()
+ self.refresh_left()
# Apply menu state
self.window.mb_view_showhidden.set_active(self.pref.get_preference('dotted_files', 'bool'))
@@ -873,37 +870,7 @@
self.pref.write()
self.window.destroy()
-
- def _load_left(self):
- """ Load data into the left panel. (Bookmarks) """
- # Create TreeStore
- treestore = gtk.TreeStore(str, str)
-
- # Get bookmarks
- bookmarks = self.pref.get_bookmarks()
-
- # Add them to the TreeStore
- titer = treestore.append(None, [_i18n('Bookmarks'), None])
-
- # Get titles and sort by title
- bookmarks = [[self.pref.get_bookmark_title(item), item] for item in bookmarks]
- bookmarks.sort()
- for title_item in bookmarks:
- treestore.append(titer, title_item)
-
- # Create the column and add it to the TreeView
- self.treeview_left.set_model(treestore)
- tvcolumn_bookmark = gtk.TreeViewColumn(_i18n('Bookmark'))
- self.treeview_left.append_column(tvcolumn_bookmark)
-
- # Set up the cells
- cell = gtk.CellRendererText()
- tvcolumn_bookmark.pack_start(cell, True)
- tvcolumn_bookmark.add_attribute(cell, 'text', 0)
-
- # Expand the tree
- self.treeview_left.expand_all()
-
+
def get_selected_fileid(self):
""" Get the file_id of the selected file. """
treeselection = self.window.treeview_right.get_selection()
@@ -926,7 +893,7 @@
def get_selected_left(self):
""" Get the selected bookmark. """
- treeselection = self.treeview_left.get_selection()
+ treeselection = self.window.treeview_left.get_selection()
(model, iter) = treeselection.get_selected()
if iter is None:
@@ -952,9 +919,9 @@
def refresh_left(self):
""" Refresh the bookmark list. """
- # Get TreeStore and clear it
- treestore = self.treeview_left.get_model()
- treestore.clear()
+ # Get ListStore and clear it
+ liststore = self.window.bookmarklist
+ liststore.clear()
# Re-read preferences
self.pref.read()
@@ -962,20 +929,14 @@
# Get bookmarks
bookmarks = self.pref.get_bookmarks()
- # Add them to the TreeStore
- titer = treestore.append(None, [_i18n('Bookmarks'), None])
-
# Get titles and sort by title
- bookmarks = [[self.pref.get_bookmark_title(item), item] for item in bookmarks]
+ bookmarks = [[self.pref.get_bookmark_title(item), item, gtk.STOCK_DIRECTORY] for item in bookmarks]
bookmarks.sort()
for title_item in bookmarks:
- treestore.append(titer, title_item)
+ liststore.append(title_item)
- # Add the TreeStore to the TreeView
- self.treeview_left.set_model(treestore)
-
- # Expand the tree
- self.treeview_left.expand_all()
+ # Add the ListStore to the TreeView
+ self.window.treeview_left.set_model(liststore)
def refresh_right(self, path=None):
""" Refresh the file list. """
@@ -993,9 +954,6 @@
# Get ListStore and clear it
liststore = self.window.filelist
liststore.clear()
-
- # Show Status column
- self.window.col_status.set_visible(True)
dirs = []
files = []
@@ -1025,6 +983,12 @@
delta = tree1.changes_from(tree2, want_unchanged=True)
+ # Show Status column
+ self.window.col_status.set_visible(True)
+ else:
+ # Don't show Status column
+ self.window.col_status.set_visible(False)
+
# Add'em to the ListStore
for item in dirs:
status = ''
=== modified file 'olive/window.py'
--- a/olive/window.py 2008-08-03 08:14:24 +0000
+++ b/olive/window.py 2008-08-03 08:32:49 +0000
@@ -373,13 +373,25 @@
self.scrolledwindow_left.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.treeview_left = gtk.TreeView()
- self.treeview_left.set_headers_visible(False)
self.treeview_left.connect("button-press-event", self.signal.on_treeview_left_button_press_event)
self.treeview_left.connect("row-activated", self.signal.on_treeview_left_row_activated)
self.scrolledwindow_left.add(self.treeview_left)
- # Move olive/__init__.py _load_left List creation here
-
+ self.bookmarklist = gtk.ListStore(gobject.TYPE_STRING,
+ gobject.TYPE_STRING,
+ gobject.TYPE_STRING)
+ self.treeview_left.set_model(self.bookmarklist)
+
+ icon = gtk.CellRendererPixbuf()
+ cell = gtk.CellRendererText()
+
+ col_bookmark = gtk.TreeViewColumn(_i18n('Bookmarks'))
+ col_bookmark.pack_start(icon, False)
+ col_bookmark.pack_start(cell, False)
+ col_bookmark.set_attributes(icon, stock_id=2)
+ col_bookmark.add_attribute(cell, 'text', 0)
+ self.treeview_left.append_column(col_bookmark)
+
def _create_filelist(self):
""" Creates the file list (a ListStore in a TreeView in a ScrolledWindow)"""
self.scrolledwindow_right = gtk.ScrolledWindow()
More information about the Pkg-bazaar-commits
mailing list