Skip to content

Commit e9df453

Browse files
authored
Merge pull request #2510 from astrofrog/restore-session
Remove viewer-specific code from __gluestate__ and __setgluestate__ on base Application class
2 parents 6cb7094 + 41582d5 commit e9df453

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

glue/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def __getitem__(self, cmap_name):
390390

391391
def name_from_cmap(self, cmap_desired):
392392
for name, cmap in self.members:
393-
if cmap is cmap_desired:
393+
if cmap is cmap_desired or cmap.name == cmap_desired.name:
394394
return name
395395
raise ValueError("Could not find name for colormap")
396396

glue/core/application_base.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -352,22 +352,16 @@ def set_data_color(self, color, alpha):
352352
data.style.alpha = alpha
353353

354354
def __gluestate__(self, context):
355-
viewers = [list(map(context.id, tab)) for tab in self.viewers]
356355
data = self.session.data_collection
357356
from glue.main import _loaded_plugins
358-
return dict(session=context.id(self.session), viewers=viewers,
359-
data=context.id(data), plugins=_loaded_plugins)
357+
return dict(session=context.id(self.session),
358+
data=context.id(data),
359+
plugins=_loaded_plugins)
360360

361361
@classmethod
362362
def __setgluestate__(cls, rec, context):
363363
self = cls(data_collection=context.object(rec['data']))
364364
# manually register the newly-created session, which
365365
# the viewers need
366366
context.register_object(rec['session'], self.session)
367-
for i, tab in enumerate(rec['viewers']):
368-
if self.tab(i) is None:
369-
self.new_tab()
370-
for v in tab:
371-
viewer = context.object(v)
372-
self.add_widget(viewer, tab=i, hold_position=True)
373367
return self

0 commit comments

Comments
 (0)