From fd5b46d2e6bc8b6f1e9d5bd426ee930e0beefbc8 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Tue, 19 Nov 2024 18:13:41 +0100 Subject: [PATCH] Made the open_files variable a dict again so it is easy to get the file object by the path. --- file.py | 2 ++ main.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/file.py b/file.py index 31c6594..3182824 100644 --- a/file.py +++ b/file.py @@ -17,6 +17,8 @@ class FileActions: if dialog.exec(): for file_path in dialog.selectedFiles(): self.app.open_files.append(File(self.app, file_path, file_path.split("/")[-1])) + if not file_path in self.app.open_files: # dont open file twice + self.app.open_files[file_path] = File(self.app, file_path, file_path.split("/")[-1]) class File: diff --git a/main.py b/main.py index c56a1d8..9ca6e73 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ class BreadEditor: self.utils = Utils(self) self.file_actions = FileActions(self) - self.open_files = [] + self.open_files = {} self.qt_app = QApplication(sys.argv)