Skip to content

Decide whether {get,set}_window_title should live on FigureCanvas or FigureManager #17721

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

Closed
anntzer opened this issue Jun 22, 2020 · 3 comments
Milestone

Comments

@anntzer
Copy link
Contributor

anntzer commented Jun 22, 2020

Bug report

Bug summary

Currently, FigureManagerBase defines {get,set}_window_title, which is overridden by the various gui-specific subclasses; FigureCanvasBase also defines {get,set}_window_title, which just forwards to the manager's method, but is a no-op otherwise. This has the consequence that one can call these methods on a canvas when embedding without using pyplot (#17716), but they will silently do nothing in that case, which... let's say qualifies as not nice behavior.

One option would be to just deprecate and remove the wrapper methods on canvas, and tell the user that they need to go through the manager (only possible if using pyplot) or gui-specific methods. Another option would be to instead move the main implementations to the canvas classes themselves (regardless of whether you're using pyplot or embedding, the notion of parent window for a FigureCanvasQt, for example, always makes sense, and one can always manipulate its title), and also move the gui-subclass-specific overrides to FigureCanvasFoo, and make the method on the manager just forward to the canvas. This would "always work", as a manager always has a canvas, but feels a bit dirty because we "sort of" want canvases to be only related to drawing and let the manager handle the windowing part.

Matplotlib version

  • Operating system:
  • Matplotlib version:
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:
@tacaswell tacaswell added this to the v3.4.0 milestone Jun 22, 2020
@tacaswell
Copy link
Member

(regardless of whether you're using pyplot or embedding, the notion of parent window for a FigureCanvasQt, for example, always makes sense, and one can always manipulate its title)

but the 1:1 mapping does not always make sense if users are doing their own thing (think many canvass in a TabLayout).

My instinct is to deprecate the canvas wrapper methods and promote manager to a more first-class concept (which is work @OceanWolf started a long time ago and we failed to follow through on).

@anntzer
Copy link
Contributor Author

anntzer commented Jun 22, 2020

I agree that if you're already doing embedding anyways then you may as well just use gui-specific methods to set the title.

@QuLogic
Copy link
Member

QuLogic commented Jul 8, 2021

I think this was decided in #17723.

@QuLogic QuLogic closed this as completed Jul 8, 2021
@QuLogic QuLogic modified the milestones: v3.5.0, v3.4.0 Jul 8, 2021
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

No branches or pull requests

3 participants