status: do not exit diff mode when unselecting a file
[git-cola.git] / cola / hotkeys.py
blob01c9a20dad26deb07db962f35750111c380b3a08
1 from __future__ import absolute_import, division, print_function, unicode_literals
3 from qtpy.QtGui import QKeySequence
4 from qtpy.QtCore import Qt
7 def hotkey(*seq):
8 return QKeySequence(*seq)
11 # A-G
12 STAGE_MODIFIED = hotkey(Qt.ALT | Qt.Key_A)
13 WORD_LEFT = hotkey(Qt.Key_B)
14 BLAME = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_B)
15 BRANCH = hotkey(Qt.CTRL | Qt.Key_B)
16 CHECKOUT = hotkey(Qt.ALT | Qt.Key_B)
17 CHERRY_PICK = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_C)
18 COPY_DIFF = hotkey(Qt.ALT | Qt.SHIFT | Qt.Key_C)
19 COPY_SHA1 = hotkey(Qt.CTRL | Qt.ALT | Qt.Key_C)
20 DIFFSTAT = hotkey(Qt.ALT | Qt.Key_D)
21 DIFF = hotkey(Qt.CTRL | Qt.Key_D)
22 DIFF_SECONDARY = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_D)
23 EDIT_SHORT = hotkey(Qt.Key_E)
24 EDIT = hotkey(Qt.CTRL | Qt.Key_E)
25 EDIT_SECONDARY = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_E)
26 EXPORT = hotkey(Qt.ALT | Qt.SHIFT | Qt.Key_E)
27 FIT = hotkey(Qt.Key_F)
28 FETCH = hotkey(Qt.CTRL | Qt.Key_F)
29 FILTER = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_F)
30 GOTO_END = hotkey(Qt.SHIFT | Qt.Key_G)
31 GOTO_START = hotkey(Qt.Key_G, Qt.Key_G) # gg
32 GREP = hotkey(Qt.CTRL | Qt.Key_G)
33 # H-P
34 MOVE_LEFT = hotkey(Qt.Key_H)
35 MOVE_LEFT_SHIFT = hotkey(Qt.SHIFT | Qt.Key_H)
36 HISTORY = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_H)
37 SIGNOFF = hotkey(Qt.CTRL | Qt.Key_I)
38 MOVE_DOWN = hotkey(Qt.Key_J)
39 MOVE_DOWN_SHIFT = hotkey(Qt.SHIFT | Qt.Key_J)
40 MOVE_DOWN_SECONDARY = hotkey(Qt.ALT | Qt.Key_J)
41 MOVE_DOWN_TERTIARY = hotkey(Qt.SHIFT | Qt.Key_J)
42 MOVE_UP = hotkey(Qt.Key_K)
43 MOVE_UP_SHIFT = hotkey(Qt.SHIFT | Qt.Key_K)
44 MOVE_UP_SECONDARY = hotkey(Qt.ALT | Qt.Key_K)
45 MOVE_UP_TERTIARY = hotkey(Qt.SHIFT | Qt.Key_K)
46 MOVE_RIGHT = hotkey(Qt.Key_L)
47 MOVE_RIGHT_SHIFT = hotkey(Qt.SHIFT | Qt.Key_L)
48 FOCUS = hotkey(Qt.CTRL | Qt.Key_L)
49 FOCUS_DIFF = hotkey(Qt.CTRL | Qt.Key_J)
50 FOCUS_STATUS = hotkey(Qt.CTRL | Qt.Key_K)
51 AMEND = hotkey(Qt.CTRL | Qt.Key_M)
52 MERGE = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_M)
53 PUSH = hotkey(Qt.CTRL | Qt.Key_P)
54 PULL = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_P)
55 OPEN_REPO_SEARCH = hotkey(Qt.ALT | Qt.Key_P)
56 # Q-Z
57 QUIT = hotkey(Qt.CTRL | Qt.Key_Q)
58 REFRESH = hotkey(Qt.CTRL | Qt.Key_R)
59 REFRESH_SECONDARY = hotkey(Qt.Key_F5)
60 REFRESH_HOTKEYS = (REFRESH, REFRESH_SECONDARY)
61 STAGE_DIFF = hotkey(Qt.Key_S)
62 EDIT_AND_STAGE_DIFF = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_S)
63 STAGE_DIFF_ALT = hotkey(Qt.SHIFT | Qt.Key_S)
64 STAGE_SELECTION = hotkey(Qt.CTRL | Qt.Key_S)
65 STAGE_ALL = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_S)
66 STASH = hotkey(Qt.ALT | Qt.SHIFT | Qt.Key_S)
67 FINDER = hotkey(Qt.CTRL | Qt.Key_T)
68 FINDER_SECONDARY = hotkey(Qt.Key_T)
69 TERMINAL = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_T)
70 STAGE_UNTRACKED = hotkey(Qt.ALT | Qt.Key_U)
71 REVERT = hotkey(Qt.CTRL | Qt.Key_U)
72 EDIT_AND_REVERT = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_U)
73 WORD_RIGHT = hotkey(Qt.Key_W)
75 # Numbers
76 START_OF_LINE = hotkey(Qt.Key_0)
78 # Special keys
79 BACKSPACE = hotkey(Qt.Key_Backspace)
80 TRASH = hotkey(Qt.CTRL | Qt.Key_Backspace)
81 DELETE_FILE = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_Backspace)
82 DELETE_FILE_SECONDARY = hotkey(Qt.CTRL | Qt.Key_Backspace)
83 PREFERENCES = hotkey(Qt.CTRL | Qt.Key_Comma)
84 END_OF_LINE = hotkey(Qt.Key_Dollar)
85 DOWN = hotkey(Qt.Key_Down)
86 ENTER = hotkey(Qt.Key_Enter)
87 ZOOM_OUT = hotkey(Qt.Key_Minus)
88 REMOVE_ITEM = hotkey(Qt.Key_Minus)
89 ADD_ITEM = hotkey(Qt.Key_Plus)
90 ZOOM_IN = hotkey(Qt.Key_Plus)
91 ZOOM_IN_SECONDARY = hotkey(Qt.Key_Equal)
93 QUESTION = hotkey(Qt.Key_Question)
94 RETURN = hotkey(Qt.Key_Return)
95 ACCEPT = (ENTER, RETURN)
96 APPLY = hotkey(Qt.CTRL | Qt.Key_Return)
97 PREPARE_COMMIT_MESSAGE = hotkey(Qt.CTRL | Qt.SHIFT | Qt.Key_Return)
98 PRIMARY_ACTION = hotkey(hotkey(Qt.Key_Space))
99 SECONDARY_ACTION = hotkey(Qt.SHIFT | Qt.Key_Space)
100 LEAVE = hotkey(Qt.SHIFT | Qt.Key_Tab)
101 UP = hotkey(Qt.Key_Up)
103 CTRL_RETURN = hotkey(Qt.CTRL | Qt.Key_Return)
104 CTRL_ENTER = hotkey(Qt.CTRL | Qt.Key_Enter)
106 # Rebase
107 REBASE_START_AND_CONTINUE = hotkey(Qt.ALT | Qt.Key_R)
108 REBASE_PICK = (hotkey(Qt.Key_1), hotkey(Qt.Key_P))
109 REBASE_REWORD = (hotkey(Qt.Key_2), hotkey(Qt.Key_R))
110 REBASE_EDIT = (hotkey(Qt.Key_3), hotkey(Qt.Key_E))
111 REBASE_FIXUP = (hotkey(Qt.Key_4), hotkey(Qt.Key_F))
112 REBASE_SQUASH = (hotkey(Qt.Key_5), hotkey(Qt.Key_S))
114 UNDO = hotkey(Qt.CTRL | Qt.Key_Z)
115 REDO = hotkey(Qt.SHIFT | Qt.CTRL | Qt.Key_Z)
117 # Key Sequences
118 COPY = QKeySequence.Copy
119 CLOSE = QKeySequence.Close
120 CUT = QKeySequence.Cut
121 PASTE = QKeySequence.Paste
122 DELETE = QKeySequence.Delete
123 NEW = QKeySequence.New
124 OPEN = QKeySequence.Open
125 SELECT_ALL = QKeySequence.SelectAll
127 # Text navigation
128 TEXT_DOWN = hotkey(Qt.Key_D)
129 TEXT_UP = hotkey(Qt.Key_U)
130 SELECT_FORWARD = hotkey(Qt.SHIFT | Qt.Key_F)
131 SELECT_BACK = hotkey(Qt.SHIFT | Qt.Key_B)
132 SELECT_DOWN = hotkey(Qt.SHIFT | Qt.Key_D)
133 SELECT_UP = hotkey(Qt.SHIFT | Qt.Key_U)