changes to icon class

This commit is contained in:
WorldTeacher
2024-06-11 09:49:39 +02:00
parent 633cfcc649
commit e7e2b659fe

View File

@@ -1,8 +1,6 @@
import darkdetect import darkdetect
# from src import MyLogger
from omegaconf import OmegaConf from omegaconf import OmegaConf
from PyQt6 import QtCore, QtGui from PyQt6 import QtGui
config = OmegaConf.load("config.yaml") config = OmegaConf.load("config.yaml")
config = OmegaConf.load(f"{config.icon_path}/icons.yaml") config = OmegaConf.load(f"{config.icon_path}/icons.yaml")
@@ -11,9 +9,6 @@ path = config.icon_path
dark = darkdetect.isDark() dark = darkdetect.isDark()
mode = "dark" if dark else "light" mode = "dark" if dark else "light"
path = f"{path}/{mode}" path = f"{path}/{mode}"
# log = MyLogger("Icon")
class Icon: class Icon:
def __init__(self, icon_type, widget=None): def __init__(self, icon_type, widget=None):
@@ -24,17 +19,13 @@ class Icon:
def add_icon(self, icon_type): def add_icon(self, icon_type):
icon = config[icon_type] icon = config[icon_type]
print(icon) icon = f"{path}/{icon}"
self.icon.addPixmap( self.icon.addPixmap(
QtGui.QPixmap(f"{path}/{icon}"), QtGui.QPixmap(icon),
QtGui.QIcon.Mode.Normal, QtGui.QIcon.Mode.Normal,
QtGui.QIcon.State.Off, QtGui.QIcon.State.Off,
) )
@staticmethod
def icondata(self):
return self.icon
if __name__ == "__main__": if __name__ == "__main__":
print("This is a module and can not be executed directly.") print("This is a module and can not be executed directly.")