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

Loading…
Cancel
Save