Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] FreeViz: new widget #2512

Merged
merged 6 commits into from
Oct 13, 2017
Merged

[ENH] FreeViz: new widget #2512

merged 6 commits into from
Oct 13, 2017

Conversation

jerneju
Copy link
Contributor

@jerneju jerneju commented Jul 31, 2017

Issue

No FreeViz widget.

Description of changes
  1. Icon needed (Issue Freeviz: icon needed #2519 ). Maybe we can use Linear Projection's icon.
  2. Tests coverage so far: 82% (Scatter Plot has 74%) Missing GUI tests!
  3. Scripting part in a separate PR (need to discuss with somebody).
  4. Now can handle data sets with many attributes.
  5. Highly recommended that PR Move common things from Scatter Plot to SP Graph and Plot GUI #2541 is accepted and merged before this PR. DONE
Includes
  • Code changes
  • Tests
  • Documentation

@codecov-io
Copy link

codecov-io commented Aug 2, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@135c67d). Click here to learn what that means.
The diff coverage is 75.6%.

@@            Coverage Diff            @@
##             master    #2512   +/-   ##
=========================================
  Coverage          ?   75.74%           
=========================================
  Files             ?      337           
  Lines             ?    59433           
  Branches          ?        0           
=========================================
  Hits              ?    45016           
  Misses            ?    14417           
  Partials          ?        0

@jerneju jerneju changed the title [WIP][ENH] FreeViz: new widget [ENH] FreeViz: new widget Aug 2, 2017
@jerneju jerneju changed the title [ENH] FreeViz: new widget [ENH] Freeviz: new widget Aug 4, 2017
@jerneju jerneju mentioned this pull request Aug 4, 2017
@jerneju jerneju changed the title [ENH] Freeviz: new widget [WIP][ENH] Freeviz: new widget Aug 25, 2017
@janezd janezd mentioned this pull request Sep 14, 2017
3 tasks
self.updateText()


class AxisItem(pg.GraphicsObject):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

antiAlias=True

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that looks better.

@janezd
Copy link
Contributor

janezd commented Oct 5, 2017

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.

@jerneju
Copy link
Contributor Author

jerneju commented Oct 6, 2017

@janezd: Thank you for the comments. Scripting part (#2563) is ok?

@jerneju jerneju changed the title [WIP][ENH] Freeviz: new widget [ENH] Freeviz: new widget Oct 9, 2017
Copy link
Contributor

@janezd janezd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve merging this, after merging #2563 (which needs a few minor changes) and consequently rebasing this PR to #2563.

@janezd
Copy link
Contributor

janezd commented Oct 9, 2017

If we merge this, the icon I proposed can be used until @larazupan provides a better one.

@jerneju jerneju changed the title [ENH] Freeviz: new widget [ENH] FreeViz: new widget Oct 11, 2017
@jerneju
Copy link
Contributor Author

jerneju commented Oct 13, 2017

@janezd : rebased.

@janezd janezd merged commit 5f61ea6 into biolab:master Oct 13, 2017
@jerneju jerneju deleted the freeviz branch October 13, 2017 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants