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

remove .rect member (clashes with QWidget) #2946

Merged
merged 3 commits into from Apr 27, 2014

Conversation

hmeine
Copy link
Contributor

@hmeine hmeine commented Apr 2, 2014

FigureCanvasQTAgg inherits from QWidget, which already has a 'rect'
property and getter.

FigureCanvasQTAgg inherits from QWidget, which already has a 'rect'
property and getter.

Also, consolidate .rect and (boolean) .drawRect into a single _drawRect
member.  This is only used for the zoom rect and not accessed from other
classes (other than indirectly via the drawRectangle() function).
@@ -115,10 +113,10 @@ def paintEvent(self, e):
p.drawPixmap(QtCore.QPoint(0, 0), QtGui.QPixmap.fromImage(qImage))

# draw the zoom rectangle to the QPainter
if self.drawRect:
if self._drawRect:
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to if self._drawRect is not None: ? I know that it is valid and correct python as-written, however I think it is clearer to do the conversion to bool explicitly.

@tacaswell
Copy link
Member

Could you also add a note in api_change.rst and CHANGELOG? It looks like this was always an internal-only attribute, but this is an api change and should be documented as such.

It looks like a bunch of widgets in matplotlib/widgets.py and mpl_examples/widgets/menu.py also have an attribute rect. Can you verify that they are independent of this change?

@tacaswell tacaswell added this to the v1.4.0 milestone Apr 2, 2014
@hmeine
Copy link
Contributor Author

hmeine commented Apr 2, 2014

Thanks for the comments; I have made the suggested changes.

I also looked at matplotlib/widgets.py and mpl_examples/widgets/menu.py; they are independent in the sense that they do not access the same variable, and the corresponding classes are GUI-independent (i.e., do not derive from QWidget).

@tacaswell
Copy link
Member

Great. Looks good to me.

Going to hold off on merging for further feed back and so I can use this day-to-day for a bit but it will get in for 1.4.

tacaswell added a commit that referenced this pull request Apr 27, 2014
remove .rect member (clashes with QWidget)
@tacaswell tacaswell merged commit 4edc4c2 into matplotlib:master Apr 27, 2014
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.

None yet

3 participants