2024-11-17 18:54:51 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import sys
|
2024-12-08 15:07:23 +01:00
|
|
|
from PyQt6.QtCore import QTimer
|
2024-12-07 19:36:40 +01:00
|
|
|
from wobbl_tools.data_file import load_dataclass_json
|
2024-11-17 18:54:51 +01:00
|
|
|
from utils import Utils
|
2024-11-22 16:20:43 +01:00
|
|
|
from file import File, FileActions
|
2024-11-21 16:56:08 +01:00
|
|
|
from ui import GUI
|
2024-11-21 18:54:32 +01:00
|
|
|
from settings import Settings
|
2024-12-08 15:07:23 +01:00
|
|
|
from ipc import IPC
|
2024-11-17 18:54:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
class BreadEditor:
|
|
|
|
def __init__(self):
|
2024-11-21 20:19:37 +01:00
|
|
|
|
2024-11-17 18:54:51 +01:00
|
|
|
self.utils = Utils(self)
|
2024-12-08 15:07:23 +01:00
|
|
|
self.settings = load_dataclass_json(Settings, f"{self.utils.editor_path}/settings.json")
|
|
|
|
|
2024-11-22 16:20:43 +01:00
|
|
|
self.file_actions = FileActions(self)
|
2024-12-08 15:07:23 +01:00
|
|
|
|
|
|
|
self.ipc = IPC(self)
|
|
|
|
if not self.ipc.first_instance:
|
|
|
|
return
|
|
|
|
|
2024-11-21 16:56:08 +01:00
|
|
|
self.gui = GUI(self)
|
2024-11-17 18:54:51 +01:00
|
|
|
|
2024-11-21 16:56:08 +01:00
|
|
|
self.gui.connect_gui(self)
|
2024-11-21 17:34:58 +01:00
|
|
|
self.open_files: dict[str, File] = {}
|
2024-12-08 15:07:23 +01:00
|
|
|
self.open_files_queue = []
|
|
|
|
|
|
|
|
self.files_queue_timer = QTimer(self.gui.QTMainWindow)
|
|
|
|
self.files_queue_timer.timeout.connect(self.utils.check_file_queue)
|
|
|
|
self.files_queue_timer.start(500)
|
2024-11-21 16:40:37 +01:00
|
|
|
|
2024-11-17 18:54:51 +01:00
|
|
|
def run(self):
|
2024-12-08 15:07:23 +01:00
|
|
|
if not self.ipc.first_instance:
|
|
|
|
return
|
|
|
|
|
2024-11-21 18:54:32 +01:00
|
|
|
self.gui.post_setup()
|
2024-11-21 19:47:15 +01:00
|
|
|
|
2024-12-07 20:34:24 +01:00
|
|
|
self.utils.on_start()
|
2024-11-21 19:47:15 +01:00
|
|
|
|
2024-11-20 13:05:24 +01:00
|
|
|
self.utils.popup_init()
|
|
|
|
|
2024-11-21 16:56:08 +01:00
|
|
|
self.gui.QTMainWindow.show()
|
|
|
|
sys.exit(self.gui.qt_app.exec())
|
2024-11-17 18:54:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
editor = BreadEditor()
|
|
|
|
editor.run()
|