Skip to content

Commit fed598b

Browse files
committed
Generalize launching dialogs with matching font
1 parent a2c4f47 commit fed598b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

preditor/gui/loggerwindow.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import __main__
1818
import Qt as Qt_py
1919
from Qt import QtCompat, QtCore, QtWidgets
20-
from Qt.QtCore import QByteArray, QFileSystemWatcher, Qt, QTimer, Signal, Slot
20+
from Qt.QtCore import QByteArray, QFileSystemWatcher, QObject, Qt, QTimer, Signal, Slot
2121
from Qt.QtGui import QCursor, QFont, QIcon, QKeySequence, QTextCursor
2222
from Qt.QtWidgets import (
2323
QApplication,
@@ -623,6 +623,7 @@ def change_to_workbox_version_text(self, versionType):
623623

624624
def openSetPreferredTextEditorDialog(self):
625625
dlg = SetTextEditorPathDialog(parent=self)
626+
self.setDialogFont(dlg)
626627
dlg.exec()
627628

628629
def focusToConsole(self):
@@ -886,10 +887,17 @@ def setEditorChooserFontBasedOnConsole(self):
886887
"""Set the EditorChooser font to match console. This helps with legibility when
887888
using EditorChooser.
888889
"""
889-
font = self.console().font()
890-
for child in self.uiEditorChooserWGT.children():
891-
if hasattr(child, "font"):
892-
child.setFont(font)
890+
self.setDialogFont(self.uiEditorChooserWGT)
891+
892+
def setDialogFont(self, dialog):
893+
"""Helper for when creating a dialog to have the font match the PrEditor font
894+
895+
Args:
896+
dialog (QDialog): The dialog for which to set the font
897+
"""
898+
for thing in dialog.findChildren(QObject):
899+
if hasattr(thing, "setFont"):
900+
thing.setFont(self.font())
893901

894902
@classmethod
895903
def _genPrefName(cls, baseName, index):

0 commit comments

Comments
 (0)