Skip to content

Handle fallback from short_title to title in model. #70

Open
@danielballan

Description

@danielballan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions