blob: 16d402cd4ef75f979567dbacd5bf9348be3fa9dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
|