def diff_key_press_event(self, event): """Handle shortcut keys in the diff view.""" if event.key() != QtCore.Qt.Key_H and event.key() != QtCore.Qt.Key_S: event.ignore() return staged, modified, unmerged, untracked = cola.single_selection() if event.key() == QtCore.Qt.Key_H: if self.mode == self.model.mode_worktree and modified: self.stage_hunk() elif self.mode == self.model.mode_index: self.unstage_hunk() elif event.key() == QtCore.Qt.Key_S: if self.mode == self.model.mode_worktree and modified: self.stage_hunk_selection() elif self.mode == self.model.mode_index: self.unstage_hunk_selection()
def diff_key_press_event(self, event): """Handle shortcut keys in the diff view.""" result = QtGui.QTextEdit.keyPressEvent(self.display_text, event) if event.key() != QtCore.Qt.Key_H and event.key() != QtCore.Qt.Key_S: return result staged, modified, unmerged, untracked = cola.single_selection() if event.key() == QtCore.Qt.Key_H: if self.mode == self.model.mode_worktree and modified: self.stage_hunk() elif self.mode == self.model.mode_index: self.unstage_hunk() elif event.key() == QtCore.Qt.Key_S: if self.mode == self.model.mode_worktree and modified: self.stage_hunk_selection() elif self.mode == self.model.mode_index: self.unstage_hunk_selection() return result
def apply_selection(self): staged, modified, unmerged, untracked = cola.single_selection() if self.mode == self.model.mode_worktree and modified: self.stage_selection() elif self.mode == self.model.mode_index: self.unstage_selection()
def apply_selection(self): s = cola.single_selection() if self.model.stageable() and s.modified: self.stage_selection() elif self.model.unstageable(): self.unstage_selection()
def apply_selection(self): s = cola.single_selection() if self.model.stageable() and s.modified: self.stage_selection() elif self.model.unstageable(): self.unstage_selection()
def apply_selection(self): s = cola.single_selection() if self.mode == self.model.mode_worktree and s.modified: self.stage_selection() elif self.mode == self.model.mode_index: self.unstage_selection()