Remove monospace fonts from main GUI

This commit is contained in:
Veronica K. B. Olsen
2020-05-31 12:17:34 +02:00
parent e74b8ec6ce
commit 685af710a6
4 changed files with 20 additions and 22 deletions
+14
View File
@@ -30,6 +30,7 @@ import configparser
import nw
from os import path, listdir
from math import ceil
from PyQt5.QtWidgets import qApp
from PyQt5.QtGui import (
@@ -141,6 +142,19 @@ class GuiTheme:
return
##
# Methods
##
def getTextWidth(self, theText, theFont=None):
"""Returns the width needed to contain a given piece of text.
"""
if isinstance(theFont, QFont):
qMetrics = QFontMetrics(theFont)
else:
qMetrics = QFontMetrics(self.guiFont)
return int(ceil(qMetrics.boundingRect(theText).width()))
##
# Actions
##