42
42
self.gladefile = gladefile
45
self.dialog = OliveDialog(self.gladefile)
47
self.menu = OliveMenu(self.gladefile, self.comm, self.dialog)
45
self.menu = OliveMenu(self.gladefile, self.comm)
49
47
def on_about_activate(self, widget):
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)
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)
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)
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)
77
75
def on_menuitem_branch_missing_revisions_activate(self, widget):
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.'))
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.'))
103
101
ret = len(local_branch.missing_revisions(remote_branch))
106
self.dialog.info_dialog(_('There are missing revisions'),
104
info_dialog(_('There are missing revisions'),
107
105
_('%d revision(s) missing.') % ret)
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.'))
112
110
self.comm.set_busy(self.comm.window_main, False)
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.'))
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.'))
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.'))
143
141
if branch_to.get_parent() is None:
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)
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)
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)
202
self.dialog.info_dialog(_('Initialize successful'),
200
info_dialog(_('Initialize successful'),
203
201
_('Directory successfully initialized.'))
204
202
self.comm.refresh_right()
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)
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)
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)
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)
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)
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)
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)
248
246
def on_menuitem_view_refresh_activate(self, widget):