2024-11-21 16:56:08 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
from PyQt6.QtWidgets import QApplication, QMainWindow
|
2024-11-21 18:54:32 +01:00
|
|
|
from PyQt6.QtGui import QFont
|
2024-11-21 16:56:08 +01:00
|
|
|
from gui.main_window import Ui_MainWindow
|
|
|
|
from connect_gui import connect_gui
|
|
|
|
|
|
|
|
|
|
|
|
class GUI:
|
|
|
|
def __init__(self, app):
|
|
|
|
self.app = app
|
|
|
|
|
2024-11-21 19:47:15 +01:00
|
|
|
self.qt_app = QApplication([])
|
2024-11-21 16:56:08 +01:00
|
|
|
self.QTMainWindow = QMainWindow()
|
|
|
|
|
|
|
|
self.main_window = Ui_MainWindow()
|
|
|
|
|
|
|
|
self.setup_gui()
|
|
|
|
|
|
|
|
self.connect_gui = connect_gui
|
|
|
|
|
|
|
|
def setup_gui(self):
|
|
|
|
self.main_window.setupUi(self.QTMainWindow)
|
|
|
|
self.main_window.settingsDock.hide()
|
2024-11-21 18:54:32 +01:00
|
|
|
|
|
|
|
def post_setup(self):
|
|
|
|
self.main_window.bitsAreSquaresSetting.setChecked(self.app.settings.square_bits)
|
|
|
|
|
2024-11-21 19:47:15 +01:00
|
|
|
spacing = 200 if self.app.settings.square_bits else 100
|
2024-11-21 18:54:32 +01:00
|
|
|
|
2024-11-21 19:47:15 +01:00
|
|
|
self.app.file.BitEditor.font.setLetterSpacing(QFont.SpacingType.PercentageSpacing, spacing)
|
2024-11-21 20:19:37 +01:00
|
|
|
|
|
|
|
print(self.app.settings.highlight_ones)
|
|
|
|
self.main_window.highlightOnesSetting.setChecked(self.app.settings.highlight_ones)
|
|
|
|
|
|
|
|
for file_path in self.app.open_files:
|
|
|
|
editor = self.app.open_files[file_path].bit_editor
|
|
|
|
|
|
|
|
highlighter_document = editor.input.document() if self.app.settings.highlight_ones else None
|
|
|
|
|
|
|
|
editor.bit_highlighter.setDocument(highlighter_document)
|