dag: update column allocation algorithm description
[git-cola.git] / cola / actions.py
blob24ddd157b18bffab8e9a80a9161067e81d533883
1 from __future__ import absolute_import
3 from . import cmds
4 from . import hotkeys
5 from . import icons
6 from . import qtutils
7 from .i18n import N_
10 def cmd_action(widget, cmd, icon, *shortcuts):
11 action = qtutils.add_action(widget, cmd.name(), cmds.run(cmd), *shortcuts)
12 action.setIcon(icon)
13 return action
16 def launch_editor(widget, *shortcuts):
17 icon = icons.configure()
18 return cmd_action(widget, cmds.LaunchEditor, icon, hotkeys.EDIT, *shortcuts)
21 def launch_difftool(widget):
22 icon = icons.diff()
23 return cmd_action(widget, cmds.LaunchDifftool, icon, hotkeys.DIFF)
26 def stage_or_unstage(widget):
27 icon = icons.add()
28 return cmd_action(widget, cmds.StageOrUnstage, icon,
29 hotkeys.STAGE_SELECTION)
32 def move_down(widget):
33 return qtutils.add_action(
34 widget, N_('Next File'), widget.down.emit,
35 hotkeys.MOVE_DOWN_SECONDARY)
38 def move_up(widget):
39 return qtutils.add_action(
40 widget, N_('Previous File'), widget.up.emit,
41 hotkeys.MOVE_UP_SECONDARY)