Bread_Editor/main.py

52 lines
1.2 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/python3
import sys
from PyQt6.QtCore import QTimer
2024-12-07 19:36:40 +01:00
from wobbl_tools.data_file import load_dataclass_json
from utils import Utils
from file import File, FileActions
from ui import GUI
2024-11-21 18:54:32 +01:00
from settings import Settings
from ipc import IPC
class BreadEditor:
def __init__(self):
2024-11-21 20:19:37 +01:00
self.utils = Utils(self)
self.settings = load_dataclass_json(Settings, f"{self.utils.editor_path}/settings.json")
self.file_actions = FileActions(self)
self.ipc = IPC(self)
if not self.ipc.first_instance:
return
self.gui = GUI(self)
self.gui.connect_gui(self)
2024-11-21 17:34:58 +01:00
self.open_files: dict[str, File] = {}
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
def run(self):
if not self.ipc.first_instance:
return
2024-11-21 18:54:32 +01:00
self.gui.post_setup()
self.utils.on_start()
self.utils.popup_init()
self.gui.QTMainWindow.show()
sys.exit(self.gui.qt_app.exec())
if __name__ == "__main__":
editor = BreadEditor()
editor.run()