Skip to content

Commit f394369

Browse files
committed
Generalize launching dialogs with matching font
1 parent 9a4df96 commit f394369

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):
@@ -890,10 +891,17 @@ def setEditorChooserFontBasedOnConsole(self):
890891
"""Set the EditorChooser font to match console. This helps with legibility when
891892
using EditorChooser.
892893
"""
893-
font = self.console().font()
894-
for child in self.uiEditorChooserWGT.children():
895-
if hasattr(child, "font"):
896-
child.setFont(font)
894+
self.setDialogFont(self.uiEditorChooserWGT)
895+
896+
def setDialogFont(self, dialog):
897+
"""Helper for when creating a dialog to have the font match the PrEditor font
898+
899+
Args:
900+
dialog (QDialog): The dialog for which to set the font
901+
"""
902+
for thing in dialog.findChildren(QObject):
903+
if hasattr(thing, "setFont"):
904+
thing.setFont(self.font())
897905

898906
@classmethod
899907
def _genPrefName(cls, baseName, index):

0 commit comments

Comments
 (0)