/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-13 20:19:31 UTC
  • mfrom: (0.8.79 main)
  • mto: (0.8.83 merge)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060913201931-23adba246d4d6529
Merge main branch.

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