diff --git a/connect_gui.py b/connect_gui.py index 9714118..998da25 100644 --- a/connect_gui.py +++ b/connect_gui.py @@ -6,3 +6,4 @@ def connect_gui(app): app.gui.main_window.openFileTabs.tabCloseRequested.connect(app.file_actions.close_current_file) app.gui.QTMainWindow.closeEvent = app.utils.on_close app.gui.main_window.menuSettings.triggered.connect(app.gui.main_window.settingsDock.show) + app.gui.main_window.bitsAreSquaresSetting.stateChanged.connect(app.utils.update_font_in_all_bit_editors) diff --git a/utils.py b/utils.py index 8f51c1a..40cf792 100644 --- a/utils.py +++ b/utils.py @@ -2,6 +2,7 @@ from pathlib import Path from PyQt6.QtWidgets import QMessageBox +from PyQt6.QtGui import QFont class Utils: @@ -74,3 +75,14 @@ class Utils: event.ignore() print("Bye!") + + def update_font_in_all_bit_editors(self): + for file_path in self.app.open_files: + editor = self.app.open_files[file_path].bit_editor + + square = self.app.gui.main_window.bitsAreSquaresSetting.isChecked() + + spacing = 200 if square else 100 # add spacing when setting is checked + + editor.font.setLetterSpacing(QFont.SpacingType.PercentageSpacing, spacing) + editor.input.setFont(editor.font)