diff options
Diffstat (limited to 'src/main/python/main.py')
-rw-r--r-- | src/main/python/main.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py index 3addc68..56e29e3 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -145,6 +145,48 @@ class appWindow(QMainWindow): def count(self): return len(self.mdi.subWindowList()) + #Key input handler + def keyPressEvent(self, event): + #overload key press event for custom keyboard shortcuts + if event.modifiers() and Qt.ControlModifier: + if event.key() == Qt.key_N: + self.newProject() + + elif event.key() == Qt.Key_S: + self.saveProject() + + elif event.key() == Qt.Key_O: + self.openProject() + + elif event.key() == Qt.Key_Q: + self.closeEvent() + + elif event.key() == Qt.Key_P: + if Qt.AltModifier: + self.saveImage() + else: + self.generateReport() + + elif event.key() == Qt.key_A: + #todo implement selectAll + for item in self.mdi.activeSubWindow().tabber.currentWidget().items: + item.setSelected(True) + + #todo copy, paste, undo redo + + else: + return event.reject() + + elif event.key() == Qt.Key_Delete or event.key() == Qt.Key_Backspace: + for item in self.mdi.activeSubWindow().tabber.currentWidget().painter.selectedItems(): + item.setEnabled(False) + #donot delete, to manage undo redo + + else: + return event.reject() + + return event.accept() + if __name__ == '__main__': app = ApplicationContext() # 1. Instantiate ApplicationContext test = appWindow() |