from __future__ import annotations

from prettyqt import core, widgets
from prettyqt.qt import QtWidgets


class GraphicsEllipseItem(
    widgets.AbstractGraphicsShapeItemMixin, QtWidgets.QGraphicsEllipseItem
):
    def __repr__(self):
        return f"{type(self).__name__}({repr(self.get_rect())})"

    def serialize_fields(self):
        return dict(
            rect=self.get_rect(),
            span_angle=self.spanAngle(),
            start_angle=self.startAngle(),
        )

    def get_rect(self) -> core.RectF:
        return core.RectF(self.rect())


if __name__ == "__main__":
    item = GraphicsEllipseItem()
    item.get_rect()
