diff options
author | brenda-br | 2023-01-28 00:11:34 +0530 |
---|---|---|
committer | brenda-br | 2023-01-28 00:11:34 +0530 |
commit | b9df67134289c0b9d76f7f6462284d5cdf64c4d9 (patch) | |
tree | 3c2c196da9d8b0830bf9b1d35d1213da7de7916c | |
parent | e6d847f4a2a3a79284646f44b3d014743630da71 (diff) | |
download | Chemical-Simulator-GUI-b9df67134289c0b9d76f7f6462284d5cdf64c4d9.tar.gz Chemical-Simulator-GUI-b9df67134289c0b9d76f7f6462284d5cdf64c4d9.tar.bz2 Chemical-Simulator-GUI-b9df67134289c0b9d76f7f6462284d5cdf64c4d9.zip |
Fix #45 New File not created when cancelling Open File
-rw-r--r-- | mainApp.py | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -335,21 +335,21 @@ class MainApp(QMainWindow,ui): file_name, _ = QFileDialog.getOpenFileName(self, "Open As", initial_path, "%s Files (*.%s);; All Files (*)" % (file_format.upper(), file_format)) + if file_name: + self.undo_redo_helper() - self.undo_redo_helper() - - with open(file_name, 'rb') as f: - obj = pickle.load(f) - temp_result = obj[-1] - obj.pop() - compound_selected = obj[-1] - obj.pop() - self.comp.set_compounds(compound_selected) - for i in compound_selected: - self.comp.compound_selection(self.comp, i) - self.container.graphics.load_canvas(obj, self.container) - self.container.result = temp_result - DockWidget.show_result(dock_widget_lst) + with open(file_name, 'rb') as f: + obj = pickle.load(f) + temp_result = obj[-1] + obj.pop() + compound_selected = obj[-1] + obj.pop() + self.comp.set_compounds(compound_selected) + for i in compound_selected: + self.comp.compound_selection(self.comp, i) + self.container.graphics.load_canvas(obj, self.container) + self.container.result = temp_result + DockWidget.show_result(dock_widget_lst) except Exception as e: |