Esempio n. 1
0
 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()
Esempio n. 2
0
    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
Esempio n. 3
0
 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()
Esempio n. 4
0
 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()
Esempio n. 5
0
 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()
Esempio n. 6
0
 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()