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:
parent
1367e03af1
commit
fd5b46d2e6
2 changed files with 3 additions and 1 deletions
2
file.py
2
file.py
|
@ -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:
|
||||||
|
|
2
main.py
2
main.py
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue