First attempts at drawing the SVGs for routers

svg
LEdoian 1 year ago
parent ac3508727d
commit f12c1e9405

@ -8,7 +8,8 @@ from enum import Enum, auto
from dataclasses import dataclass
import re
import random
from PySide6 import QtCore, QtGui, QtWidgets
from .. import assets
from PySide6 import QtCore, QtGui, QtWidgets, QtSvgWidgets
# Classification
@ -140,13 +141,17 @@ def create_qgritems(at):
x = pos.x
y = pos.y
shape = QtWidgets.QGraphicsRectItem(-size/2, -size/2, size, size)
shape.setBrush(brush)
shape = QtSvgWidgets.QGraphicsSvgItem(str(assets / 'cisco_icons' / 'svg' / 'router.svg'))
print(shape.boundingRect())
shape.setTransformOriginPoint(shape.boundingRect().center())
print(shape.boundingRect())
#shape.setBrush(brush)
shape.setPos(x, y)
shape.setToolTip(rk)
label = QtWidgets.QGraphicsSimpleTextItem(rk, parent=shape)
label.setY(size*0.8)
# Centering:
shape.setTransformOriginPoint(shape.boundingRect().center())
text_width = label.boundingRect().width()
label.setX(-text_width/2)
at.router_annotations[rk].append(shape)

Loading…
Cancel
Save