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

  • Committer: Jasper Groenewegen
  • Date: 2008-07-20 13:23:29 UTC
  • mto: This revision was merged to the branch mainline in revision 560.
  • Revision ID: colbrac@xs4all.nl-20080720132329-srxnl5lf1k3z43jz
Better way to return response

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
        
199
199
        branch = wt.branch
200
200
        file_id = wt.path2id(wt.relpath(os.path.join(directory, filename)))
201
 
        if file_id is None:
202
 
            raise errors.NotVersionedError(filename)
 
201
        
203
202
        window = GAnnotateWindow(all=False, plain=False, parent=self.app)
204
203
        window.set_title(os.path.join(directory, filename) + " - Annotate")
205
204
        config = GAnnotateConfig(window)
211
210
            branch.unlock()
212
211
    
213
212
    @show_bzr_error
214
 
    def remove_file(self, action, delete_on_disk=False):
 
213
    def remove_file(self, action,delete_on_disk=0):
215
214
        """ Right context menu -> Remove """
216
215
        # Remove only the selected file
217
216
        directory = self.path
239
238
        
240
239
    def remove_and_delete_file(self, action):
241
240
        """ Right context menu -> Remove and delete"""
242
 
        self.remove_file(action, delete_on_disk=True)
 
241
        self.remove_file(action,delete_on_disk=1)
243
242
 
244
243
    def rename_file(self, action):
245
244
        """ Right context menu -> Rename """
246
 
        from bzrlib.plugins.gtk.olive.rename import RenameDialog
247
 
        wt = WorkingTree.open_containing(os.path.join(self.path, self.selected))[0]
248
 
        rename = RenameDialog(wt, wt.relpath(self.path), self.selected)
249
 
        response = rename.run()
250
 
        rename.destroy()
251
 
        if response == gtk.RESPONSE_OK:
252
 
            self.app.refresh_right()
 
245
        from rename import OliveRename
 
246
        wt = WorkingTree.open_containing(self.path + os.sep + self.selected)[0]
 
247
        rename = OliveRename(wt, wt.relpath(self.path), self.selected)
 
248
        rename.display()
253
249
    
254
250
    def open_file(self, action):
255
251
        """ Right context menu -> Open """
265
261
            # TODO: how to enter a directory?
266
262
            return
267
263
        else:
268
 
            fullpath = os.path.join(self.path, filename)
269
 
            launch.launch(fullpath) 
 
264
            fullpath = self.path + os.sep + filename
 
265
            if os.path.isdir(fullpath):
 
266
                # selected item is an existant directory
 
267
                # TODO: how to enter a directory?
 
268
                return
 
269
            else:
 
270
                launch(fullpath) 
270
271
 
271
272
    def revert(self, action):
272
273
        """ Right context menu -> Revert """
277
278
                           _i18n('Please have a look at the working tree before continuing.'))
278
279
        else:
279
280
            info_dialog(_i18n('Revert successful'),
280
 
                        _i18n('Selected file reverted to last revision.'))
 
281
                        _i18n('All files reverted to last revision.'))
281
282
        self.app.refresh_right()       
282
283
    
283
284
    def commit(self, action):
284
285
        """ Right context menu -> Commit """
285
 
        from bzrlib.plugins.gtk.commit import CommitDialog
 
286
        from commit import CommitDialog
286
287
        branch = None
287
288
        try:
288
289
            wt, path = WorkingTree.open_containing(self.path)
310
311
        wt = WorkingTree.open_containing(self.path)[0]
311
312
        window = DiffWindow(self.app)
312
313
        parent_tree = wt.branch.repository.revision_tree(wt.branch.last_revision())
313
 
        window.set_diff(wt.branch._get_nick(local=True), wt, parent_tree)
 
314
        window.set_diff(wt.branch.nick, wt, parent_tree)
314
315
        window.set_file(wt.relpath(self.path + os.sep + self.selected))
315
316
        window.show()
316
317
    
356
357
        path = self.selected
357
358
 
358
359
        if path != None:
359
 
            launch.launch(path)
 
360
            launch(path)
360
361
    
361
362
    def diff_selected(self, action):
362
363
        """ Diff toolbutton -> Selected... """
364
365
    
365
366
    def diff_all(self, action):
366
367
        """ Diff toolbutton -> All... """
367
 
        wt = WorkingTree.open_containing(self.path)[0]
368
 
        window = DiffWindow(self.app)
369
 
        parent_tree = wt.branch.repository.revision_tree(wt.branch.last_revision())
370
 
        window.set_diff(wt.branch._get_nick(local=True), wt, parent_tree)
371
 
        window.show()
 
368
        from diff import OliveDiff
 
369
        diff = OliveDiff(self.comm)
 
370
        diff.display()
372
371
    
373
372
    def view_remote(self, action):
374
373
        """ Remote context menu -> View contents """