1 from __future__
import absolute_import
3 from cola
import sipcompat
6 from PyQt4
.QtCore
import SIGNAL
9 from cola
import hotkeys
10 from cola
import icons
11 from cola
import qtutils
12 from cola
.i18n
import N_
15 def cmd_action(widget
, cmd
, icon
, *shortcuts
):
16 action
= qtutils
.add_action(widget
, cmd
.name(), cmds
.run(cmd
), *shortcuts
)
21 def launch_editor(widget
, *shortcuts
):
22 icon
= icons
.configure()
23 return cmd_action(widget
, cmds
.LaunchEditor
, icon
, hotkeys
.EDIT
, *shortcuts
)
26 def launch_difftool(widget
):
28 return cmd_action(widget
, cmds
.LaunchDifftool
, icon
, hotkeys
.DIFF
)
31 def stage_or_unstage(widget
):
33 return cmd_action(widget
, cmds
.StageOrUnstage
, icon
,
34 hotkeys
.STAGE_SELECTION
)
37 def move_down(widget
):
38 return qtutils
.add_action(
39 widget
, N_('Next File'),
40 lambda: widget
.emit(SIGNAL('move_down()')),
41 hotkeys
.MOVE_DOWN_SECONDARY
)
45 return qtutils
.add_action(
46 widget
, N_('Previous File'),
47 lambda: widget
.emit(SIGNAL('move_up()')),
48 hotkeys
.MOVE_UP_SECONDARY
)