[Pkg-bazaar-commits] ./bzr-gtk/unstable r640: Fixes support with Bazaar 1.12. (Closes: #533575)

Jelmer Vernooij jelmer at samba.org
Thu Jun 18 23:53:56 UTC 2009


------------------------------------------------------------
revno: 640
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: unstable
timestamp: Fri 2009-06-19 01:53:56 +0200
message:
  Fixes support with Bazaar 1.12. (Closes: #533575)
modified:
  NEWS
  branchview/treeview.py
  commands.py
  commit.py
  debian/changelog
  debian/control
  diff.py
  revisionview.py
  tests/test_commit.py
  tests/test_linegraph.py
  tests/test_revisionview.py
  ui.py
    ------------------------------------------------------------
    revno: 621.7.18
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Tue 2009-06-09 16:12:24 +0200
    message:
      Fix import of bencode.
    modified:
      commit.py
    ------------------------------------------------------------
    revno: 621.7.19
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Tue 2009-06-09 16:15:11 +0200
    message:
      Fix import.
    modified:
      commands.py
    ------------------------------------------------------------
    revno: 621.7.20
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Tue 2009-06-09 16:51:48 +0200
    message:
      Fix more bencode imports.
    modified:
      revisionview.py
      tests/test_commit.py
      tests/test_linegraph.py
      tests/test_revisionview.py
    ------------------------------------------------------------
    revno: 621.7.21
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: fix-bencode-imports
    timestamp: Wed 2009-06-10 20:07:35 +0200
    message:
      Reorder bencode imports, prefer the new location to prevent deprecation warnings.
    modified:
      commit.py
      revisionview.py
      tests/test_commit.py
      tests/test_revisionview.py
    ------------------------------------------------------------
    revno: 621.7.22
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Fri 2009-06-12 16:22:05 +0200
    message:
      Skip setting gedit theme if it isn't set in gconf.
    modified:
      diff.py
    ------------------------------------------------------------
    revno: 621.7.23
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: trunk
    timestamp: Fri 2009-06-12 17:47:43 +0200
    message:
      (vila) Use new bzrlb progress report API
    modified:
      NEWS
      branchview/treeview.py
      ui.py
        ------------------------------------------------------------
        revno: 621.17.1
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: gtk
        timestamp: Wed 2009-06-10 18:38:37 +0200
        message:
          Fix #385191 by using the new progress reporting API.
          
          * ui.py:
          (GtkProgressBar): Simplified, we don't need to inherit from
          _BaseProgressBar.
          (GtkProgressBar.update): Show the widget.
          (ProgressBarWindow.__init__): Simplified. Don't show
          unconditionally.
          (ProgressBarWindow.update): Show the widget.
          (ProgressPanel.update): Show the widget.
          (GtkUIFactory.__init__): Simplified.
          (GtkUIFactory._progress_all_finished): 
          
          * branchview/treeview.py:
          (TreeView.__init__): Set the progress reporting widget.
        modified:
          NEWS
          branchview/treeview.py
          ui.py
        ------------------------------------------------------------
        revno: 621.17.2
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: 385191-new-pb
        timestamp: Fri 2009-06-12 11:46:44 +0200
        message:
          Address Jelmer's review.
          
          * ui.py:
          (GtkProgressBar.tick, ProgressBarWindow.tick, ProgressPanel.tick):
          Should show the widget, there may be some overlap here.
          (ProgressBarWindow.finished): Relay to the progress bar and
          destroy.
          (ProgressBarWindow.clear): Don't destroy.
          (GtkUIFactory.__init__): Default to None for the progress widget.
          (GtkUIFactory._progress_updated): Create a ProgressBarWindow if no
          widget has been set.
        modified:
          ui.py
        ------------------------------------------------------------
        revno: 621.17.3
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: gtk
        timestamp: Fri 2009-06-12 13:34:44 +0200
        message:
          Cleanup.
          
          * branchview/treeview.py:
          (TreeView.__init__): Replace the FIXME by a comment :)
        modified:
          branchview/treeview.py
          ui.py
    ------------------------------------------------------------
    revno: 621.7.24
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: trunk
    timestamp: Tue 2009-06-16 12:08:18 +0200
    message:
      (vila) Fix #385191 by using the new progress reporting API
    modified:
      branchview/treeview.py
      ui.py
        ------------------------------------------------------------
        revno: 621.17.4
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: gtk
        timestamp: Mon 2009-06-15 08:53:53 +0200
        message:
          Fix refresh warnings and progress widget usage.
          
          * branchview/treeview.py:
          (TreeView.__init__): Make the proress widget an attribute. Don't
          keep an GtkIter, they are not persistent, keep the path instead.
          (TreeView.do_get_property): Convert path to iter when needed.
          (TreeView._on_selection_changed): Memorize path, not iter.
          (TreeView.populate): Use our own widget if we can.
        modified:
          branchview/treeview.py
        ------------------------------------------------------------
        revno: 621.17.5
        committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
        branch nick: gtk
        timestamp: Mon 2009-06-15 16:02:08 +0200
        message:
          Integrater Jelmer patch and implement a more robust solution.
          
          * ui.py:
          (GtkUIFactory._progress_all_finished): *Don't* uninstall the
          widget.
          
          * branchview/treeview.py:
          (TreeView.__init__): Unconditionally install the progress widget
          that will remain active until someone else install one or the
          TreeView is destroyed.
        modified:
          branchview/treeview.py
          ui.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-05-28 15:28:13 +0000
+++ b/NEWS	2009-06-10 16:38:37 +0000
@@ -4,6 +4,9 @@
  
   * Add colored status messages in Olive file list (Jasper Groenewegen)
 
+  * Use the new progress bar implementation from bzrlib.
+   (Vincent Ladeuil, 385191)
+
  CHANGES
  
   * Add ginfo command line option (Jasper Groenewegen)

=== modified file 'branchview/treeview.py'
--- a/branchview/treeview.py	2008-08-02 20:44:17 +0000
+++ b/branchview/treeview.py	2009-06-15 14:02:08 +0000
@@ -110,10 +110,11 @@
         """
         gtk.VBox.__init__(self, spacing=0)
 
-        loading_msg_widget = ProgressPanel()
-        if getattr(ui.ui_factory, "set_nested_progress_bar_widget", None) is not None:
-            ui.ui_factory.set_nested_progress_bar_widget(loading_msg_widget.get_progress_bar)
-        self.pack_start(loading_msg_widget, expand=False, fill=True)
+        self.progress_widget = ProgressPanel()
+        self.pack_start(self.progress_widget, expand=False, fill=True)
+        if getattr(ui.ui_factory, "set_progress_bar_widget", None) is not None:
+            # We'are using our own ui, let's tell it to use our widget.
+            ui.ui_factory.set_progress_bar_widget(self.progress_widget)
 
         self.scrolled_window = gtk.ScrolledWindow()
         self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,
@@ -124,7 +125,7 @@
 
         self.scrolled_window.add(self.construct_treeview())
 
-        self.iter = None
+        self.path = None
         self.branch = branch
         self.revision = None
         self.index = {}
@@ -135,7 +136,13 @@
 
         gobject.idle_add(self.populate)
 
-        self.connect("destroy", lambda x: self.branch.unlock())
+        self.connect("destroy", self._on_destroy)
+
+    def _on_destroy(self, *ignored):
+        self.branch.unlock()
+        if getattr(ui.ui_factory, "set_progress_bar_widget", None) is not None:
+            # We'are using our own ui, let's tell it to stop using our widget.
+            ui.ui_factory.set_progress_bar_widget(None)
 
     def do_get_property(self, property):
         if property.name == 'revno-column-visible':
@@ -151,13 +158,17 @@
         elif property.name == 'branch':
             return self.branch
         elif property.name == 'revision':
-            return self.model.get_value(self.iter, treemodel.REVISION)
+            return self.model.get_value(self.model.get_iter(self.path),
+                                        treemodel.REVISION)
         elif property.name == 'revision-number':
-            return self.model.get_value(self.iter, treemodel.REVNO)
+            return self.model.get_value(self.model.get_iter(self.path),
+                                        treemodel.REVNO)
         elif property.name == 'children':
-            return self.model.get_value(self.iter, treemodel.CHILDREN)
+            return self.model.get_value(self.model.get_iter(self.path),
+                                        treemodel.CHILDREN)
         elif property.name == 'parents':
-            return self.model.get_value(self.iter, treemodel.PARENTS)
+            return self.model.get_value(self.model.get_iter(self.path),
+                                        treemodel.PARENTS)
         else:
             raise AttributeError, 'unknown property %s' % property.name
 
@@ -282,6 +293,9 @@
                        should be broken.
         """
 
+        if getattr(ui.ui_factory, "set_progress_bar_widget", None) is not None:
+            # We'are using our own ui, let's tell it to use our widget.
+            ui.ui_factory.set_progress_bar_widget(self.progress_widget)
         self.progress_bar = ui.ui_factory.nested_progress_bar()
         self.progress_bar.update("Loading ancestry graph", 0, 5)
 
@@ -411,7 +425,7 @@
         (path, focus) = treeview.get_cursor()
         if (path is not None) and (path != self._prev_cursor_path):
             self._prev_cursor_path = path # avoid emitting twice per click
-            self.iter = self.model.get_iter(path)
+            self.path = path
             self.emit('revision-selected')
 
     def _on_revision_selected(self, widget, event):

=== modified file 'commands.py'
--- a/commands.py	2009-01-30 16:03:10 +0000
+++ b/commands.py	2009-06-09 14:15:11 +0000
@@ -12,6 +12,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+import os
+
 from bzrlib import (
     branch,
     builtins,

=== modified file 'commit.py'
--- a/commit.py	2009-05-28 15:28:13 +0000
+++ b/commit.py	2009-06-10 18:07:35 +0000
@@ -33,7 +33,10 @@
     osutils,
     trace,
     )
-from bzrlib.util import bencode
+try:
+    from bzrlib import bencode
+except ImportError:
+    from bzrlib.util import bencode
 
 from bzrlib.plugins.gtk import _i18n
 from bzrlib.plugins.gtk.dialog import question_dialog

=== modified file 'debian/changelog'
--- a/debian/changelog	2009-06-08 22:36:52 +0000
+++ b/debian/changelog	2009-06-18 23:53:56 +0000
@@ -1,6 +1,7 @@
-bzr-gtk (0.95.0+bzr642-1) UNRELEASED; urgency=low
+bzr-gtk (0.95.0+bzr649-1) unstable; urgency=low
 
   * New upstream snapshot.
+   + Fixes support with Bazaar 1.12. (Closes: #533575)
 
  -- Jelmer Vernooij <jelmer at debian.org>  Tue, 09 Jun 2009 00:33:24 +0200
 

=== modified file 'debian/control'
--- a/debian/control	2009-06-08 22:34:12 +0000
+++ b/debian/control	2009-06-18 23:53:56 +0000
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Debian Bazaar Maintainers <pkg-bazaar-maint at lists.alioth.debian.org>
 Uploaders: Jelmer Vernooij <jelmer at debian.org>
-Build-Depends-Indep: bzr (>= 1.6~)
+Build-Depends-Indep: bzr (>= 1.12~)
 Build-Depends: python-central (>= 0.5), cdbs (>= 0.4.43), python, debhelper (>= 5.0.37.2), bzr-stats, python-nautilus (>= 0.5.0)
 Standards-Version: 3.8.1
 Homepage: http://bazaar-vcs.org/bzr-gtk
@@ -13,7 +13,7 @@
 
 Package: bzr-gtk
 Architecture: all
-Depends: bzr (>= 1.6~), python-gtk2 (>= 2.8), python-glade2 (>= 2.10), python-notify, ${python:Depends}, ${misc:Depends}
+Depends: bzr (>= 1.12~), python-gtk2 (>= 2.8), python-glade2 (>= 2.10), python-notify, ${python:Depends}, ${misc:Depends}
 Recommends: python-cairo (>= 1.0), bzr-dbus, seahorse, python-nautilus (>= 0.5.0), python-gnome2-desktop, python-gtksourceview2, python-gnomekeyring
 Suggests: bzr-loom, bzr-search, bzr-avahi
 Enhances: bzr, nautilus

=== modified file 'diff.py'
--- a/diff.py	2009-05-26 13:53:30 +0000
+++ b/diff.py	2009-06-12 14:22:05 +0000
@@ -95,9 +95,10 @@
 
         client = gconf.client_get_default()
         style_scheme_name = client.get_string(GEDIT_SCHEME_PATH)
-        style_scheme = gtksourceview2.StyleSchemeManager().get_scheme(style_scheme_name)
-        
-        buf.set_style_scheme(style_scheme)
+        if style_scheme_name is not None:
+            style_scheme = gtksourceview2.StyleSchemeManager().get_scheme(style_scheme_name)
+            
+            buf.set_style_scheme(style_scheme)
 
     @classmethod
     def apply_colordiff_colors(klass, buf):

=== modified file 'revisionview.py'
--- a/revisionview.py	2009-01-19 21:28:47 +0000
+++ b/revisionview.py	2009-06-10 18:07:35 +0000
@@ -24,7 +24,10 @@
 
 from bzrlib import trace
 from bzrlib.osutils import format_date
-from bzrlib.util.bencode import bdecode
+try:
+    from bzrlib.bencode import bdecode
+except ImportError:
+    from bzrlib.util.bencode import bdecode
 from bzrlib.testament import Testament
 
 from bzrlib.plugins.gtk import icon_path

=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py	2009-05-28 15:14:14 +0000
+++ b/tests/test_commit.py	2009-06-10 18:07:35 +0000
@@ -26,7 +26,10 @@
     tests,
     uncommit,
     )
-from bzrlib.util import bencode
+try:
+    from bzrlib import bencode
+except ImportError:
+    from bzrlib.util import bencode
 
 from bzrlib.plugins.gtk import commit
 

=== modified file 'tests/test_linegraph.py'
--- a/tests/test_linegraph.py	2008-06-29 15:54:40 +0000
+++ b/tests/test_linegraph.py	2009-06-09 14:51:48 +0000
@@ -24,7 +24,6 @@
 	graph,
     tests,
     )
