/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/push.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-27 17:49:18 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927174918-0e5c331b574d16a3
Don't pass along dialog context everywhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
class OlivePush:
34
34
    """ Display Push dialog and perform the needed actions. """
35
 
    def __init__(self, gladefile, comm, dialog):
 
35
    def __init__(self, gladefile, comm):
36
36
        """ Initialize the Push dialog. """
37
37
        self.gladefile = gladefile
38
38
        self.glade = gtk.glade.XML(self.gladefile, 'window_push')
39
39
        
40
40
        # Communication object
41
41
        self.comm = comm
42
 
        # Dialog object
43
 
        self.dialog = dialog
44
42
        
45
43
        self.window = self.glade.get_widget('window_push')
46
44
        
69
67
        self.entry_location.set_sensitive(0)
70
68
        self.check_remember.set_sensitive(0)
71
69
        self.check_create.set_sensitive(0)
72
 
                
 
70
        
73
71
        # Get stored location
74
72
        self.notbranch = False
75
73
        try:
85
83
    def display(self):
86
84
        """ Display the Push dialog. """
87
85
        if self.notbranch:
88
 
            self.dialog.error_dialog(_('Directory is not a branch'),
 
86
            error_dialog(_('Directory is not a branch'),
89
87
                                     _('You can perform this action only in a branch.'))
90
88
            self.close()
91
89
        else:
124
122
                revs = do_push(self.comm.get_path(),
125
123
                               overwrite=self.check_overwrite.get_active())
126
124
            except errors.NotBranchError:
127
 
                self.dialog.error_dialog(_('Directory is not a branch'),
 
125
                error_dialog(_('Directory is not a branch'),
128
126
                                         _('You can perform this action only in a branch.'))
129
127
                return
130
128
            except errors.DivergedBranches:
131
 
                self.dialog.error_dialog(_('Branches have been diverged'),
 
129
                error_dialog(_('Branches have been diverged'),
132
130
                                         _('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
133
131
                return
134
132
            except:
136
134
        elif self.radio_specific.get_active():
137
135
            location = self.entry_location.get_text()
138
136
            if location == '':
139
 
                self.dialog.error_dialog(_('No location specified'),
 
137
                error_dialog(_('No location specified'),
140
138
                                         _('Please specify a location or use the default.'))
141
139
                return
142
140
            
146
144
                               self.check_overwrite.get_active(),
147
145
                               self.check_create.get_active())
148
146
            except errors.NotBranchError:
149
 
                self.dialog.error_dialog(_('Directory is not a branch'),
 
147
                error_dialog(_('Directory is not a branch'),
150
148
                                         _('You can perform this action only in a branch.'))
151
149
                self.comm.set_busy(self.window, False)
152
150
                return
153
151
            except errors.DivergedBranches:
154
 
                self.dialog.error_dialog(_('Branches have been diverged'),
 
152
                error_dialog(_('Branches have been diverged'),
155
153
                                         _('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
156
154
                self.comm.set_busy(self.window, False)
157
155
                return
162
160
            pass
163
161
        
164
162
        self.close()
165
 
        self.dialog.info_dialog(_('Push successful'),
 
163
        info_dialog(_('Push successful'),
166
164
                                _('%d revision(s) pushed.') % revs)
167
165
    
168
166
    def test(self, widget):
219
217
    stored_loc = br_from.get_push_location()
220
218
    if location is None:
221
219
        if stored_loc is None:
222
 
            self.dialog.error_dialog(_('Push location is unknown'),
 
220
            error_dialog(_('Push location is unknown'),
223
221
                                     _('Please specify a location manually.'))
224
222
            return
225
223
        else:
244
242
                relurl = transport.relpath(location_url)
245
243
                transport.mkdir(relurl)
246
244
            except errors.NoSuchFile:
247
 
                self.dialog.error_dialog(_('Non existing parent directory'),
 
245
                error_dialog(_('Non existing parent directory'),
248
246
                                         _("The parent directory (%s)\ndoesn't exist.") % location)
249
247
                return
250
248
        else:
260
258
                    needed.append((new_transport,
261
259
                                   new_transport.relpath(transport.base)))
262
260
                    if new_transport.base == transport.base:
263
 
                        self.dialog.error_dialog(_('Path prefix not created'),
 
261
                        error_dialog(_('Path prefix not created'),
264
262
                                                 _("The path leading up to the specified location couldn't\nbe created."))
265
263
                        return
266
264
        dir_to = br_from.bzrdir.clone(location_url,