diff --git a/birdvisu/visualisation/annotators.py b/birdvisu/visualisation/annotators.py index dc6d92b..05d2b0d 100644 --- a/birdvisu/visualisation/annotators.py +++ b/birdvisu/visualisation/annotators.py @@ -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)