[Pkg-bazaar-commits] ./bzr-gtk/unstable r586: Merge Olive path change handling improvements
Jasper Groenewegen
colbrac at xs4all.nl
Fri Apr 10 07:50:46 UTC 2009
------------------------------------------------------------
revno: 586
committer: Jasper Groenewegen <colbrac at xs4all.nl>
branch nick: bzr-gtk-trunk
timestamp: Sun 2008-08-03 23:26:48 +0200
message:
Merge Olive path change handling improvements
modified:
NEWS
olive/__init__.py
olive/window.py
------------------------------------------------------------
revno: 585.1.1
committer: Jasper Groenewegen <colbrac at xs4al.nl>
branch nick: LP229044
timestamp: Sun 2008-08-03 12:07:38 +0200
message:
Improvements to path changes in Olive
Fix bug 229044 by adding PermissionDenied error check
Move creation of locationbar icon to window.py
Allow for locationbar icon to be a button so dialogs can be connected
Add info dialog to PermissionDenied error
Rework refresh_right to not double check paths and handle lock
exceptions
modified:
olive/__init__.py
olive/window.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2008-08-03 08:32:49 +0000
+++ b/NEWS 2008-08-03 21:26:48 +0000
@@ -30,6 +30,8 @@
* Show status for folders in Olive file list (Jasper Groenewegen)
* Change appearance Olive bookmarks (Jasper Groenewegen)
+
+ * Add ability to have dialog popup from Olive location bar. (Jasper Groenewegen)
BUG FIXES
@@ -69,6 +71,8 @@
* Check if file is versioned before opening gannotate window from olive. (Jasper Groenewegen, #115358)
* Make sure error/info/warning dialogs know their parent window. (Jasper Groenewegen, #252208)
+
+ * Handle unreadable .bzr subfolder in Olive. (Jasper Groenewegen, #229044)
CHANGES
=== modified file 'olive/__init__.py'
--- a/olive/__init__.py 2008-08-03 08:32:49 +0000
+++ b/olive/__init__.py 2008-08-03 10:07:38 +0000
@@ -105,7 +105,6 @@
self.button_location_up = self.window.button_location_up
self.button_location_jump = self.window.button_location_jump
self.entry_location = self.window.entry_location
- self.image_location_error = self.window.image_location_error
# Get the History widgets
self.check_history = self.window.checkbutton_history
@@ -156,25 +155,26 @@
self._just_started = False
def set_path(self, path, force_remote=False):
+ self.window.location_status.destroy()
self.notbranch = False
if force_remote:
# Forcing remote mode (reading data from inventory)
- self._show_stock_image(gtk.STOCK_DISCONNECT)
+ self.window.set_location_status(gtk.STOCK_DISCONNECT)
try:
br = Branch.open_containing(path)[0]
except bzrerrors.NotBranchError:
- self._show_stock_image(gtk.STOCK_DIALOG_ERROR)
+ self.window.set_location_status(gtk.STOCK_DIALOG_ERROR)
self.check_history.set_active(False)
self.check_history.set_sensitive(False)
return False
except bzrerrors.UnsupportedProtocol:
- self._show_stock_image(gtk.STOCK_DIALOG_ERROR)
+ self.window.set_location_status(gtk.STOCK_DIALOG_ERROR)
self.check_history.set_active(False)
self.check_history.set_sensitive(False)
return False
- self._show_stock_image(gtk.STOCK_CONNECT)
+ self.window.set_location_status(gtk.STOCK_CONNECT)
self.remote = True
@@ -203,7 +203,6 @@
self.button_location_up.set_sensitive(True)
else:
if os.path.isdir(path):
- self.image_location_error.destroy()
self.remote = False
# We're local
@@ -211,6 +210,12 @@
self.wt, self.wtpath = WorkingTree.open_containing(os.path.realpath(path))
except (bzrerrors.NotBranchError, bzrerrors.NoWorkingTree):
self.notbranch = True
+ except bzrerrors.PermissionDenied:
+ self.window.set_location_status(gtk.STOCK_DIALOG_WARNING, allowPopup=True)
+ self.window.location_status.connect_object('clicked', warning_dialog,
+ *(_i18n('Branch information unreadable'),
+ _i18n('The current folder is a branch but the .bzr folder is not readable')))
+ self.notbranch = True
# If we're in the root, we cannot go up anymore
if sys.platform == 'win32':
@@ -227,21 +232,21 @@
elif not os.path.isfile(path):
# Doesn't seem to be a file nor a directory, trying to open a
# remote location
- self._show_stock_image(gtk.STOCK_DISCONNECT)
+ self.window.set_location_status(gtk.STOCK_DISCONNECT)
try:
br = Branch.open_containing(path)[0]
except bzrerrors.NotBranchError:
- self._show_stock_image(gtk.STOCK_DIALOG_ERROR)
+ self.window.set_location_status(gtk.STOCK_DIALOG_ERROR)
self.check_history.set_active(False)
self.check_history.set_sensitive(False)
return False
except bzrerrors.UnsupportedProtocol:
- self._show_stock_image(gtk.STOCK_DIALOG_ERROR)
+ self.window.set_location_status(gtk.STOCK_DIALOG_ERROR)
self.check_history.set_active(False)
self.check_history.set_sensitive(False)
return False
- self._show_stock_image(gtk.STOCK_CONNECT)
+ self.window.set_location_status(gtk.STOCK_CONNECT)
self.remote = True
@@ -938,19 +943,14 @@
# Add the ListStore to the TreeView
self.window.treeview_left.set_model(liststore)
- def refresh_right(self, path=None):
+ def refresh_right(self):
""" Refresh the file list. """
if not self.remote:
# We're local
from bzrlib.workingtree import WorkingTree
- if path is None:
- path = self.get_path()
-
- # A workaround for double-clicking Bookmarks
- if not os.path.exists(path):
- return
-
+ path = self.get_path()
+
# Get ListStore and clear it
liststore = self.window.filelist
liststore.clear()
@@ -970,31 +970,31 @@
else:
files.append(item)
- # Try to open the working tree
- notbranch = False
- try:
- tree1 = WorkingTree.open_containing(os.path.realpath(path))[0]
- except (bzrerrors.NotBranchError, bzrerrors.NoWorkingTree):
- notbranch = True
-
- if not notbranch:
- branch = tree1.branch
- tree2 = tree1.branch.repository.revision_tree(branch.last_revision())
-
- 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)
-
+ self.window.col_status.set_visible(False)
+ if not self.notbranch:
+ try:
+ tree1 = WorkingTree.open_containing(os.path.realpath(path))[0]
+ branch = tree1.branch
+ tree2 = tree1.branch.repository.revision_tree(branch.last_revision())
+
+ delta = tree1.changes_from(tree2, want_unchanged=True)
+
+ # Show Status column
+ self.window.col_status.set_visible(True)
+ except bzrerrors.LockContention:
+ self.window.set_location_status(gtk.STOCK_DIALOG_ERROR, allowPopup=True)
+ self.window.location_status.connect_object('clicked', error_dialog,
+ *(_i18n('Branch is locked'),
+ _i18n('The branch in the current folder is locked by another Bazaar program')))
+ self.notbranch = True
+ self.window.set_view_to_localbranch(False)
+
# Add'em to the ListStore
for item in dirs:
status = ''
st = ''
fileid = ''
- if not notbranch:
+ if not self.notbranch:
filename = tree1.relpath(os.path.join(os.path.realpath(path), item))
st, status = self.statusmapper(filename, delta)
@@ -1022,7 +1022,7 @@
status = ''
st = ''
fileid = ''
- if not notbranch:
+ if not self.notbranch:
filename = tree1.relpath(os.path.join(os.path.realpath(path), item))
st, status = self.statusmapper(filename, delta)
@@ -1059,7 +1059,7 @@
dirs = []
files = []
- self._show_stock_image(gtk.STOCK_REFRESH)
+ self.window.set_location_status(gtk.STOCK_REFRESH)
for (name, type) in self.remote_entries:
if type.kind == 'directory':
@@ -1124,7 +1124,7 @@
while gtk.events_pending():
gtk.main_iteration()
- self.image_location_error.destroy()
+ self.window.location_status.destroy()
# Columns should auto-size
self.window.treeview_right.columns_autosize()
@@ -1212,7 +1212,7 @@
if active >= 0:
drive = model[active][0]
self.set_path(drive + '\\')
- self.refresh_right(drive + '\\')
+ self.refresh_right()
def check_for_changes(self):
""" Check whether there were changes in the current working tree. """
@@ -1291,19 +1291,6 @@
return True
# Either it's not a directory or not in the inventory
return False
-
- def _show_stock_image(self, stock_id):
- """ Show a stock image next to the location entry. """
- self.image_location_error.destroy()
- self.image_location_error = gtk.image_new_from_stock(stock_id, gtk.ICON_SIZE_BUTTON)
- self.hbox_location.pack_start(self.image_location_error, False, False, 0)
- if sys.platform == 'win32':
- self.hbox_location.reorder_child(self.image_location_error, 2)
- else:
- self.hbox_location.reorder_child(self.image_location_error, 1)
- self.image_location_error.show()
- while gtk.events_pending():
- gtk.main_iteration()
import ConfigParser
=== modified file 'olive/window.py'
--- a/olive/window.py 2008-08-03 08:32:49 +0000
+++ b/olive/window.py 2008-08-03 10:07:38 +0000
@@ -17,6 +17,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
+import sys
import gtk
import gobject
@@ -338,9 +339,9 @@
self.entry_location.connect("activate", self.signal.on_button_location_jump_clicked)
self.locationbar.pack_start(self.entry_location, True, True, 0)
- self.image_location_error = gtk.Image()
- self.image_location_error.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_BUTTON)
- self.locationbar.pack_start(self.image_location_error, False, False, 0)
+ self.location_status = gtk.Image()
+ self.location_status.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_BUTTON)
+ self.locationbar.pack_start(self.location_status, False, False, 0)
self.button_location_jump = gtk.Button(stock=gtk.STOCK_JUMP_TO)
self.button_location_jump.set_relief(gtk.RELIEF_NONE)
@@ -517,3 +518,20 @@
self.tb_pull.set_sensitive(False)
self.tb_push.set_sensitive(False)
self.tb_update.set_sensitive(False)
+
+ def set_location_status(self, stock_id, allowPopup=False):
+ self.location_status.destroy()
+ if allowPopup:
+ self.location_status = gtk.Button()
+ self.location_status.set_relief(gtk.RELIEF_NONE)
+ image = gtk.image_new_from_stock(stock_id, gtk.ICON_SIZE_BUTTON)
+ image.show()
+ self.location_status.add(image)
+ else:
+ self.location_status = gtk.image_new_from_stock(stock_id, gtk.ICON_SIZE_BUTTON)
+ self.locationbar.pack_start(self.location_status, False, False, 0)
+ if sys.platform == 'win32':
+ self.locationbar.reorder_child(self.location_status, 2)
+ else:
+ self.locationbar.reorder_child(self.location_status, 1)
+ self.location_status.show()
More information about the Pkg-bazaar-commits
mailing list