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

Handle fallback from short_title to title in model. #70

Open
danielballan opened this issue Dec 7, 2020 · 0 comments
Open

Handle fallback from short_title to title in model. #70

danielballan opened this issue Dec 7, 2020 · 0 comments

Comments

@danielballan
Copy link
Member

In the views, we fall back and use title if short_title is None. Example:

def _on_short_title_changed(self, event):
"This sets the tab title."
figure_spec = event.figure_spec
widget = self._figures[figure_spec.uuid]
index = self.children.index(widget)
# Fall back to title if short_title is being unset.
if event.value is None:
self.set_title(index, figure_spec.title)
else:
self.set_title(index, event.value)
def _on_title_changed(self, event):
"This sets the tab title only if short_title is None."
figure_spec = event.figure_spec
if figure_spec.short_title is None:
widget = self._figures[figure_spec.uuid]
index = self.children.index(widget)
self.set_title(index, event.value)

This should probably be moved to the model because:

  1. It's duplicated in the various views.
  2. We might want to make it fall back even further to axes_spec.title if figure_spec.title is None.
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

1 participant