summaryrefslogtreecommitdiff
path: root/raveos-center/raveos_center/ikonok.py
diff options
context:
space:
mode:
Diffstat (limited to 'raveos-center/raveos_center/ikonok.py')
-rw-r--r--raveos-center/raveos_center/ikonok.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/raveos-center/raveos_center/ikonok.py b/raveos-center/raveos_center/ikonok.py
new file mode 100644
index 0000000..16d402c
--- /dev/null
+++ b/raveos-center/raveos_center/ikonok.py
@@ -0,0 +1,30 @@
+from PyQt6.QtCore import QByteArray, Qt
+from PyQt6.QtGui import QIcon, QPainter, QPixmap
+from PyQt6.QtSvg import QSvgRenderer
+
+UTAK = {
+ "attekintes": '<path d="M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"/>',
+ "alkalmazasok": '<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/>'
+ '<rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/>',
+ "frissitesek": '<path d="M21 12a9 9 0 1 1-3-6.7"/><path d="M21 3v6h-6"/>',
+ "rendszer": '<rect x="5" y="5" width="14" height="14"/><rect x="9" y="9" width="6" height="6"/>'
+ '<path d="M9 2v3M15 2v3M9 19v3M15 19v3M2 9h3M2 15h3M19 9h3M19 15h3"/>',
+ "visszajelzes": '<path d="M4 4h16v12H8l-4 4z"/><path d="M8 9h8M8 12h5"/>',
+ "beallitasok": '<circle cx="12" cy="12" r="3"/>'
+ '<path d="M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1"/>',
+}
+
+
+def ikon(nev, szin, meret=18):
+ svg = (
+ f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="{szin}" '
+ f'stroke-width="2" stroke-linecap="square">{UTAK[nev]}</svg>'
+ )
+ renderelo = QSvgRenderer(QByteArray(svg.encode()))
+ kep = QPixmap(meret * 2, meret * 2)
+ kep.fill(Qt.GlobalColor.transparent)
+ festo = QPainter(kep)
+ renderelo.render(festo)
+ festo.end()
+ kep.setDevicePixelRatio(2)
+ return QIcon(kep)