Rev 537: Merge removal of glade from rename dialog. in file:///data/jelmer/bzr-gtk/trunk/

Jelmer Vernooij jelmer at samba.org
Fri Jul 18 11:32:40 BST 2008


At file:///data/jelmer/bzr-gtk/trunk/

------------------------------------------------------------
revno: 537
revision-id: jelmer at samba.org-20080718103237-md6rusj25xq1j900
parent: jelmer at samba.org-20080718102927-rjlytptxscmyolvs
parent: colbrac at xs4all.nl-20080717212416-shmcwoci88rcb1c9
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Fri 2008-07-18 12:32:37 +0200
message:
  Merge removal of glade from rename dialog.
modified:
  NEWS                           news-20070325173539-3va57o99cz3o57xe-1
  olive/__init__.py              __init__.py-20060925014013-13wdvwl8vi8gfqi1-2
  olive/remove.py                remove.py-20060721181724-0mfkrqwpsa09q1t3-2
    ------------------------------------------------------------
    revno: 533.5.1
    revision-id: colbrac at xs4all.nl-20080717212416-shmcwoci88rcb1c9
    parent: jelmer at samba.org-20080717115103-djh5sb0pvpse2zkb
    committer: Jasper Groenewegen <colbrac at xs4all.nl>
    branch nick: removedialog
    timestamp: Thu 2008-07-17 23:24:16 +0200
    message:
      Remove glade bits of OliveRemove, tweak existing (Olive)RemoveDialog
    modified:
      olive/__init__.py              __init__.py-20060925014013-13wdvwl8vi8gfqi1-2
      olive/remove.py                remove.py-20060721181724-0mfkrqwpsa09q1t3-2
=== modified file 'NEWS'
--- a/NEWS	2008-07-18 10:29:27 +0000
+++ b/NEWS	2008-07-18 10:32:37 +0000
@@ -53,7 +53,7 @@
 
   * Remove glade from merge dialog. (Jasper Groenewegen)
 
-  * Remove glade from olive about, rename dialogs. (Jasper Groenewegen)
+  * Remove glade from olive about, rename, remove dialogs. (Jasper Groenewegen)
 
 0.94.0    2008-05-04
 

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2008-07-18 10:29:27 +0000
+++ b/olive/__init__.py	2008-07-18 10:32:37 +0000
@@ -745,8 +745,8 @@
 
     def on_menuitem_remove_file_activate(self, widget):
         """ Remove (unversion) selected file. """
-        from remove import OliveRemoveDialog
-        remove = OliveRemoveDialog(self.wt, self.wtpath,
+        from bzrlib.plugins.gtk.olive.remove import RemoveDialog
+        remove = RemoveDialog(self.wt, self.wtpath,
                                    selected=self.get_selected_right(),
                                    parent=self.window)
         response = remove.run()

=== modified file 'olive/remove.py'
--- a/olive/remove.py	2008-05-05 18:16:46 +0000
+++ b/olive/remove.py	2008-07-17 21:24:16 +0000
@@ -23,76 +23,20 @@
 	pass
 
 import gtk
-import gtk.glade
 
 import bzrlib.errors as errors
 
 from bzrlib.plugins.gtk import _i18n
 from bzrlib.plugins.gtk.dialog import error_dialog, warning_dialog
-from guifiles import GLADEFILENAME
-
-
-class OliveRemove:
-    """ Display the Remove file(s) dialog and perform the needed actions. """
-    def __init__(self, wt, wtpath, selected=[]):
-        """ Initialize the Remove file(s) dialog. """
-        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_remove')
-        
-        self.window = self.glade.get_widget('window_remove')
-        
-        # Dictionary for signal_autoconnect
-        dic = { "on_button_remove_remove_clicked": self.remove,
-                "on_button_remove_cancel_clicked": self.close }
-        
-        # Connect the signals to the handlers
-        self.glade.signal_autoconnect(dic)
-        
-        self.wt = wt
-        self.wtpath = wtpath
-        self.selected = selected
-
-    def display(self):
-        """ Display the Remove file(s) dialog. """
-        self.window.show_all()
-        
-    @show_bzr_error
-    def remove(self, widget):
-        radio_selected = self.glade.get_widget('radiobutton_remove_selected')
-        radio_new = self.glade.get_widget('radiobutton_remove_new')
-        
-        if radio_selected.get_active():
-            # Remove only the selected file
-            filename = self.selected
-            
-            if filename is None:
-                error_dialog(_i18n('No file was selected'),
-                             _i18n('Please select a file from the list,\nor choose the other option.'))
-                return
-            
-            fullpath = self.wt.abspath(os.path.join(self.wtpath, filename))
-            
-            self.wt.remove(fullpath)
-        elif radio_new.get_active():
-            # Remove added files recursively
-            added = self.wt.changes_from(self.wt.basis_tree()).added
-            file_list = sorted([f[0] for f in added], reverse=True)
-            if len(file_list) == 0:
-                warning_dialog(_i18n('No matching files'),
-                               _i18n('No added files were found in the working tree.'))
-                return
-            self.wt.remove(file_list)
-        
-        self.close()
-    
-    def close(self, widget=None):
-        self.window.destroy()
-
-class OliveRemoveDialog(gtk.Dialog):
+from bzrlib.plugins.gtk.errors import show_bzr_error
+
+
+class RemoveDialog(gtk.Dialog):
     """ This class wraps the old Remove window into a gtk.Dialog. """
     
-    def __init__(self, wt, wtpath, selected=[], parent=None):
+    def __init__(self, wt, wtpath, selected='', parent=None):
         """ Initialize the Remove file(s) dialog. """
-        gtk.Dialog.__init__(self, title="Remove files - Olive",
+        gtk.Dialog.__init__(self, title="Olive - Remove files",
                                   parent=parent,
                                   flags=0,
                                   buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
@@ -104,19 +48,18 @@
         
         # Create widgets
         self._label = gtk.Label(_i18n("Which file(s) do you want to remove?"))
-        self._radio_selected = gtk.RadioButton(None, _i18n("Selected only"), False)
+        self._radio_selected = gtk.RadioButton(None, _i18n("Selected: %s"%self.selected), False)
         self._radio_added = gtk.RadioButton(self._radio_selected, _i18n("All files with status 'added'"), False)
-        self._button_remove = gtk.Button(_i18n("_Remove"), use_underline=True)
+        self._button_remove = gtk.Button(stock=gtk.STOCK_REMOVE)
         
         self._button_remove.connect('clicked', self._on_remove_clicked)
         
-        self.vbox.pack_start(self._label)
-        self.vbox.pack_end(self._radio_added)
-        self.vbox.pack_end(self._radio_selected)
-        
+        self.vbox.add(self._label)
+        self.vbox.add(self._radio_selected)
+        self.vbox.add(self._radio_added)
+        self.vbox.set_spacing(3)
         self.action_area.pack_end(self._button_remove)
         
-        self.vbox.set_spacing(3)
         self.vbox.show_all()
         
     @show_bzr_error




More information about the bazaar-commits mailing list