summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorBlaine2020-05-05 14:26:43 +0530
committerBlaine2020-05-05 14:26:43 +0530
commit708835a4859a0c5d81a34b26442962e727a0035b (patch)
tree615f6eaa149ed6e36b282a1c45eea32adee0a90c /src/main
parent7fa23828f14322e7c34fc32b7e9c6ac5d688200e (diff)
downloadChemical-PFD-708835a4859a0c5d81a34b26442962e727a0035b.tar.gz
Chemical-PFD-708835a4859a0c5d81a34b26442962e727a0035b.tar.bz2
Chemical-PFD-708835a4859a0c5d81a34b26442962e727a0035b.zip
return values fixed, and edge case sorted
Diffstat (limited to 'src/main')
-rw-r--r--src/main/python/main.py13
-rw-r--r--src/main/python/utils/fileWindow.py2
2 files changed, 5 insertions, 10 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py
index 56e29e3..81e54e1 100644
--- a/src/main/python/main.py
+++ b/src/main/python/main.py
@@ -149,7 +149,7 @@ class appWindow(QMainWindow):
def keyPressEvent(self, event):
#overload key press event for custom keyboard shortcuts
if event.modifiers() and Qt.ControlModifier:
- if event.key() == Qt.key_N:
+ if event.key() == Qt.Key_N:
self.newProject()
elif event.key() == Qt.Key_S:
@@ -159,7 +159,7 @@ class appWindow(QMainWindow):
self.openProject()
elif event.key() == Qt.Key_Q:
- self.closeEvent()
+ self.close()
elif event.key() == Qt.Key_P:
if Qt.AltModifier:
@@ -167,25 +167,20 @@ class appWindow(QMainWindow):
else:
self.generateReport()
- elif event.key() == Qt.key_A:
+ 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()
+ event.accept()
if __name__ == '__main__':
app = ApplicationContext() # 1. Instantiate ApplicationContext
diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py
index 26daf46..95488b0 100644
--- a/src/main/python/utils/fileWindow.py
+++ b/src/main/python/utils/fileWindow.py
@@ -178,7 +178,7 @@ class fileWindow(QMdiSubWindow):
def saveProject(self, name = None):
# called by dialog.saveEvent, saves the current file
name = QFileDialog.getSaveFileName(self, 'Save File', f'New Diagram', 'Process Flow Diagram (*.pfd)') if not name else name
- if name:
+ if name[0]:
with open(name[0],'wb') as file:
pickle.dump(self, file)
return True