summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrenda-br2023-02-14 15:23:02 +0530
committerbrenda-br2023-02-14 15:23:02 +0530
commit4c11732b66b321ee645997355a6e15387e441ab9 (patch)
tree0a5877bf7364fa92bfa3752b1ddfdd45a5f2b78d
parente2b179ce145fc0882de06ea8cfe041f6162d4b11 (diff)
downloadChemical-Simulator-GUI-4c11732b66b321ee645997355a6e15387e441ab9.tar.gz
Chemical-Simulator-GUI-4c11732b66b321ee645997355a6e15387e441ab9.tar.bz2
Chemical-Simulator-GUI-4c11732b66b321ee645997355a6e15387e441ab9.zip
Fix #55 File Name Displayed in Title Bar
-rw-r--r--main.ui2
-rw-r--r--mainApp.py7
2 files changed, 7 insertions, 2 deletions
diff --git a/main.ui b/main.ui
index f707ba8..c41747e 100644
--- a/main.ui
+++ b/main.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>MainWindow</string>
+ <string>Untitled - Chemical Simulator GUI</string>
</property>
<property name="windowIcon">
<iconset>
diff --git a/mainApp.py b/mainApp.py
index 7350025..65e2ba3 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -314,13 +314,15 @@ class MainApp(QMainWindow,ui):
data.append(self.container.result)
file_format = 'sim'
- initial_path = QDir.currentPath() + 'untitled.' + file_format
+ initial_path = QDir.currentPath() + ' untitled.' + file_format
file_name, _ = QFileDialog.getSaveFileName(self, "Save As",
initial_path, "%s Files (*.%s);; All Files (*)" %
(file_format.upper(), file_format))
try:
with open(file_name, 'wb') as f:
pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
+ fileName = file_name.split('/')[-1].split('.')[0]
+ self.setWindowTitle(fileName+' - Chemical Simularot GUI')
except Exception as e:
pass
@@ -336,6 +338,9 @@ class MainApp(QMainWindow,ui):
initial_path, "%s Files (*.%s);; All Files (*)" %
(file_format.upper(), file_format))
if file_name:
+ fileName = file_name.split('/')[-1].split('.')[0]
+ self.setWindowTitle(fileName+' - Chemical Simularot GUI')
+
self.undo_redo_helper()
with open(file_name, 'rb') as f: