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

  • Committer: Jelmer Vernooij
  • Date: 2006-09-27 17:38:39 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927173839-d584816beceed69a
Start removing dialog context (it's not required).

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
from bzrlib.branch import Branch
33
33
from bzrlib.workingtree import WorkingTree
34
34
 
35
 
from dialog import OliveDialog
 
35
from dialog import about, error_dialog, info_dialog
36
36
from menu import OliveMenu
37
37
from launch import launch
38
38
 
42
42
        self.gladefile = gladefile
43
43
        self.comm = comm
44
44
        
45
 
        self.dialog = OliveDialog(self.gladefile)
46
 
        
47
 
        self.menu = OliveMenu(self.gladefile, self.comm, self.dialog)
 
45
        self.menu = OliveMenu(self.gladefile, self.comm)
48
46
    
49
47
    def on_about_activate(self, widget):
50
 
        self.dialog.about()
 
48
        about()
51
49
        
52
50
    def on_menuitem_add_files_activate(self, widget):
53
51
        """ Add file(s)... menu handler. """
54
52
        from add import OliveAdd
55
 
        add = OliveAdd(self.gladefile, self.comm, self.dialog)
 
53
        add = OliveAdd(self.gladefile, self.comm)
56
54
        add.display()
57
55
    
58
56
    def on_menuitem_branch_get_activate(self, widget):
59
57
        """ Branch/Get... menu handler. """
60
58
        from branch import OliveBranch
61
 
        branch = OliveBranch(self.gladefile, self.comm, self.dialog)
 
59
        branch = OliveBranch(self.gladefile, self.comm)
62
60
        branch.display()
63
61
    
64
62
    def on_menuitem_branch_checkout_activate(self, widget):
65
63
        """ Branch/Checkout... menu handler. """
66
64
        from checkout import OliveCheckout
67
 
        checkout = OliveCheckout(self.gladefile, self.comm, self.dialog)
 
65
        checkout = OliveCheckout(self.gladefile, self.comm)
68
66
        checkout.display()
69
67
    
70
68
    def on_menuitem_branch_commit_activate(self, widget):
71
69
        """ Branch/Commit... menu handler. """
72
70
        from commit import OliveCommit
73
71
        wt, path = WorkingTree.open_containing(self.comm.get_path())
74
 
        commit = OliveCommit(self.gladefile, wt, path, self.dialog)
 
72
        commit = OliveCommit(self.gladefile, wt, path)
75
73
        commit.display()
76
74
    
77
75
    def on_menuitem_branch_missing_revisions_activate(self, widget):
85
83
            try:
86
84
                local_branch = Branch.open_containing(self.comm.get_path())[0]
87
85
            except NotBranchError:
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
                return
91
89
            
92
90
            other_branch = local_branch.get_parent()
93
91
            if other_branch is None:
94
 
                self.dialog.error_dialog(_('Parent location is unknown'),
 
92
                error_dialog(_('Parent location is unknown'),
95
93
                                         _('Cannot determine missing revisions if no parent location is known.'))
96
94
                return
97
95
            
103
101
            ret = len(local_branch.missing_revisions(remote_branch))
104
102
 
105
103
            if ret > 0:
106
 
                self.dialog.info_dialog(_('There are missing revisions'),
 
104
                info_dialog(_('There are missing revisions'),
107
105
                                        _('%d revision(s) missing.') % ret)
108
106
            else:
109
 
                self.dialog.info_dialog(_('Local branch up to date'),
 
107
                info_dialog(_('Local branch up to date'),
110
108
                                        _('There are no missing revisions.'))
111
109
        finally:
112
110
            self.comm.set_busy(self.comm.window_main, False)
125
123
                tree_to = None
126
124
                branch_to = Branch.open_containing(self.comm.get_path())[0]
127
125
            except errors.NotBranchError:
128
 
                 self.dialog.error_dialog(_('Directory is not a branch'),
 
126
                 error_dialog(_('Directory is not a branch'),
129
127
                                         _('You can perform this action only in a branch.'))
130
128
 
131
129
            location = branch_to.get_parent()
132
130
            if location is None:
133
 
                self.dialog.error_dialog(_('Parent location is unknown'),
 
131
                error_dialog(_('Parent location is unknown'),
134
132
                                         _('Pulling is not possible until there is a parent location.'))
135
133
                return
136
134
 
137
135
            try:
138
136
                branch_from = Branch.open(location)
139
137
            except errors.NotBranchError:
140
 
                self.dialog.error_dialog(_('Directory is not a branch'),
 
138
                error_dialog(_('Directory is not a branch'),
141
139
                                         _('You can perform this action only in a branch.'))
142
140
 
143
141
            if branch_to.get_parent() is None:
149
147
            else:
150
148
                branch_to.pull(branch_from)
151
149
            
152
 
            self.dialog.info_dialog(_('Pull successful'),
 
150
            info_dialog(_('Pull successful'),
153
151
                                    _('%d revision(s) pulled.') % ret)
154
152
            
155
153
        finally:
158
156
    def on_menuitem_branch_push_activate(self, widget):
159
157
        """ Branch/Push... menu handler. """
160
158
        from push import OlivePush
161
 
        push = OlivePush(self.gladefile, self.comm, self.dialog)
 
159
        push = OlivePush(self.gladefile, self.comm)
162
160
        push.display()
163
161
    
164
162
    def on_menuitem_branch_status_activate(self, widget):
165
163
        """ Branch/Status... menu handler. """
166
164
        from status import OliveStatus
167
165
        wt, wtpath = WorkingTree.open_containing(self.comm.get_path())
168
 
        status = OliveStatus(self.gladefile, wt, wtpath, self.dialog)
 
166
        status = OliveStatus(self.gladefile, wt, wtpath)
169
167
        status.display()
170
168
    
171
169
    def on_menuitem_branch_initialize_activate(self, widget):
193
191
                    existing_bzrdir.create_branch()
194
192
                    existing_bzrdir.create_workingtree()
195
193
        except errors.AlreadyBranchError, errmsg:
196
 
            self.dialog.error_dialog(_('Directory is already a branch'),
 
194
            error_dialog(_('Directory is already a branch'),
197
195
                                     _('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
198
196
        except errors.BranchExistsWithoutWorkingTree, errmsg:
199
 
            self.dialog.error_dialog(_('Branch without a working tree'),
 
197
            error_dialog(_('Branch without a working tree'),
200
198
                                     _('The current directory (%s)\nis a branch without a working tree.') % errmsg)
201
199
        else:
202
 
            self.dialog.info_dialog(_('Initialize successful'),
 
200
            info_dialog(_('Initialize successful'),
203
201
                                    _('Directory successfully initialized.'))
204
202
            self.comm.refresh_right()
205
203
        
206
204
    def on_menuitem_file_make_directory_activate(self, widget):
207
205
        """ File/Make directory... menu handler. """
208
206
        from mkdir import OliveMkdir
209
 
        mkdir = OliveMkdir(self.gladefile, self.comm, self.dialog)
 
207
        mkdir = OliveMkdir(self.gladefile, self.comm)
210
208
        mkdir.display()
211
209
    
212
210
    def on_menuitem_file_move_activate(self, widget):
213
211
        """ File/Move... menu handler. """
214
212
        from move import OliveMove
215
 
        move = OliveMove(self.gladefile, self.comm, self.dialog)
 
213
        move = OliveMove(self.gladefile, self.comm)
216
214
        move.display()
217
215
    
218
216
    def on_menuitem_file_rename_activate(self, widget):
219
217
        """ File/Rename... menu handler. """
220
218
        from rename import OliveRename
221
 
        rename = OliveRename(self.gladefile, self.comm, self.dialog)
 
219
        rename = OliveRename(self.gladefile, self.comm)
222
220
        rename.display()
223
221
 
224
222
    def on_menuitem_remove_file_activate(self, widget):
225
223
        """ Remove (unversion) selected file. """
226
224
        from remove import OliveRemove
227
 
        remove = OliveRemove(self.gladefile, self.comm, self.dialog)
 
225
        remove = OliveRemove(self.gladefile, self.comm)
228
226
        remove.display()
229
227
    
230
228
    def on_menuitem_stats_diff_activate(self, widget):
231
229
        """ Statistics/Differences... menu handler. """
232
230
        from diff import OliveDiff
233
 
        diff = OliveDiff(self.gladefile, self.comm, self.dialog)
 
231
        diff = OliveDiff(self.gladefile, self.comm)
234
232
        diff.display()
235
233
    
236
234
    def on_menuitem_stats_infos_activate(self, widget):
237
235
        """ Statistics/Informations... menu handler. """
238
236
        from info import OliveInfo
239
 
        info = OliveInfo(self.gladefile, self.comm, self.dialog)
 
237
        info = OliveInfo(self.gladefile, self.comm)
240
238
        info.display()
241
239
    
242
240
    def on_menuitem_stats_log_activate(self, widget):
243
241
        """ Statistics/Log... menu handler. """
244
242
        from log import OliveLog
245
 
        log = OliveLog(self.gladefile, self.comm, self.dialog)
 
243
        log = OliveLog(self.gladefile, self.comm)
246
244
        log.display()
247
245
    
248
246
    def on_menuitem_view_refresh_activate(self, widget):
345
343
        self.comm.pref.write()
346
344
        self.comm.window_main.destroy()
347
345
 
348
 
    def not_implemented(self, widget):
349
 
        """ Display a Not implemented error message. """
350
 
        self.dialog.error_dialog(_('We feel sorry'),
351
 
                                 _('This feature is not yet implemented.'))
352
346