Skip to content

Conversation

@fariza
Copy link

@fariza fariza commented Jun 22, 2015

Adding figure attribute (property and setter)

Keeping a canvas property for pyplot stuff that uses direct acces to figuremanager.canvas, this could be easily removed within pyplot

@fariza
Copy link
Author

fariza commented Jun 22, 2015

The errors seem unrelated

@OceanWolf
Copy link
Owner

Yes, the same errors as I have in MEP27, just put in a fix for that...

@OceanWolf
Copy link
Owner

@fariza I think this will pass. I will give it a quick check over when I come back this evening and merge if okay and then I will work on the the Tom's nits.

Do you want to work on the example(s) as you know what you want to see. Also any idea how to fix the bug in the example? Basically a focus bug, with elements to the left, above of GTK gaining focus first, which means they get the keyboard events and not the canvas -> toolmanager, until you tab focus to the canvas.

On the stable release if you press tab the canvas looses focus, but I see that as a UI issue for another PR. Just want to make sure it has the correct focus if it has no user interaction...

@OceanWolf
Copy link
Owner

Very nice, I especially like how you use add in the canvas property. It keeps it the same, yet adds in an extra layer of validation meaning one can't change the figure and canvas independently :).

Copy link
Owner

Choose a reason for hiding this comment

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

This line looks redundant... this gets set with the next line.

Also do we want to have no figure?

Copy link
Author

Choose a reason for hiding this comment

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

Is not that we want to have no figure (when the figure will be changeable we'll want that option).
In general, I like to declare all the attributes at __init__ and I am not doing self._figure = self._set_figure(figure) because I want to transform that latter into a property setter.

@fariza
Copy link
Author

fariza commented Jun 25, 2015

In this moment I didn't introduce the possibility of FigureManager with figure=None.
I was planning on adding that latter (when changeable figures), but if you preffer, I can do it right now.

@OceanWolf
Copy link
Owner

@fariza Answering to your reply in the code and the comment above.

For me you already have introduced the possibility of figure=None from __init__. I prefer strict typing, if we say that it can equal None as we do in __init__ then we should keep that as a possibility throughout the rest of the code (the places I marked where the code will break).

I wondered what we would want to do with a figure=None, would that destroy the FigureManager?

I presume you mean you will later change the code in init to use getters/setters to self.figure = figure.

Maybe just convert the = None to a FIXME comment saying that we will turn it the next line into a setter method later?

@fariza
Copy link
Author

fariza commented Jun 25, 2015

what about just putting the setter in place right now? as you said self.figure = figure.

figure=None... I can image a scenario where you might want to configure your FigureManager before setting the figure in it. So I don't think destroy is the right choice.

@OceanWolf
Copy link
Owner

Okay, perhaps with a NotImplementedError if already set?

@fariza
Copy link
Author

fariza commented Jun 25, 2015

Now with a setter called at __init__, I don't think we have any more problems

@OceanWolf
Copy link
Owner

Nice, I will give it a quick test locally and merge 😄. Then I will work on improving the tool searching strategy using MEP27 (and then I think I can merge #2 directly into the main branch :).

So will you do a PR for examples? I don't mind if you don't, I just want to know if you will do it. Thanks :)

@fariza
Copy link
Author

fariza commented Jun 25, 2015

I want to work on the examples, but I don't know if I'll have the time today or tomorrow

@OceanWolf
Copy link
Owner

Okay, great, it just gives me one less thing to think about.

OceanWolf added a commit that referenced this pull request Jun 25, 2015
FigureManager manages the Figure and not the Canvas, pt2
@OceanWolf OceanWolf merged commit 18a36a3 into OceanWolf:backend-refactor Jun 25, 2015
@fariza fariza deleted the figuremanager-figure-centered branch June 25, 2015 16:08
OceanWolf pushed a commit that referenced this pull request Sep 14, 2015
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.

2 participants