summaryrefslogtreecommitdiff
path: root/src/main/python/utils/fileWindow.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/python/utils/fileWindow.py')
-rw-r--r--src/main/python/utils/fileWindow.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py
index 04ed81a..663a7f3 100644
--- a/src/main/python/utils/fileWindow.py
+++ b/src/main/python/utils/fileWindow.py
@@ -3,13 +3,13 @@ from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (QFileDialog, QHBoxLayout,
QMdiSubWindow, QMenu, QPushButton, QSizePolicy,
QSplitter, QWidget, QStyle)
-
+from os import path
from . import dialogs
from .graphics import customView
from .canvas import canvas
from .tabs import customTabWidget
from .undo import resizeCommand
-from .app import dump, loads, JSON_Typer
+from .app import dump, loads, JSON_Typer, version
class fileWindow(QMdiSubWindow):
@@ -221,6 +221,8 @@ class fileWindow(QMdiSubWindow):
# 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[0]:
+ self.setObjectName(path.basename(name[0]).split(".")[0])
+ self.setWindowTitle(self.objectName())
with open(name[0],'w') as file:
dump(self, file, indent=4, cls=JSON_Typer)
return True
@@ -241,13 +243,14 @@ class fileWindow(QMdiSubWindow):
def __getstate__(self) -> dict:
return {
"_classname_": self.__class__.__name__,
+ "version": version,
"ObjectName": self.objectName(),
"tabs": [i.__getstate__() for i in self.tabList]
}
def __setstate__(self, dict):
- self.setObjectName = dict['ObjectName']
- self.setWindowTitle = dict['ObjectName']
+ self.setObjectName(dict['ObjectName'])
+ self.setWindowTitle(dict['ObjectName'])
for i in dict['tabs']:
diagram = self.newDiagram(i['ObjectName'])
diagram.__setstate__(i)