31
31
import bzrlib.errors as errors
32
from dialog import error_dialog
33
34
from launch import launch
36
37
""" This class is responsible for building the context menus. """
37
def __init__(self, gladefile, comm, dialog):
38
def __init__(self, gladefile, comm):
39
40
if sys.platform == 'win32':
40
41
self.uifile = os.path.dirname(sys.executable) + "/share/olive/cmenu.ui"
138
138
filename = self.comm.get_selected_right()
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.'))
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.'))
158
158
filename = self.comm.get_selected_right()
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.'))
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.'))
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.'))
185
185
filename = self.comm.get_selected_right()
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.'))
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)
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)
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.'))
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.'))
226
226
self.comm.refresh_left()
230
230
from bookmark import OliveBookmark
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()
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)