From 4c11732b66b321ee645997355a6e15387e441ab9 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 14 Feb 2023 15:23:02 +0530 Subject: Fix #55 File Name Displayed in Title Bar --- main.ui | 2 +- mainApp.py | 7 ++++++- 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 @@ - MainWindow + Untitled - Chemical Simulator GUI 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: -- cgit