[Pkg-bazaar-commits] ./bzr-gtk/unstable r248: Merge fixes for #127392 and #127381)

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:49:26 UTC 2009


------------------------------------------------------------
revno: 248
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2007-07-23 16:38:44 +0200
message:
  Merge fixes for #127392 and #127381)
modified:
  NEWS
  cmenu.ui
  commit.py
  olive/__init__.py
  olive/menu.py
    ------------------------------------------------------------
    revno: 235.1.3
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: gtk
    timestamp: Thu 2007-07-19 16:32:53 +0200
    message:
      merged official
    modified:
      NEWS
      __init__.py
      commit.py
      diff.py
      logview.py
      preferences.py
      setup.py
      viz/branchwin.py
    ------------------------------------------------------------
    revno: 235.1.4
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: gtk
    timestamp: Sat 2007-07-21 15:16:33 +0200
    message:
      Context menu "Remove and delete added"
      Acts like "Remove" but also deletes file locally.
    modified:
      __init__.py
      cmenu.ui
      olive/menu.py
    ------------------------------------------------------------
    revno: 235.1.5
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: gtk
    timestamp: Sat 2007-07-21 15:27:52 +0200
    message:
      Missing mutter import added.
    modified:
      commit.py
    ------------------------------------------------------------
    revno: 235.1.6
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: gtk
    timestamp: Sat 2007-07-21 16:55:44 +0200
    message:
      Fixes crash when operating over files which are large enouth to have size represented by long int
      Size of dir is <DIR> now.
    modified:
      olive/__init__.py
    ------------------------------------------------------------
    revno: 235.1.7
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: gtk
    timestamp: Mon 2007-07-23 10:05:32 +0200
    message:
      merged from official repo
    modified:
      logview.py
      viz/branchwin.py
      viz/graph.py
    ------------------------------------------------------------
    revno: 235.1.8
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: gtk
    timestamp: Mon 2007-07-23 16:30:09 +0200
    message:
      check_bzrlib_version() is back.
    modified:
      __init__.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2007-07-19 14:11:55 +0000
+++ b/NEWS	2007-07-23 14:38:44 +0000
@@ -4,6 +4,13 @@
 
   * Show tags in bzr viz. (Jelmer)
 
+  * Handle large files correctly in Olive. (#127392, Mateusz Korniak)
+
+  * Support DBus being present but NetworkManager missing. (#126767, Mateusz 
+															Korniak, Jelmer)
+
+  * Add remove and delete menu item in Olive. (#127392, Mateusz Korniak)
+
  UI
   
   * Improve Preferences dialog layout. (Jelmer)

=== modified file 'cmenu.ui'
--- a/cmenu.ui	2007-05-18 16:01:10 +0000
+++ b/cmenu.ui	2007-07-21 13:16:33 +0000
@@ -2,6 +2,7 @@
     <popup name="context_right">
         <menuitem name="add" action="add" />
         <menuitem name="remove" action="remove" />
+        <menuitem name="remove_and_delete" action="remove_and_delete" />
         <menuitem name="rename" action="rename" />
         <menuitem name="open" action="open" />
         <separator />

=== modified file 'commit.py'
--- a/commit.py	2007-07-19 13:16:31 +0000
+++ b/commit.py	2007-07-23 14:38:44 +0000
@@ -26,8 +26,8 @@
 
 import os.path
 
-import bzrlib.errors as errors
-from bzrlib import osutils
+from bzrlib import errors, osutils
+from bzrlib.trace import mutter
 
 from dialog import error_dialog, question_dialog
 from errors import show_bzr_error

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2007-07-13 23:09:47 +0000
+++ b/olive/__init__.py	2007-07-21 14:55:44 +0000
@@ -853,13 +853,13 @@
     def _load_right(self):
         """ Load data into the right panel. (Filelist) """
         # Create ListStore
-        # Model: [ icon, dir, name, status text, status, size (int), size (human), mtime (int), mtime (local), fileid]
+        # Model: [ icon, dir, name, status text, status, size (int), size (human), mtime (int), mtime (local), fileid ]
         liststore = gtk.ListStore(gobject.TYPE_STRING,
                                   gobject.TYPE_BOOLEAN,
                                   gobject.TYPE_STRING,
                                   gobject.TYPE_STRING,
                                   gobject.TYPE_STRING,
-                                  gobject.TYPE_INT,
+                                  gobject.TYPE_STRING,
                                   gobject.TYPE_STRING,
                                   gobject.TYPE_INT,
                                   gobject.TYPE_STRING,
@@ -892,8 +892,8 @@
                                item,
                                '',
                                '',
-                               statinfo.st_size,
-                               self._format_size(statinfo.st_size),
+                               "<DIR>",
+                               "<DIR>",
                                statinfo.st_mtime,
                                self._format_date(statinfo.st_mtime),
                                ''])
@@ -953,7 +953,7 @@
                               item,
                               st,
                               status,
-                              statinfo.st_size,
+                              str(statinfo.st_size), # NOTE: if int used there it will fail for large files (size expressed as long int)
                               self._format_size(statinfo.st_size),
                               statinfo.st_mtime,
                               self._format_date(statinfo.st_mtime),
@@ -1179,8 +1179,8 @@
                                   item,
                                   '',
                                   '',
-                                  statinfo.st_size,
-                                  self._format_size(statinfo.st_size),
+                                  "<DIR>",
+                                  "<DIR>",
                                   statinfo.st_mtime,
                                   self._format_date(statinfo.st_mtime),
                                   ''])
@@ -1240,7 +1240,7 @@
                                   item,
                                   st,
                                   status,
-                                  statinfo.st_size,
+                                  str(statinfo.st_size),
                                   self._format_size(statinfo.st_size),
                                   statinfo.st_mtime,
                                   self._format_date(statinfo.st_mtime),
@@ -1297,8 +1297,8 @@
                                        item.name,
                                        '',
                                        '',
-                                       0,
-                                       self._format_size(0),
+                                       "<DIR>",
+                                       "<DIR>",
                                        rev.timestamp,
                                        self._format_date(rev.timestamp),
                                        ''
@@ -1314,7 +1314,7 @@
                                        item.name,
                                        '',
                                        '',
-                                       item.text_size,
+                                       str(item.text_size),
                                        self._format_size(item.text_size),
                                        rev.timestamp,
                                        self._format_date(rev.timestamp),
@@ -1416,7 +1416,15 @@
     
     def _format_size(self, size):
         """ Format size to a human readable format. """
-        return size
+        if size < 1000:
+            return "%d[B]" % (size,)
+        size = size / 1000.0
+        
+        for metric in ["kB","MB","GB","TB"]:
+            if size < 1000:
+                break
+            size = size / 1000.0
+        return "%.1f[%s]" % (size,metric) 
     
     def _format_date(self, timestamp):
         """ Format the time (given in secs) to a human readable format. """

=== modified file 'olive/menu.py'
--- a/olive/menu.py	2007-05-18 16:01:10 +0000
+++ b/olive/menu.py	2007-07-21 13:16:33 +0000
@@ -14,7 +14,9 @@
 # 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
 import os.path
+import shutil
 import sys
 
 try:
@@ -24,6 +26,7 @@
     pass
 
 import gtk
+from dialog import question_dialog
 
 import bzrlib.errors as errors
 from bzrlib.workingtree import WorkingTree
@@ -64,6 +67,10 @@
                                        _('Remove'), None,
                                        _('Remove the selected file'),
                                        self.remove_file),
+                                      ('remove_and_delete', gtk.STOCK_REMOVE,
+                                       _('Remove and delete'), None,
+                                       _('Remove the selected file/dir and delete from disk'),
+                                       self.remove_and_delete_file),
                                       ('rename', None,
                                        _('Rename'), None,
                                        _('Rename the selected file'),
@@ -201,7 +208,7 @@
             branch.unlock()
     
     @show_bzr_error
-    def remove_file(self, action):
+    def remove_file(self, action,delete_on_disk=0):
         """ Right context menu -> Remove """
         # Remove only the selected file
         directory = self.path
@@ -214,8 +221,22 @@
         
         wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
         wt.remove(path)
+        
+        if delete_on_disk:
+            abs_filename = os.path.join(directory,filename)
+            if os.path.isdir(abs_filename):
+                response = question_dialog(_('Delete directory with all directories below ?'), abs_filename )
+                if response == gtk.RESPONSE_YES:
+                    shutil.rmtree(abs_filename)
+            else:
+                os.remove(abs_filename)
+                
         self.app.set_path(self.path)
         self.app.refresh_right()
+        
+    def remove_and_delete_file(self, action):
+        """ Right context menu -> Remove and delete"""
+        self.remove_file(action,delete_on_disk=1)
 
     def rename_file(self, action):
         """ Right context menu -> Rename """



More information about the Pkg-bazaar-commits mailing list