49
48
def on_menuitem_add_files_activate(self, widget):
50
49
""" Add file(s)... menu handler. """
51
50
from add import OliveAdd
52
add = OliveAdd(self.gladefile, self.comm, self.dialog)
51
add = OliveAdd(self.gladefile, self.comm)
55
54
def on_menuitem_branch_get_activate(self, widget):
56
55
""" Branch/Get... menu handler. """
57
56
from branch import OliveBranch
58
branch = OliveBranch(self.gladefile, self.comm, self.dialog)
57
branch = OliveBranch(self.gladefile, self.comm)
61
60
def on_menuitem_branch_checkout_activate(self, widget):
62
61
""" Branch/Checkout... menu handler. """
63
62
from checkout import OliveCheckout
64
checkout = OliveCheckout(self.gladefile, self.comm, self.dialog)
63
checkout = OliveCheckout(self.gladefile, self.comm)
67
66
def on_menuitem_branch_commit_activate(self, widget):
68
67
""" Branch/Commit... menu handler. """
69
68
from commit import OliveCommit
70
commit = OliveCommit(self.gladefile, self.comm, self.dialog)
69
commit = OliveCommit(self.gladefile, self.comm)
73
72
def on_menuitem_branch_pull_activate(self, widget):
80
79
ret = update.pull(self.comm.get_path())
81
80
except errors.NotBranchError:
82
self.dialog.error_dialog(_('Directory is not a branch'),
83
_('You can perform this action only in a branch.'))
81
self.dialog.error_dialog('Directory is not a branch.')
84
82
except errors.NoLocationKnown:
85
self.dialog.error_dialog(_('Parent location is unknown'),
86
_('Pulling is not possible until there is no parent location.'))
83
self.dialog.error_dialog('Parent location is unknown.')
88
self.dialog.info_dialog(_('Pull successful'),
89
_('%d revision(s) pulled.') % ret)
85
self.dialog.info_dialog('%d revision(s) pulled.' % ret)
91
87
self.comm.set_busy(self.comm.window_main, False)
93
89
def on_menuitem_branch_push_activate(self, widget):
94
90
""" Branch/Push... menu handler. """
95
91
from push import OlivePush
96
push = OlivePush(self.gladefile, self.comm, self.dialog)
92
push = OlivePush(self.gladefile, self.comm)
99
95
def on_menuitem_branch_status_activate(self, widget):
100
96
""" Branch/Status... menu handler. """
101
97
from status import OliveStatus
102
status = OliveStatus(self.gladefile, self.comm, self.dialog)
98
status = OliveStatus(self.gladefile, self.comm)
105
101
def on_menuitem_branch_initialize_activate(self, widget):
110
106
init.init(self.comm.get_path())
111
107
except errors.AlreadyBranchError, errmsg:
112
self.dialog.error_dialog(_('Directory is already a branch'),
113
_('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
108
self.dialog.error_dialog('Directory is already a branch: %s' % errmsg)
114
109
except errors.BranchExistsWithoutWorkingTree, errmsg:
115
self.dialog.error_dialog(_('Branch without a working tree'),
116
_('The current directory (%s)\nis a branch without a working tree.') % errmsg)
110
self.dialog.error_dialog('Branch exists without a working tree: %s' % errmsg)
120
self.dialog.info_dialog(_('Ininialize successful'),
121
_('Directory successfully initialized.'))
112
self.dialog.info_dialog('Directory successfully initialized.')
122
113
self.comm.refresh_right()
124
115
def on_menuitem_file_make_directory_activate(self, widget):
125
116
""" File/Make directory... menu handler. """
126
117
from mkdir import OliveMkdir
127
mkdir = OliveMkdir(self.gladefile, self.comm, self.dialog)
118
mkdir = OliveMkdir(self.gladefile, self.comm)
130
121
def on_menuitem_file_move_activate(self, widget):
131
122
""" File/Move... menu handler. """
132
123
from move import OliveMove
133
move = OliveMove(self.gladefile, self.comm, self.dialog)
124
move = OliveMove(self.gladefile, self.comm)
136
127
def on_menuitem_file_rename_activate(self, widget):
137
128
""" File/Rename... menu handler. """
138
129
from rename import OliveRename
139
rename = OliveRename(self.gladefile, self.comm, self.dialog)
130
rename = OliveRename(self.gladefile, self.comm)
142
133
def on_menuitem_remove_file_activate(self, widget):
143
134
""" Remove (unversion) selected file. """
144
135
from remove import OliveRemove
145
remove = OliveRemove(self.gladefile, self.comm, self.dialog)
136
remove = OliveRemove(self.gladefile, self.comm)
148
139
def on_menuitem_stats_diff_activate(self, widget):
149
140
""" Statistics/Differences... menu handler. """
150
141
from diff import OliveDiff
151
diff = OliveDiff(self.gladefile, self.comm, self.dialog)
142
diff = OliveDiff(self.gladefile, self.comm)
154
def on_menuitem_stats_infos_activate(self, widget):
155
""" Statistics/Informations... menu handler. """
156
from info import OliveInfo
157
info = OliveInfo(self.gladefile, self.comm, self.dialog)
160
def on_menuitem_stats_log_activate(self, widget):
161
""" Statistics/Log... menu handler. """
162
from log import OliveLog
163
log = OliveLog(self.gladefile, self.comm, self.dialog)
166
def on_menuitem_view_refresh_activate(self, widget):
167
""" View/Refresh menu handler. """
168
# Refresh the left pane
169
self.comm.refresh_left()
170
# Refresh the right pane
171
self.comm.refresh_right()
173
def on_menuitem_view_show_hidden_files_activate(self, widget):
174
""" View/Show hidden files menu handler. """
175
if widget.get_active():
177
self.comm.pref.set_preference('dotted_files', True)
178
self.comm.pref.refresh()
179
self.comm.refresh_right()
181
# Do not show hidden files
182
self.comm.pref.set_preference('dotted_files', False)
183
self.comm.pref.refresh()
184
self.comm.refresh_right()
186
145
def on_treeview_left_button_press_event(self, widget, event):
187
146
""" Occurs when somebody right-clicks in the bookmark list. """
188
147
if event.button == 3:
204
163
def on_treeview_right_button_press_event(self, widget, event):
205
164
""" Occurs when somebody right-clicks in the file list. """
206
165
if event.button == 3:
208
m_add = self.menu.ui.get_widget('/context_right/add')
209
m_remove = self.menu.ui.get_widget('/context_right/remove')
210
m_commit = self.menu.ui.get_widget('/context_right/commit')
211
m_diff = self.menu.ui.get_widget('/context_right/diff')
212
# check if we're in a branch
213
if not is_branch(self.comm.get_path()):
214
m_add.set_sensitive(False)
215
m_remove.set_sensitive(False)
216
m_commit.set_sensitive(False)
217
m_diff.set_sensitive(False)
219
m_add.set_sensitive(True)
220
m_remove.set_sensitive(True)
221
m_commit.set_sensitive(True)
222
m_diff.set_sensitive(True)
223
166
self.menu.right_context_menu().popup(None, None, None, 0,