cola.controllers.main – Main application controller
Provides the main application controller.
-
class cola.controllers.main.MainController(model, view)
Manage interactions between models and views.
-
action_staged(widget)
- Called when the ‘staged’ list changes.
-
action_unstaged(widget)
- Called when the ‘unstaged’ list changes.
-
alt_action()
- Clear and rescan when read-only.
-
branch_compare()
- Launch the Branch -> Compare dialog.
-
branch_create()
- Launch the ‘Create Branch’ dialog.
-
branch_delete()
- Launch the ‘Delete Branch’ dialog.
-
branch_diff()
- Diff against an arbitrary revision, branch, tag, etc.
-
branch_review()
- Diff against an arbitrary revision, branch, tag, etc.
-
browse_commits()
- Launch the ‘Browse Commits’ dialog.
-
browse_current()
- Launch the ‘Browse Current Branch’ dialog.
-
browse_other()
- Prompt for a branch and inspect content at that point in time.
-
checkout_branch()
- Launch the ‘Checkout Branch’ dialog.
-
cherry_pick()
- Launch the ‘Cherry-Pick’ dialog.
-
clear_and_rescan(*rest)
- Clear the commit message and rescan.
-
click_tree(event)
Called when a repo status tree item is clicked.
This handles the behavior where clicking on the icon invokes
the same appropriate action.
-
clone_repo()
- Clone a git repository.
-
commit()
- Attempt to create a commit from the index and commit message.
-
delete_files()
- Deletes files when called by an untracked file’s context menu.
-
diff_branch()
- Launches a diff against a branch.
-
diff_context_menu_event(event)
- Create the context menu for the diff display.
-
diff_context_menu_setup()
- Set up the context menu for the diff display.
-
diff_expression()
- Diff using an arbitrary expression.
-
diff_key_press_event(event)
- Handle shortcut keys in the diff view.
-
display_tree_selection()
- Show a data for the selected item.
-
doubleclick_tree(item, column)
- Called when an item is double-clicked in the repo status tree.
-
edit_diff(staged=True)
- Launches difftool on the specified paths.
-
edit_file(staged=True)
- Launch $editor on a specific path.
-
event(msg)
- Overrides event() to handle custom inotify events.
-
export_patches()
- Run ‘git format-patch’ on a list of commits.
-
fetch()
- Launch the ‘fetch’ remote dialog.
-
gen_search(searchtype, browse=False)
- Return a callback to handle various search actions.
-
generate_header_data(idx)
- Generate data for a header item such as ‘Staged’.
-
get_selected_filename(staged=False)
- Return the selected staged or unstaged filename.
-
get_selection()
- Return the current selection in the repo status tree.
-
get_single_selection()
- Scan across staged, modified, etc. and return a single item.
-
get_staged_item()
- Return a single selected staged item.
-
get_unstaged_item()
- Return a single selected unstaged item.
-
get_untracked_items()
- Return all selected untracked items.
-
goto_grep()
- Called when Search -> Grep’s right-click ‘goto’ action.
-
grep()
- Prompt for input and use ‘git grep’ to find the content.
-
has_inotify()
- Return True if pyinotify is available.
-
load_commitmsg()
- Load a commit message from a file.
-
load_prev_msg_and_rescan(*rest)
- Load the previous commit message and rescan.
-
log(status, output, rescan=True)
- Log output and optionally rescans for changes.
-
mergetool()
- Launch git-mergetool on a file path.
-
open_repo()
- Spawn a new cola session.
-
options()
- Launch the options dialog
-
process_diff_selection(selected=False, staged=True, apply_to_worktree=False, reverse=False)
- Implement un/staging of selected lines or hunks.
-
pull()
- Launch the ‘pull’ remote dialog.
-
push()
- Launch the ‘push’ remote dialog.
-
quit_app(*args)
- Save config settings and cleanup inotify threads.
-
read_only()
- Whether to inhibit all repo-modifying actions.
-
rebase()
- Rebase onto a branch.
-
rescan(*rest)
- Populate view widgets with results from ‘git status’.
-
reset_mode()
- Set the mode to the default NONE mode.
-
select_commits_gui(title, revs, summaries, multiselect=True)
- Launch a gui for selecting commits.
-
set_mode(staged)
- Set the appropriate mode based on the staged/amending state.
-
show_diffstat()
- Show a diffstat for the latest commit.
-
show_index()
- Shows a diffstat for the index.
-
stage_hunk()
- Stage a specific hunk.
-
stage_hunk_selection()
- Stage selected lines.
-
stage_selected(*rest)
- Use ‘git add/rm’ to add or remove content from the index
-
start_inotify_thread()
- Start an inotify thread if pyinotify is installed.
-
tr(fortr)
- Translates strings.
-
tree_context_menu_event(event)
- Create context menus for the repo status tree.
-
tree_context_menu_setup()
- Set up the status menu for the repo status tree.
-
undo_changes()
- Reverts local changes back to whatever’s in HEAD.
-
undo_hunk()
- Destructively remove a hunk from a worktree file.
-
undo_selection()
- Destructively check out content for the selected file from $head.
-
undoable()
- Whether we can checkout files from the $head.
-
unstage_hunk(cached=True)
- Unstage a hunk.
-
unstage_hunk_selection()
- Unstage selected lines.
-
unstage_selected(*rest)
- Use ‘git reset/rm’ to remove content from the index
-
update_diff_font()
- Updates the diff font based on the configured value.
-
update_tab_width()
- Implement the variable-tab-width setting.
-
update_ui_font()
- Updates the main UI font based on the configured value.
-
view_diff(staged=True, scrollvalue=None)
- View the diff for a clicked-on item.
-
viz_all()
- Visualizes the entire git history using gitk.
-
viz_current()
- Visualize the current branch’s history using gitk.