Rewrap self.tr and fix a few bugs

This commit is contained in:
Veronica K. B. Olsen
2021-02-15 16:47:57 +01:00
parent dba8865d75
commit df19ced50c
28 changed files with 682 additions and 516 deletions
+9 -4
View File
@@ -31,8 +31,9 @@ import configparser
import os
from math import ceil
from functools import partial
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QCoreApplication, Qt
from PyQt5.QtWidgets import QStyle, qApp
from PyQt5.QtGui import (
QPalette, QColor, QIcon, QFont, QFontMetrics, QFontDatabase, QPixmap
@@ -157,6 +158,10 @@ class GuiTheme:
logger.verbose("Text 'N' Height: %d" % self.textNHeight)
logger.verbose("Text 'N' Width: %d" % self.textNWidth)
# Internal Mapping
self.makeAlert = self.theParent.makeAlert
self.tr = partial(QCoreApplication.translate, "GuiTheme")
return
##
@@ -392,7 +397,7 @@ class GuiTheme:
with open(themeConf, mode="r", encoding="utf8") as inFile:
confParser.read_file(inFile)
except Exception as e:
self.theParent.makeAlert(
self.makeAlert(
[self.tr("Could not load theme config file."), str(e)], nwAlert.ERROR
)
continue
@@ -425,7 +430,7 @@ class GuiTheme:
with open(syntaxPath, mode="r", encoding="utf8") as inFile:
confParser.read_file(inFile)
except Exception as e:
self.theParent.makeAlert(
self.makeAlert(
[self.tr("Could not load syntax file."), str(e)], nwAlert.ERROR
)
return []
@@ -740,7 +745,7 @@ class GuiIcons:
with open(themeConf, mode="r", encoding="utf8") as inFile:
confParser.read_file(inFile)
except Exception as e:
self.theParent.makeAlert(
self.makeAlert(
[self.tr("Could not load theme config file."), str(e)], nwAlert.ERROR
)
continue