-from bzrlib.util import bencode
 
 from bzrlib.plugins.gtk.branchview.linegraph import linegraph
 

=== modified file 'tests/test_revisionview.py'
--- a/tests/test_revisionview.py	2008-11-13 06:55:41 +0000
+++ b/tests/test_revisionview.py	2009-06-10 18:07:35 +0000
@@ -24,7 +24,10 @@
     tests,
     revision,
     )
-from bzrlib.util import bencode
+try:
+    from bzrlib import bencode
+except ImportError:
+    from bzrlib.util import bencode
 
 from bzrlib.plugins.gtk import revisionview
 

=== modified file 'ui.py'
--- a/ui.py	2008-07-25 21:07:46 +0000
+++ b/ui.py	2009-06-15 14:02:08 +0000
@@ -30,34 +30,29 @@
     """ Prompt the user for a yes/no answer. """
     def __init__(self, prompt):
         gtk.Dialog.__init__(self)
-        
+
         label = gtk.Label(prompt)
         self.vbox.pack_start(label, padding=10)
-        
         self.vbox.show_all()
 
-        self.add_buttons(gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, 
+        self.add_buttons(gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO,
                          gtk.RESPONSE_NO)
 
 
-class GtkProgressBar(gtk.ProgressBar,progress._BaseProgressBar):
-    def __init__(self, _stack=None):
+class GtkProgressBar(gtk.ProgressBar):
+
+    def __init__(self):
         gtk.ProgressBar.__init__(self)
         self.set_fraction(0.0)
-        progress._BaseProgressBar.__init__(self, _stack=_stack)
         self.current = None
         self.total = None
 
-    def clear(self):
-        self.hide()
-
     def tick(self):
+        self.show()
         self.pulse()
 
-    def child_update(self, message, current, total):
-        pass
-
     def update(self, msg=None, current_cnt=None, total_cnt=None):
+        self.show()
         if current_cnt is not None:
             self.current = current_cnt
         if total_cnt is not None:
@@ -72,76 +67,63 @@
         while gtk.events_pending():
             gtk.main_iteration()
 
+    def finished(self):
+        self.hide()
+
+    def clear(self):
+        self.hide()
+
 
 class ProgressBarWindow(gtk.Window):
-    def __init__(self, to_file=None, show_pct=None, show_spinner=None, show_eta=None, 
-                 show_bar=None, show_count=None, to_messages_file=None, _stack=None):
+
+    def __init__(self):
         super(ProgressBarWindow, self).__init__(type=gtk.WINDOW_TOPLEVEL)
-        self._stack = _stack
         self.set_border_width(0)
         self.set_title("Progress")
         self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
-        self.pb = GtkProgressBar(self)
+        self.pb = GtkProgressBar()
         self.add(self.pb)
         self.resize(250, 15)
         self.set_resizable(False)
+
+    def tick(self, *args, **kwargs):
         self.show_all()
+        self.pb.tick(*args, **kwargs)
 
-    def return_pb(self, pb):
-        self._stack.return_pb(self)
-    
     def update(self, *args, **kwargs):
+        self.show_all()
         self.pb.update(*args, **kwargs)
 
-    def tick(self, *args, **kwargs):
-        self.pb.tick(*args, **kwargs)
-
     def finished(self):
         self.pb.finished()
         self.hide_all()
- 
-    def clear(self):
-        self.pb.clear()
         self.destroy()
 
-    def child_progress(self, *args, **kwargs):
-        return self.pb.child_progress(*args, **kwargs)
-
-    def child_update(self, *args, **kwargs):
-        return self.pb.child_update(*args, **kwargs)
-
-    def get_progress_bar(self):
-        self.show_all()
-        return self
+    def clear(self):
+        self.pb.clear()
+        self.hide_all()
 
 
 class ProgressPanel(gtk.HBox):
+
     def __init__(self):
         super(ProgressPanel, self).__init__()
         image_loading = gtk.image_new_from_stock(gtk.STOCK_REFRESH,
                                                  gtk.ICON_SIZE_BUTTON)
         image_loading.show()
-        
-        self.pb = GtkProgressBar(self)
+
+        self.pb = GtkProgressBar()
         self.set_spacing(5)
-        self.set_border_width(5)        
+        self.set_border_width(5)
         self.pack_start(image_loading, False, False)
         self.pack_start(self.pb, True, True)
 
-    def return_pb(self, pb):
-        self._stack.return_pb(self)
-
-    def get_progress_bar(self, to_file=None, show_pct=None, show_spinner=None, show_eta=None, 
-                         show_bar=None, show_count=None, to_messages_file=None, 
-                         _stack=None):
-        self._stack = _stack
-        self.show_all()
-        return self
-
     def tick(self, *args, **kwargs):
+        self.show_all()
         self.pb.tick(*args, **kwargs)
-    
+
     def update(self, *args, **kwargs):
+        self.show_all()
         self.pb.update(*args, **kwargs)
 
     def finished(self):
@@ -152,30 +134,25 @@
         self.pb.clear()
         self.hide_all()
 
-    def child_progress(self, *args, **kwargs):
-        return self.pb.child_progress(*args, **kwargs)
-
-    def child_update(self, *args, **kwargs):
-        return self.pb.child_update(*args, **kwargs)
-
-
 
 class PasswordDialog(gtk.Dialog):
     """ Prompt the user for a password. """
+
     def __init__(self, prompt):
         gtk.Dialog.__init__(self)
-        
+
         label = gtk.Label(prompt)
         self.vbox.pack_start(label, padding=10)
-        
+
         self.entry = gtk.Entry()
         self.entry.set_visibility(False)
         self.vbox.pack_end(self.entry, padding=10)
-        
+
         self.vbox.show_all()
-        
-        self.add_buttons(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
-    
+
+        self.add_buttons(gtk.STOCK_OK, gtk.RESPONSE_OK,
+                         gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
+
     def _get_passwd(self):
         return self.entry.get_text()
 
@@ -185,14 +162,13 @@
 class GtkUIFactory(UIFactory):
     """A UI factory for GTK user interfaces."""
 
-    def __init__(self,
-                 stdout=None,
-                 stderr=None):
-        """Create a GtkUIFactory.
-
-        """
+    def __init__(self):
+        """Create a GtkUIFactory"""
         super(GtkUIFactory, self).__init__()
-        self.set_nested_progress_bar_widget(ProgressBarWindow)
+        self.set_progress_bar_widget(None)
+
+    def set_progress_bar_widget(self, widget):
+        self._progress_bar_widget = widget
 
     def get_boolean(self, prompt):
         """GtkDialog with yes/no answers"""
@@ -200,7 +176,7 @@
         response = dialog.run()
         dialog.destroy()
         return (response == gtk.RESPONSE_YES)
-        
+
     def get_password(self, prompt='', **kwargs):
         """Prompt the user for a password.
 
@@ -220,21 +196,18 @@
         else:
             return None
 
-    def set_nested_progress_bar_widget(self, widget):
-        self._progress_bar_stack = progress.ProgressBarStack(klass=widget)
-
-    def nested_progress_bar(self):
-        """Return a nested progress bar.
-        """
-        return self._progress_bar_stack.get_nested()
-
-    def set_progress_bar_vbox(self, vbox):
-        """Change the vbox to put progress bars in.
-        """
-        self._progress_bar_stack = vbox
-
-    def clear_term(self):
-        """Prepare the terminal for output.
-
-        It has no sense when talking about GTK."""
-        pass
+    def _progress_all_finished(self):
+        """See UIFactory._progress_all_finished"""
+        pbw = self._progress_bar_widget
+        if pbw:
+            pbw.finished()
+
+    def _progress_updated(self, task):
+        """See UIFactory._progress_updated"""
+        if self._progress_bar_widget is None:
+            # Default to a window since nobody gave us a better mean to report
+            # progress.
+            self.set_progress_bar_widget(ProgressBarWindow())
+        self._progress_bar_widget.update(task.msg,
+                                         task.current_cnt, task.total_cnt)
+



More information about the Pkg-bazaar-commits mailing list