Skip to content

Commit 8781a28

Browse files
committed
Generalize launching dialogs with matching font
1 parent 7037088 commit 8781a28

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,
@@ -618,6 +618,7 @@ def change_to_workbox_version_text(self, versionType):
618618

619619
def openSetPreferredTextEditorDialog(self):
620620
dlg = SetTextEditorPathDialog(parent=self)
621+
self.setDialogFont(dlg)
621622
dlg.exec()
622623

623624
def focusToConsole(self):
@@ -879,10 +880,17 @@ def setEditorChooserFontBasedOnConsole(self):
879880
"""Set the EditorChooser font to match console. This helps with legibility when
880881
using EditorChooser.
881882
"""
882-
font = self.console().font()
883-
for child in self.uiEditorChooserWGT.children():
884-
if hasattr(child, "font"):
885-
child.setFont(font)
883+
self.setDialogFont(self.uiEditorChooserWGT)
884+
885+
def setDialogFont(self, dialog):
886+
"""Helper for when creating a dialog to have the font match the PrEditor font
887+
888+
Args:
889+
dialog (QDialog): The dialog for which to set the font
890+
"""
891+
for thing in dialog.findChildren(QObject):
892+
if hasattr(thing, "setFont"):
893+
thing.setFont(self.font())
886894

887895
@classmethod
888896
def _genPrefName(cls, baseName, index):

0 commit comments

Comments
 (0)