/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: 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:
29
29
    sys.exit(1)
30
30
 
31
31
import bzrlib.errors as errors
 
32
from dialog import error_dialog
32
33
 
33
34
from launch import launch
34
35
 
35
36
class OliveMenu:
36
37
    """ This class is responsible for building the context menus. """
37
 
    def __init__(self, gladefile, comm, dialog):
 
38
    def __init__(self, gladefile, comm):
38
39
        # Load the UI file
39
40
        if sys.platform == 'win32':
40
41
            self.uifile = os.path.dirname(sys.executable) + "/share/olive/cmenu.ui"
52
53
        
53
54
        self.gladefile = gladefile
54
55
        self.comm = comm
55
 
        self.dialog = dialog
56
56
        
57
57
        # Create the file list context menu
58
58
        self.ui = gtk.UIManager()
138
138
        filename = self.comm.get_selected_right()
139
139
            
140
140
        if filename is None:
141
 
            self.dialog.error_dialog(_('No file was selected'),
 
141
            error_dialog(_('No file was selected'),
142
142
                                     _('Please select a file from the list,\nor choose the other option.'))
143
143
            return
144
144
        
145
145
        try:
146
146
            bzrlib.add.smart_add([directory + '/' + filename])
147
147
        except errors.NotBranchError:
148
 
            self.dialog.error_dialog(_('Directory is not a branch'),
 
148
            error_dialog(_('Directory is not a branch'),
149
149
                                     _('You can perform this action only in a branch.'))
150
150
            return
151
151
        
158
158
        filename = self.comm.get_selected_right()
159
159
        
160
160
        if filename is None:
161
 
            self.dialog.error_dialog(_('No file was selected'),
 
161
            error_dialog(_('No file was selected'),
162
162
                                     _('Please select a file from the list,\nor choose the other option.'))
163
163
            return
164
164
        
167
167
            wt.remove(path)
168
168
 
169
169
        except errors.NotBranchError:
170
 
            self.dialog.error_dialog(_('Directory is not a branch'),
 
170
            error_dialog(_('Directory is not a branch'),
171
171
                                     _('You can perform this action only in a branch.'))
172
172
            return
173
173
        except errors.NotVersionedError:
174
 
            self.dialog.error_dialog(_('File not versioned'),
 
174
            error_dialog(_('File not versioned'),
175
175
                                     _('The selected file is not versioned.'))
176
176
            return
177
177
        except:
185
185
        filename = self.comm.get_selected_right()
186
186
        
187
187
        if filename is None:
188
 
            self.dialog.error_dialog(_('No file was selected'),
 
188
            error_dialog(_('No file was selected'),
189
189
                                     _('Please select a file from the list,\nor choose the other option.'))
190
190
            return
191
191
 
205
205
        """ Right context menu -> Commit """
206
206
        from commit import OliveCommit
207
207
        wt, path = WorkingTree.open_containing(self.comm.get_path())
208
 
        commit = OliveCommit(self.gladefile, wt, path, self.dialog)
 
208
        commit = OliveCommit(self.gladefile, wt, path)
209
209
        commit.display()
210
210
    
211
211
    def diff(self, action):
212
212
        """ Right context menu -> Diff """
213
213
        from diff import OliveDiff
214
 
        diff = OliveDiff(self.gladefile, self.comm, self.dialog)
 
214
        diff = OliveDiff(self.gladefile, self.comm)
215
215
        diff.display()
216
216
    
217
217
    def bookmark(self, action):
218
218
        """ Right context menu -> Bookmark """
219
219
        if self.comm.pref.add_bookmark(self.comm.get_path()):
220
 
            self.dialog.info_dialog(_('Bookmark successfully added'),
 
220
            info_dialog(_('Bookmark successfully added'),
221
221
                                    _('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
222
222
        else:
223
 
            self.dialog.warning_dialog(_('Location already bookmarked'),
 
223
            warning_dialog(_('Location already bookmarked'),
224
224
                                       _('The current directory is already bookmarked.\nSee the left panel for reference.'))
225
225
        
226
226
        self.comm.refresh_left()
230
230
        from bookmark import OliveBookmark
231
231
 
232
232
        if self.comm.get_selected_left() != None:
233
 
            bookmark = OliveBookmark(self.gladefile, self.comm, self.dialog)
 
233
            bookmark = OliveBookmark(self.gladefile, self.comm)
234
234
            bookmark.display()
235
235
 
236
236
    def remove_bookmark(self, action):
254
254
    def diff_all(self, action):
255
255
        """ Diff toolbutton -> All... """
256
256
        from diff import OliveDiff
257
 
        diff = OliveDiff(self.gladefile, self.comm, self.dialog)
 
257
        diff = OliveDiff(self.gladefile, self.comm)
258
258
        diff.display()