/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/checkout.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-28 06:35:56 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060928063556-62ec354cb06ba38c
Update TODO
integrate the handle and communicator functions into a main class.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    pygtk.require("2.0")
22
22
except:
23
23
    pass
24
 
try:
25
 
    import gtk
26
 
    import gtk.glade
27
 
except:
28
 
    sys.exit(1)
 
24
 
 
25
import gtk
 
26
import gtk.glade
29
27
 
30
28
import bzrlib.errors as errors
31
29
 
 
30
from olive import gladefile
 
31
 
32
32
class OliveCheckout:
33
33
    """ Display checkout dialog and perform the needed operations. """
34
 
    def __init__(self, gladefile, comm, dialog):
 
34
    def __init__(self, path=None):
35
35
        """ Initialize the Checkout dialog. """
36
 
        self.gladefile = gladefile
37
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_checkout', 'olive-gtk')
38
 
        
39
 
        # Communication object
40
 
        self.comm = comm
41
 
        # Dialog object
42
 
        self.dialog = dialog
 
36
        self.glade = gtk.glade.XML(gladefile, 'window_checkout', 'olive-gtk')
43
37
        
44
38
        self.window = self.glade.get_widget('window_checkout')
45
39
        
52
46
        
53
47
        # Save FileChooser state
54
48
        self.filechooser = self.glade.get_widget('filechooserbutton_checkout')
55
 
        self.filechooser.set_filename(self.comm.get_path())
 
49
        if path is not None:
 
50
            self.filechooser.set_filename(path)
56
51
 
57
52
    def display(self):
58
53
        """ Display the Checkout dialog. """
62
57
        entry_location = self.glade.get_widget('entry_checkout_location')
63
58
        location = entry_location.get_text()
64
59
        if location is '':
65
 
            self.dialog.error_dialog(_('Missing branch location'),
 
60
            error_dialog(_('Missing branch location'),
66
61
                                     _('You must specify a branch location.'))
67
62
            return
68
63
        
75
70
        checkbutton_lightweight = self.glade.get_widget('checkbutton_checkout_lightweight')
76
71
        lightweight = checkbutton_lightweight.get_active()
77
72
        
78
 
        self.comm.set_busy(self.window)
79
73
        try:
80
74
            source = Branch.open(location)
81
75
            
114
108
            finally:
115
109
                bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
116
110
        except errors.NotBranchError, errmsg:
117
 
            self.dialog.error_dialog(_('Location is not a branch'),
 
111
            error_dialog(_('Location is not a branch'),
118
112
                                     _('The specified location has to be a branch.'))
119
 
            self.comm.set_busy(self.window, False)
120
113
            return
121
114
        except errors.TargetAlreadyExists, errmsg:
122
 
            self.dialog.error_dialog(_('Target already exists'),
 
115
            error_dialog(_('Target already exists'),
123
116
                                     _('Target directory (%s)\nalready exists. Please select another target.') % errmsg)
124
 
            self.comm.set_busy(self.window, False)
125
117
            return
126
118
        except errors.NonExistingParent, errmsg:
127
 
            self.dialog.error_dialog(_('Non existing parent directory'),
 
119
            error_dialog(_('Non existing parent directory'),
128
120
                                     _("The parent directory (%s)\ndoesn't exist.") % errmsg)
129
 
            self.comm.set_busy(self.window, False)
130
121
            return
131
 
        except:
132
 
            raise
133
122
        
134
123
        self.close()
135
124
        self.comm.refresh_right()