Move GUI theme instance to the config object (after app creation)

This commit is contained in:
Veronica Berglyd Olsen
2023-08-08 14:35:55 +02:00
parent c50c8ee73a
commit 94c95d6f67
30 changed files with 319 additions and 390 deletions
+9 -10
View File
@@ -44,7 +44,6 @@ class GuiItemDetails(QWidget):
self.mainGui = mainGui
self.theProject = mainGui.theProject
self.mainTheme = mainGui.mainTheme
# Internal Variables
self._itemHandle = None
@@ -53,7 +52,7 @@ class GuiItemDetails(QWidget):
hSp = CONFIG.pxInt(6)
vSp = CONFIG.pxInt(1)
mPx = CONFIG.pxInt(6)
fPt = self.mainTheme.fontPointSize
fPt = CONFIG.theme.fontPointSize
fntLabel = QFont()
fntLabel.setBold(True)
@@ -178,8 +177,8 @@ class GuiItemDetails(QWidget):
self.updateTheme()
# Make sure the columns for flags and counts don't resize too often
flagWidth = self.mainTheme.getTextWidth("Mm", fntValue)
countWidth = self.mainTheme.getTextWidth("99,999", fntValue)
flagWidth = CONFIG.theme.getTextWidth("Mm", fntValue)
countWidth = CONFIG.theme.getTextWidth("99,999", fntValue)
self.mainBox.setColumnMinimumWidth(1, flagWidth)
self.mainBox.setColumnMinimumWidth(4, countWidth)
@@ -241,7 +240,7 @@ class GuiItemDetails(QWidget):
return
self._itemHandle = tHandle
iPx = int(round(0.8*self.mainTheme.baseIconSize))
iPx = int(round(0.8*CONFIG.theme.baseIconSize))
# Label
# =====
@@ -252,11 +251,11 @@ class GuiItemDetails(QWidget):
if nwItem.isFileType():
if nwItem.isActive:
self.labelIcon.setPixmap(self.mainTheme.getPixmap("checked", (iPx, iPx)))
self.labelIcon.setPixmap(CONFIG.theme.getPixmap("checked", (iPx, iPx)))
else:
self.labelIcon.setPixmap(self.mainTheme.getPixmap("unchecked", (iPx, iPx)))
self.labelIcon.setPixmap(CONFIG.theme.getPixmap("unchecked", (iPx, iPx)))
else:
self.labelIcon.setPixmap(self.mainTheme.getPixmap("noncheckable", (iPx, iPx)))
self.labelIcon.setPixmap(CONFIG.theme.getPixmap("noncheckable", (iPx, iPx)))
self.labelData.setText(theLabel)
@@ -270,14 +269,14 @@ class GuiItemDetails(QWidget):
# Class
# =====
classIcon = self.mainTheme.getIcon(nwLabels.CLASS_ICON[nwItem.itemClass])
classIcon = CONFIG.theme.getIcon(nwLabels.CLASS_ICON[nwItem.itemClass])
self.classIcon.setPixmap(classIcon.pixmap(iPx, iPx))
self.classData.setText(trConst(nwLabels.CLASS_NAME[nwItem.itemClass]))
# Layout
# ======
usageIcon = self.mainTheme.getItemIcon(
usageIcon = CONFIG.theme.getItemIcon(
nwItem.itemType, nwItem.itemClass, nwItem.itemLayout, nwItem.mainHeading
)
self.usageIcon.setPixmap(usageIcon.pixmap(iPx, iPx))