119
130
self.diffeditor = DiffEditor(self.diffdockwidget)
120
131
self.diffdockwidget.setWidget(self.diffeditor)
122
# "Diff Options" tool menu
123
self.diff_ignore_space_at_eol_action = add_action(self,
124
N_('Ignore changes in whitespace at EOL'),
125
self._update_diff_opts)
126
self.diff_ignore_space_at_eol_action.setCheckable(True)
128
self.diff_ignore_space_change_action = add_action(self,
129
N_('Ignore changes in amount of whitespace'),
130
self._update_diff_opts)
131
self.diff_ignore_space_change_action.setCheckable(True)
133
self.diff_ignore_all_space_action = add_action(self,
134
N_('Ignore all whitespace'),
135
self._update_diff_opts)
136
self.diff_ignore_all_space_action.setCheckable(True)
138
self.diff_function_context_action = add_action(self,
139
N_('Show whole surrounding functions of changes'),
140
self._update_diff_opts)
141
self.diff_function_context_action.setCheckable(True)
143
self.diffopts_button = create_toolbutton(text=N_('Options'),
145
tooltip=N_('Diff Options'))
146
self.diffopts_menu = create_menu(N_('Diff Options'),
147
self.diffopts_button)
149
self.diffopts_menu.addAction(self.diff_ignore_space_at_eol_action)
150
self.diffopts_menu.addAction(self.diff_ignore_space_change_action)
151
self.diffopts_menu.addAction(self.diff_ignore_all_space_action)
152
self.diffopts_menu.addAction(self.diff_function_context_action)
153
self.diffopts_button.setMenu(self.diffopts_menu)
154
self.diffopts_button.setPopupMode(QtGui.QToolButton.InstantPopup)
156
titlebar = self.diffdockwidget.titleBarWidget()
157
titlebar.add_corner_widget(self.diffopts_button)
160
self.menu_unstage_all = add_action(self,
134
self.unstage_all_action = add_action(self,
161
135
N_('Unstage All'), cmds.run(cmds.UnstageAll))
162
self.menu_unstage_all.setIcon(qtutils.icon('remove.svg'))
136
self.unstage_all_action.setIcon(qtutils.icon('remove.svg'))
164
self.menu_unstage_selected = add_action(self,
138
self.unstage_selected_action = add_action(self,
165
139
N_('Unstage From Commit'), cmds.run(cmds.UnstageSelected))
166
self.menu_unstage_selected.setIcon(qtutils.icon('remove.svg'))
140
self.unstage_selected_action.setIcon(qtutils.icon('remove.svg'))
168
self.menu_show_diffstat = add_action(self,
142
self.show_diffstat_action = add_action(self,
169
143
N_('Diffstat'), cmds.run(cmds.Diffstat), 'Alt+D')
171
self.menu_stage_modified = add_action(self,
145
self.stage_modified_action = add_action(self,
172
146
N_('Stage Changed Files To Commit'),
173
147
cmds.run(cmds.StageModified), 'Alt+A')
174
self.menu_stage_modified.setIcon(qtutils.icon('add.svg'))
148
self.stage_modified_action.setIcon(qtutils.icon('add.svg'))
176
self.menu_stage_untracked = add_action(self,
150
self.stage_untracked_action = add_action(self,
177
151
N_('Stage All Untracked'),
178
152
cmds.run(cmds.StageUntracked), 'Alt+U')
179
self.menu_stage_untracked.setIcon(qtutils.icon('add.svg'))
181
self.menu_export_patches = add_action(self,
153
self.stage_untracked_action.setIcon(qtutils.icon('add.svg'))
155
self.apply_patches_action = add_action(self,
156
N_('Apply Patches...'), apply_patches)
158
self.export_patches_action = add_action(self,
182
159
N_('Export Patches...'), guicmds.export_patches, 'Alt+E')
184
self.new_repository = add_action(self,
161
self.new_repository_action = add_action(self,
185
162
N_('New Repository...'), guicmds.open_new_repo)
186
self.new_repository.setIcon(qtutils.new_icon())
163
self.new_repository_action.setIcon(qtutils.new_icon())
188
self.menu_preferences = add_action(self,
165
self.preferences_action = add_action(self,
189
166
N_('Preferences'), self.preferences,
190
167
QtGui.QKeySequence.Preferences, 'Ctrl+O')
192
self.menu_edit_remotes = add_action(self,
193
N_('Edit Remotes...'), lambda: editremotes.edit().exec_())
194
self.menu_rescan = add_action(self,
169
self.edit_remotes_action = add_action(self,
170
N_('Edit Remotes...'), lambda: editremotes.remote_editor().exec_())
171
self.rescan_action = add_action(self,
195
172
cmds.Refresh.name(),
196
173
cmds.run(cmds.Refresh),
197
174
cmds.Refresh.SHORTCUT)
198
self.menu_rescan.setIcon(qtutils.reload_icon())
175
self.rescan_action.setIcon(qtutils.reload_icon())
200
self.menu_browse_recent = add_action(self,
177
self.browse_recently_modified_action = add_action(self,
201
178
N_('Recently Modified Files...'),
202
browse_recent, 'Shift+Ctrl+E')
179
browse_recent_files, 'Shift+Ctrl+E')
204
self.menu_cherry_pick = add_action(self,
181
self.cherry_pick_action = add_action(self,
205
182
N_('Cherry-Pick...'),
206
183
guicmds.cherry_pick, 'Ctrl+P')
208
self.menu_load_commitmsg = add_action(self,
185
self.load_commitmsg_action = add_action(self,
209
186
N_('Load Commit Message...'), guicmds.load_commitmsg)
211
self.menu_save_tarball = add_action(self,
188
self.save_tarball_action = add_action(self,
212
189
N_('Save As Tarball/Zip...'), self.save_archive)
214
self.menu_quit = add_action(self,
191
self.quit_action = add_action(self,
215
192
N_('Quit'), self.close, 'Ctrl+Q')
216
self.menu_manage_bookmarks = add_action(self,
217
N_('Bookmarks...'), manage_bookmarks)
218
self.menu_grep = add_action(self,
219
N_('Grep'), guicmds.grep, 'Ctrl+G')
220
self.menu_merge_local = add_action(self,
193
self.manage_bookmarks_action = add_action(self,
194
N_('Bookmarks...'), self.manage_bookmarks)
195
self.grep_action = add_action(self,
196
N_('Grep'), grep, 'Ctrl+G')
197
self.merge_local_action = add_action(self,
221
198
N_('Merge...'), merge.local_merge)
223
self.menu_merge_abort = add_action(self,
200
self.merge_abort_action = add_action(self,
224
201
N_('Abort Merge...'), merge.abort_merge)
226
self.menu_fetch = add_action(self,
203
self.fetch_action = add_action(self,
227
204
N_('Fetch...'), remote.fetch)
228
self.menu_push = add_action(self,
205
self.push_action = add_action(self,
229
206
N_('Push...'), remote.push)
230
self.menu_pull = add_action(self,
207
self.pull_action = add_action(self,
231
208
N_('Pull...'), remote.pull)
233
self.menu_open_repo = add_action(self,
210
self.open_repo_action = add_action(self,
234
211
N_('Open...'), guicmds.open_repo)
235
self.menu_open_repo.setIcon(qtutils.open_icon())
237
self.menu_stash = add_action(self,
212
self.open_repo_action.setIcon(qtutils.open_icon())
214
self.open_repo_new_action = add_action(self,
215
N_('Open in New Window...'), guicmds.open_repo_in_new_window)
216
self.open_repo_new_action.setIcon(qtutils.open_icon())
218
self.stash_action = add_action(self,
238
219
N_('Stash...'), stash, 'Alt+Shift+S')
240
self.menu_clone_repo = add_action(self,
221
self.clone_repo_action = add_action(self,
241
222
N_('Clone...'), guicmds.clone_repo)
242
self.menu_clone_repo.setIcon(qtutils.git_icon())
223
self.clone_repo_action.setIcon(qtutils.git_icon())
244
self.menu_help_docs = add_action(self,
225
self.help_docs_action = add_action(self,
245
226
N_('Documentation'), resources.show_html_docs,
246
227
QtGui.QKeySequence.HelpContents)
248
self.menu_help_shortcuts = add_action(self,
229
self.help_shortcuts_action = add_action(self,
249
230
N_('Keyboard Shortcuts'),
251
232
QtCore.Qt.Key_Question)
253
self.menu_visualize_current = add_action(self,
234
self.visualize_current_action = add_action(self,
254
235
N_('Visualize Current Branch...'),
255
236
cmds.run(cmds.VisualizeCurrent))
256
self.menu_visualize_all = add_action(self,
237
self.visualize_all_action = add_action(self,
257
238
N_('Visualize All Branches...'),
258
239
cmds.run(cmds.VisualizeAll))
259
self.menu_search_commits = add_action(self,
240
self.search_commits_action = add_action(self,
260
241
N_('Search...'), search)
261
self.menu_browse_branch = add_action(self,
242
self.browse_branch_action = add_action(self,
262
243
N_('Browse Current Branch...'), guicmds.browse_current)
263
self.menu_browse_other_branch = add_action(self,
244
self.browse_other_branch_action = add_action(self,
264
245
N_('Browse Other Branch...'), guicmds.browse_other)
265
self.menu_load_commitmsg_template = add_action(self,
246
self.load_commitmsg_template_action = add_action(self,
266
247
N_('Get Commit Message Template'),
267
248
cmds.run(cmds.LoadCommitMessageFromTemplate))
268
self.menu_help_about = add_action(self,
249
self.help_about_action = add_action(self,
269
250
N_('About'), launch_about_dialog)
271
self.menu_diff_expression = add_action(self,
252
self.diff_expression_action = add_action(self,
272
253
N_('Expression...'), guicmds.diff_expression)
273
self.menu_branch_compare = add_action(self,
254
self.branch_compare_action = add_action(self,
274
255
N_('Branches...'), compare_branches)
276
self.menu_create_tag = add_action(self,
257
self.create_tag_action = add_action(self,
277
258
N_('Create Tag...'), create_tag)
279
self.menu_create_branch = add_action(self,
260
self.create_branch_action = add_action(self,
280
261
N_('Create...'), create_new_branch, 'Ctrl+B')
282
self.menu_delete_branch = add_action(self,
263
self.delete_branch_action = add_action(self,
283
264
N_('Delete...'), guicmds.delete_branch)
285
self.menu_delete_remote_branch = add_action(self,
266
self.delete_remote_branch_action = add_action(self,
286
267
N_('Delete Remote Branch...'), guicmds.delete_remote_branch)
288
self.menu_checkout_branch = add_action(self,
269
self.checkout_branch_action = add_action(self,
289
270
N_('Checkout...'), guicmds.checkout_branch, 'Alt+B')
290
self.menu_branch_review = add_action(self,
271
self.branch_review_action = add_action(self,
291
272
N_('Review...'), guicmds.review_branch)
293
self.menu_browse = add_action(self,
274
self.browse_action = add_action(self,
294
275
N_('Browser...'), worktree_browser)
295
self.menu_browse.setIcon(qtutils.git_icon())
276
self.browse_action.setIcon(qtutils.git_icon())
297
self.menu_dag = add_action(self,
278
self.dag_action = add_action(self,
298
279
N_('DAG...'), lambda: git_dag(self.model).show())
299
self.menu_dag.setIcon(qtutils.git_icon())
280
self.dag_action.setIcon(qtutils.git_icon())
301
282
self.rebase_start_action = add_action(self,
302
283
N_('Start Interactive Rebase...'), self.rebase_start)
333
315
self.file_menu = create_menu(N_('File'), self.menubar)
334
self.file_menu.addAction(self.new_repository)
335
self.file_menu.addAction(self.menu_open_repo)
336
self.menu_open_recent = self.file_menu.addMenu(N_('Open Recent'))
337
self.file_menu.addSeparator()
338
self.file_menu.addAction(self.menu_clone_repo)
339
self.file_menu.addAction(self.menu_manage_bookmarks)
340
self.file_menu.addSeparator()
341
self.file_menu.addAction(self.menu_edit_remotes)
342
self.file_menu.addAction(self.menu_rescan)
343
self.file_menu.addSeparator()
344
self.file_menu.addAction(self.menu_browse_recent)
345
self.file_menu.addSeparator()
346
self.file_menu.addAction(self.menu_load_commitmsg)
347
self.file_menu.addAction(self.menu_load_commitmsg_template)
348
self.file_menu.addSeparator()
349
self.file_menu.addAction(self.menu_save_tarball)
350
self.file_menu.addAction(self.menu_export_patches)
351
self.file_menu.addSeparator()
352
self.file_menu.addAction(self.menu_preferences)
353
self.file_menu.addAction(self.menu_quit)
316
self.open_recent_menu = self.file_menu.addMenu(N_('Open Recent'))
317
self.open_recent_menu.setIcon(qtutils.open_icon())
318
self.file_menu.addAction(self.open_repo_action)
319
self.file_menu.addAction(self.open_repo_new_action)
320
self.file_menu.addAction(self.clone_repo_action)
321
self.file_menu.addAction(self.new_repository_action)
322
self.file_menu.addSeparator()
323
self.file_menu.addAction(self.rescan_action)
324
self.file_menu.addAction(self.edit_remotes_action)
325
self.file_menu.addAction(self.browse_recently_modified_action)
326
self.file_menu.addAction(self.manage_bookmarks_action)
327
self.file_menu.addSeparator()
328
self.file_menu.addAction(self.load_commitmsg_action)
329
self.file_menu.addAction(self.load_commitmsg_template_action)
330
self.file_menu.addSeparator()
331
self.file_menu.addAction(self.apply_patches_action)
332
self.file_menu.addAction(self.export_patches_action)
333
self.file_menu.addAction(self.save_tarball_action)
334
self.file_menu.addSeparator()
335
self.file_menu.addAction(self.preferences_action)
336
self.file_menu.addAction(self.quit_action)
354
337
self.menubar.addAction(self.file_menu.menuAction())
357
340
self.actions_menu = create_menu(N_('Actions'), self.menubar)
358
self.actions_menu.addAction(self.menu_fetch)
359
self.actions_menu.addAction(self.menu_push)
360
self.actions_menu.addAction(self.menu_pull)
361
self.actions_menu.addAction(self.menu_stash)
362
self.actions_menu.addSeparator()
363
self.actions_menu.addAction(self.menu_create_tag)
364
self.actions_menu.addAction(self.menu_cherry_pick)
365
self.actions_menu.addAction(self.menu_merge_local)
366
self.actions_menu.addAction(self.menu_merge_abort)
367
self.actions_menu.addSeparator()
368
self.actions_menu.addAction(self.menu_grep)
369
self.actions_menu.addAction(self.menu_search_commits)
341
self.actions_menu.addAction(self.fetch_action)
342
self.actions_menu.addAction(self.push_action)
343
self.actions_menu.addAction(self.pull_action)
344
self.actions_menu.addAction(self.stash_action)
345
self.actions_menu.addSeparator()
346
self.actions_menu.addAction(self.create_tag_action)
347
self.actions_menu.addAction(self.cherry_pick_action)
348
self.actions_menu.addAction(self.merge_local_action)
349
self.actions_menu.addAction(self.merge_abort_action)
350
self.actions_menu.addSeparator()
351
self.actions_menu.addAction(self.grep_action)
352
self.actions_menu.addAction(self.search_commits_action)
370
353
self.menubar.addAction(self.actions_menu.menuAction())
373
356
self.commit_menu = create_menu(N_('Index'), self.menubar)
374
357
self.commit_menu.setTitle(N_('Index'))
375
self.commit_menu.addAction(self.menu_stage_modified)
376
self.commit_menu.addAction(self.menu_stage_untracked)
358
self.commit_menu.addAction(self.stage_modified_action)
359
self.commit_menu.addAction(self.stage_untracked_action)
377
360
self.commit_menu.addSeparator()
378
self.commit_menu.addAction(self.menu_unstage_all)
379
self.commit_menu.addAction(self.menu_unstage_selected)
361
self.commit_menu.addAction(self.unstage_all_action)
362
self.commit_menu.addAction(self.unstage_selected_action)
380
363
self.menubar.addAction(self.commit_menu.menuAction())
383
366
self.diff_menu = create_menu(N_('Diff'), self.menubar)
384
self.diff_menu.addAction(self.menu_diff_expression)
385
self.diff_menu.addAction(self.menu_branch_compare)
367
self.diff_menu.addAction(self.diff_expression_action)
368
self.diff_menu.addAction(self.branch_compare_action)
386
369
self.diff_menu.addSeparator()
387
self.diff_menu.addAction(self.menu_show_diffstat)
370
self.diff_menu.addAction(self.show_diffstat_action)
388
371
self.menubar.addAction(self.diff_menu.menuAction())
391
374
self.branch_menu = create_menu(N_('Branch'), self.menubar)
392
self.branch_menu.addAction(self.menu_branch_review)
393
self.branch_menu.addSeparator()
394
self.branch_menu.addAction(self.menu_create_branch)
395
self.branch_menu.addAction(self.menu_checkout_branch)
396
self.branch_menu.addAction(self.menu_delete_branch)
397
self.branch_menu.addAction(self.menu_delete_remote_branch)
398
self.branch_menu.addSeparator()
399
self.branch_menu.addAction(self.menu_browse_branch)
400
self.branch_menu.addAction(self.menu_browse_other_branch)
401
self.branch_menu.addSeparator()
402
self.branch_menu.addAction(self.menu_visualize_current)
403
self.branch_menu.addAction(self.menu_visualize_all)
375
self.branch_menu.addAction(self.branch_review_action)
376
self.branch_menu.addSeparator()
377
self.branch_menu.addAction(self.create_branch_action)
378
self.branch_menu.addAction(self.checkout_branch_action)
379
self.branch_menu.addAction(self.delete_branch_action)
380
self.branch_menu.addAction(self.delete_remote_branch_action)
381
self.branch_menu.addSeparator()
382
self.branch_menu.addAction(self.browse_branch_action)
383
self.branch_menu.addAction(self.browse_other_branch_action)
384
self.branch_menu.addSeparator()
385
self.branch_menu.addAction(self.visualize_current_action)
386
self.branch_menu.addAction(self.visualize_all_action)
404
387
self.menubar.addAction(self.branch_menu.menuAction())