예제 #1
0
    def keyPressEvent(self, event):
        current_frame = self.player.preview_thread.current_frame
        key_value = event.key()
        print(key_value)

        modifiers = int(event.modifiers())
        if (key_value > 0 and key_value != Qt.Key_Shift
                and key_value != Qt.Key_Alt and key_value != Qt.Key_Control
                and key_value != Qt.Key_Meta):
            # A valid keysequence was detected
            key = QKeySequence(modifiers + key_value)
        else:
            # No valid keysequence detected
            return

        # Debug
        log.info("keyPressEvent: %s" % (key.toString()))

        color = self.getColorByName("actionCut+" + key.toString())
        print("actionCut+" + key.toString(), color)
        if color:
            self.timelineWidget.cut(key.toString(), current_frame, color)
        elif key.matches(self.getShortcutByName(
                "actionAddTrack")) == QKeySequence.ExactMatch:
            self.timelineWidget.addTrack("track_test")
예제 #2
0
def removeShortcut(action, key):
    """Removes matching QKeySequence from the list of the action."""
    key = QKeySequence(key)
    shortcuts = action.shortcuts()
    for s in action.shortcuts():
        if key.matches(s) or s.matches(key):
            shortcuts.remove(s)
    action.setShortcuts(shortcuts)
예제 #3
0
def removeShortcut(action, key):
    """Removes matching QKeySequence from the list of the action."""
    key = QKeySequence(key)
    shortcuts = action.shortcuts()
    for s in action.shortcuts():
        if key.matches(s) or s.matches(key):
            shortcuts.remove(s)
    action.setShortcuts(shortcuts)
예제 #4
0
    def keyPressEvent(self, e: QtGui.QKeySequence) -> None:
        """Catch and handle QKeySequence.Delete.
		"""

        if e.matches(QtGui.QKeySequence.Delete):
            for item in self.selectedItems():
                itemKey = item.entryData["key"]
                for obj in self.selection[:]:
                    logger.debug("obj: %r", obj)
                    if obj["key"] == itemKey:
                        self.selection.remove(obj)
            self.clear()
            for s in self.selection:
                self.addItem(FileItem(s, self))
        else:
            super(SelectedFilesWidget, self).keyPressEvent(e)