#!/usr/bin/python3 from PyQt6.QtWidgets import QApplication, QMainWindow from bread_editor.gui.main_window import Ui_MainWindow class GUI: def __init__(self, app): self.app = app self.qt_app = QApplication([]) self.QTMainWindow = QMainWindow() self.main_window = Ui_MainWindow() self.setup_gui() self.connect_gui() def setup_gui(self): self.main_window.setupUi(self.QTMainWindow) self.main_window.settingsDock.hide() def post_setup(self): self.main_window.bitsAreSquaresSetting.blockSignals(True) self.main_window.bitsAreSquaresSetting.setChecked(self.app.settings.square_bits) self.main_window.bitsAreSquaresSetting.blockSignals(False) self.main_window.highlightOnesSetting.setChecked(self.app.settings.highlight_ones) self.app.utils.update_style_in_all_bit_editors() def connect_gui(self): self.main_window.openFile.triggered.connect(self.app.file_actions.open_files) self.main_window.newFile.triggered.connect(lambda: self.app.file_actions.create_file()) self.main_window.saveFile.triggered.connect(self.app.file_actions.save_current_file) self.main_window.saveFileAs.triggered.connect(self.app.file_actions.save_current_file_as) self.main_window.menuSettings.triggered.connect(self.main_window.settingsDock.show) self.main_window.bitsAreSquaresSetting.stateChanged.connect(self.app.utils.update_style_in_all_bit_editors) self.main_window.highlightOnesSetting.stateChanged.connect(self.app.utils.update_style_in_all_bit_editors) self.main_window.openFileTabs.tabCloseRequested.connect(self.app.file_actions.close_current_file) self.QTMainWindow.closeEvent = self.app.utils.on_close