diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/python/main.py | 42 | ||||
-rw-r--r-- | src/main/python/utils/canvas.py | 5 | ||||
-rw-r--r-- | src/main/python/utils/fileWindow.py | 3 |
3 files changed, 48 insertions, 2 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() diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py index bf035f1..e2e6ab8 100644 --- a/src/main/python/utils/canvas.py +++ b/src/main/python/utils/canvas.py @@ -95,6 +95,11 @@ class canvas(QWidget): def dimensions(self): #returns the dimension of the current scene return self.painter.sceneRect().width(), self.painter.sceneRect().height() + @property + def items(self): + # generator to filter out certain items + for i in self.painter.items(): + yield i @property def canvasSize(self): diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py index fdf1c11..26daf46 100644 --- a/src/main/python/utils/fileWindow.py +++ b/src/main/python/utils/fileWindow.py @@ -100,8 +100,7 @@ class fileWindow(QMdiSubWindow): self.setFixedSize(width, height) self.tabber.resize(width, height) self.tabber.currentWidget().adjustView() - - + def contextMenu(self, point): #function to display the right click menu at point of right click menu = QMenu("Context Menu", self) |