From 7190b97b76790b1e9bc2feb3b027af585394fdbe Mon Sep 17 00:00:00 2001 From: Blaine Date: Tue, 19 May 2020 17:23:15 +0530 Subject: undo redo complete --- src/main/python/main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/main/python/main.py') diff --git a/src/main/python/main.py b/src/main/python/main.py index db34119..335e449 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -34,8 +34,10 @@ class appWindow(QMainWindow): self.menuFile.addAction("Save", self.saveProject) self.menuEdit = titleMenu.addMenu('Edit') - self.undo = self.menuEdit.addAction("Undo") - self.redo = self.menuEdit.addAction("Redo") + self.undo = self.menuEdit.addAction("Undo", lambda x=self: x.activeScene.painter.undoAction.trigger()) + self.redo = self.menuEdit.addAction("Redo", lambda x=self: x.activeScene.painter.redoAction.trigger()) + + self.menuEdit.addAction("Show Undo Stack", lambda x=self: x.activeScene.painter.createUndoView(self) ) self.menuGenerate = titleMenu.addMenu('Generate') #Generate menu self.menuGenerate.addAction("Image", self.saveImage) @@ -54,14 +56,15 @@ class appWindow(QMainWindow): self.mdi.setDocumentMode(False) #declare main window layout - # self.mainWidget.setLayout(mainLayout) self.setCentralWidget(self.mdi) self.resize(1280, 720) #set collapse dim self.mdi.subWindowActivated.connect(self.tabSwitched) def updateMenuBar(self): - self.undo.setAction(self.activeScene.painter.undoAction) - self.redo.setAction(self.activeScene.painter.redoAction) + # self.undo.setAction(self.activeScene.painter.undoAction) + self.undo.triggered(self.activeScene.painter.undoAction.trigger) + self.redo.triggered(self.activeScene.painter.redoAction.trigger) + # self.redo.setAction(self.activeScene.painter.redoAction) def createToolbar(self): #place holder for toolbar with fixed width, layout may change @@ -93,7 +96,6 @@ class appWindow(QMainWindow): if self.count > 1: #switch to tab view if needed self.mdi.setViewMode(QMdiArea.TabbedView) project.show() - project.tabber.currentWidget().painter.createUndoView(self) def openProject(self): #show the open file dialog to open a saved file, then unpickle it. -- cgit From 1c08fe5744c5cbda830fc84f686942e71bce16f5 Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 21 May 2020 21:42:22 +0530 Subject: migrate to json --- src/main/python/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/main/python/main.py') diff --git a/src/main/python/main.py b/src/main/python/main.py index 335e449..4bb5abd 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -62,9 +62,8 @@ class appWindow(QMainWindow): def updateMenuBar(self): # self.undo.setAction(self.activeScene.painter.undoAction) - self.undo.triggered(self.activeScene.painter.undoAction.trigger) - self.redo.triggered(self.activeScene.painter.redoAction.trigger) - # self.redo.setAction(self.activeScene.painter.redoAction) + self.undo.triggered.connect(self.activeScene.painter.undoAction.trigger()) + self.redo.triggered.connect(self.activeScene.painter.redoAction.trigger()) def createToolbar(self): #place holder for toolbar with fixed width, layout may change -- cgit From 7417af719f678f3b00d513e8e21b4759bf19e960 Mon Sep 17 00:00:00 2001 From: Blaine Date: Fri, 22 May 2020 19:19:08 +0530 Subject: rename funcs to app, and fix toolbar resizing --- src/main/python/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/python/main.py') diff --git a/src/main/python/main.py b/src/main/python/main.py index 4bb5abd..dfbb8c8 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -13,6 +13,7 @@ from utils.fileWindow import fileWindow from utils.data import ppiList, sheetDimensionList from utils import dialogs from utils.toolbar import toolbar +from utils.app import app import shapes @@ -204,8 +205,7 @@ class appWindow(QMainWindow): #donot delete, to manage undo redo -if __name__ == '__main__': - app = ApplicationContext() # 1. Instantiate ApplicationContext +if __name__ == '__main__': # 1. Instantiate ApplicationContext main = appWindow() main.show() exit_code = app.app.exec_() # 2. Invoke appctxt.app.exec_() -- cgit From 26f3fee786c7e64fea85f93458350ca69dc28acb Mon Sep 17 00:00:00 2001 From: Blaine Date: Mon, 25 May 2020 03:50:27 +0530 Subject: week 5 refactor --- src/main/python/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/python/main.py') diff --git a/src/main/python/main.py b/src/main/python/main.py index dfbb8c8..a2aaf8b 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -62,7 +62,7 @@ class appWindow(QMainWindow): self.mdi.subWindowActivated.connect(self.tabSwitched) def updateMenuBar(self): - # self.undo.setAction(self.activeScene.painter.undoAction) + # used to update menu bar undo-redo buttons to current scene self.undo.triggered.connect(self.activeScene.painter.undoAction.trigger()) self.redo.triggered.connect(self.activeScene.painter.redoAction.trigger()) -- cgit From 39bc43643fdb9fd9e8aee8a68cb27b0aa7157486 Mon Sep 17 00:00:00 2001 From: Blaine Date: Wed, 27 May 2020 04:40:43 +0530 Subject: update drag and drop for streamlined merge --- src/main/python/main.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/python/main.py') diff --git a/src/main/python/main.py b/src/main/python/main.py index a2aaf8b..9bf97dd 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -82,6 +82,7 @@ class appWindow(QMainWindow): graphic.setPen(QPen(Qt.black, 2)) graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) currentDiagram.addItemPlus(graphic) + graphic.setPos(20, 20) def newProject(self): #call to create a new file inside mdi area -- cgit From bbbda804aea58b006ed998bf54e581aa8c09e79b Mon Sep 17 00:00:00 2001 From: Blaine Date: Wed, 27 May 2020 05:13:47 +0530 Subject: merge-commit 2 --- src/main/python/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/python/main.py') diff --git a/src/main/python/main.py b/src/main/python/main.py index 9bf97dd..bc65035 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -78,9 +78,9 @@ class appWindow(QMainWindow): def toolButtonClicked(self, object): currentDiagram = self.mdi.currentSubWindow().tabber.currentWidget().painter if currentDiagram: - graphic = getattr(shapes, object['object'])(*object['args']) - graphic.setPen(QPen(Qt.black, 2)) - graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) + graphic = getattr(shapes, object['object'])(**map(lambda x: int(x) if x.isdigit() else x, object['args'])) + # graphic.setPen(QPen(Qt.black, 2)) + # graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) currentDiagram.addItemPlus(graphic) graphic.setPos(20, 20) -- cgit From 7606d7bb27ce1f9de890f4c8a84232f4649c62bf Mon Sep 17 00:00:00 2001 From: Blaine Date: Wed, 27 May 2020 21:00:23 +0530 Subject: commit undo modification --- src/main/python/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/python/main.py') diff --git a/src/main/python/main.py b/src/main/python/main.py index bc65035..3ebb2b9 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -78,7 +78,7 @@ class appWindow(QMainWindow): def toolButtonClicked(self, object): currentDiagram = self.mdi.currentSubWindow().tabber.currentWidget().painter if currentDiagram: - graphic = getattr(shapes, object['object'])(**map(lambda x: int(x) if x.isdigit() else x, object['args'])) + graphic = getattr(shapes, object['object'])(*map(lambda x: int(x) if x.isdigit() else x, object['args'])) # graphic.setPen(QPen(Qt.black, 2)) # graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) currentDiagram.addItemPlus(graphic) -- cgit