sbc/ui.py
2024-10-18 11:38:23 +03:00

38 lines
1.3 KiB
Python

from PySide6 import QtWidgets, QtGui, QtCore
from windows import MainWindow, MenuActions, ToolBar, MenuBar, Tray, SoundEditorWindow
class Ui:
def __init__(self, menu_callback, periodic_task):
self.app = QtWidgets.QApplication([])
self.app.setQuitOnLastWindowClosed(False)
self.sound_editor_window = SoundEditorWindow()
self.main_window = MainWindow(self.sound_editor_window.show)
self.menu_actions = MenuActions(self.main_window, menu_callback)
self.menu_bar = MenuBar(self.main_window, self.menu_actions)
self.toolbar = ToolBar(self.main_window, self.menu_actions)
self.tray = Tray(self.main_window)
self.sound_editor_window.set_add_sound_callback(self.main_window.additional_sounds_box.add_sound)
# timer for starting bells
self.timer = QtCore.QTimer()
self.timer.timeout.connect(periodic_task)
self.timer.start(1000)
def run(self):
self.main_window.show()
self.tray.setVisible(True)
self.app.exec()
def get_settings(self, *args, **kwargs):
return self.main_window.get_settings(*args, **kwargs)
def set_settings(self, *args, **kwargs):
self.main_window.set_settings(*args, **kwargs)
def set_schedule(self, *args, **kwargs):
self.main_window.set_schedule(*args, **kwargs)
def select_bell(self, *args, **kwargs):
self.main_window.select_bell(*args, **kwargs)