The settings now actually do something.

This commit is contained in:
The Wobbler 2024-11-21 18:08:34 +01:00
parent 3893994a47
commit fdc9f86f92
2 changed files with 13 additions and 0 deletions

View file

@ -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)

View file

@ -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)