From b9df67134289c0b9d76f7f6462284d5cdf64c4d9 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sat, 28 Jan 2023 00:11:34 +0530 Subject: Fix #45 New File not created when cancelling Open File --- mainApp.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mainApp.py b/mainApp.py index 1430960..7f44435 100644 --- a/mainApp.py +++ b/mainApp.py @@ -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: -- cgit