Made the open_files variable a dict again so it is easy to get the file object by the path.

This commit is contained in:
The Wobbler 2024-11-19 18:13:41 +01:00
parent 1367e03af1
commit fd5b46d2e6
2 changed files with 3 additions and 1 deletions

View file

@ -17,6 +17,8 @@ class FileActions:
if dialog.exec(): if dialog.exec():
for file_path in dialog.selectedFiles(): for file_path in dialog.selectedFiles():
self.app.open_files.append(File(self.app, file_path, file_path.split("/")[-1])) 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: class File:

View file

@ -13,7 +13,7 @@ class BreadEditor:
self.utils = Utils(self) self.utils = Utils(self)
self.file_actions = FileActions(self) self.file_actions = FileActions(self)
self.open_files = [] self.open_files = {}
self.qt_app = QApplication(sys.argv) self.qt_app = QApplication(sys.argv)