[ENH] FreeViz: new widget#2512
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2512 +/- ##
=========================================
Coverage ? 75.74%
=========================================
Files ? 337
Lines ? 59433
Branches ? 0
=========================================
Hits ? 45016
Misses ? 14417
Partials ? 0 |
| self.updateText() | ||
|
|
||
|
|
||
| class AxisItem(pg.GraphicsObject): |
There was a problem hiding this comment.
When checking the widget, I saw it uses AxisItem, I read the pg's documentation about it and it didn't make sense. Only then I noticed the this module defines a class with the same name, AxisItem, but no relation with the pg's class (or have I overlooked it?). Please rename.
There was a problem hiding this comment.
No, this class is not related to pg.AxisItem. Renamed.
|
|
||
| self._arrow = pg.ArrowItem(parent=self, angle=0) | ||
| self._arrow.setPos(self._spine.line().p2()) | ||
| self._arrow.setRotation(angle) |
There was a problem hiding this comment.
At least for FreeViz, I'd prefer also adding self._arrow.setStyle(headLen=10).
| circle = pg.PlotCurveItem( | ||
| x=circle_x, y=circle_y, | ||
| pen=pg.mkPen(color, width=3), | ||
| antialias=False |
There was a problem hiding this comment.
However, I think that this looks better and more informative.
class MoveIndicator(pg.GraphicsObject):
def __init__(self, x, y, parent=None, line=QLineF(), text="", **kwargs):
super().__init__(parent, **kwargs)
self.arrows = [
pg.ArrowItem(pos=(x - 0.07 * cos(radians(angle)),
y + 0.07 * sin(radians(angle))),
parent=self, angle=angle,
headLen=13, tipAngle=45,
brush=pg.mkColor(128, 128, 128))
for angle in (0, 90, 180, 270)]
def paint(self, painter, option, widget):
pass
def boundingRect(self):
return QRectF()
def add_circle(x, y):
return MoveIndicator(x, y)
Of course, eliminate add_circle and use MoveIndicator directly in the code.
There was a problem hiding this comment.
Yes, that looks better.
|
If you mark a selection (that is, click in the graph and start dragging) and you approach the arrow, the move indicator (currently a blue circle) appears. These shouldn't appear while selecting. |
|
If we merge this, the icon I proposed can be used until @larazupan provides a better one. |
|
@janezd : rebased. |
Issue
No FreeViz widget.
Description of changes
Includes