Skip to content

Commit

Permalink
Change back to use common code from glue-core
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Aug 16, 2024
1 parent 428fd83 commit a98eeee
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions glue_qt/app/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,20 +1445,14 @@ def add_datasets(self, *args, **kwargs):
return result

def __gluestate__(self, context):
viewers = [list(map(context.id, tab)) for tab in self.viewers]
data = self.session.data_collection
from glue.main import _loaded_plugins
state = dict(session=context.id(self.session), viewers=viewers,
data=context.id(data), plugins=_loaded_plugins)
state = super().__gluestate__(context)
state['viewers'] = [list(map(context.id, tab)) for tab in self.viewers]
state['tab_names'] = self.tab_names
return state

@classmethod
def __setgluestate__(cls, rec, context):
self = cls(data_collection=context.object(rec['data']))
# manually register the newly-created session, which the viewers need
context.register_object(rec['session'], self.session)
self = super(GlueApplication, cls).__setgluestate__(rec, context)
self = super().__setgluestate__(rec, context)
for i, tab in enumerate(rec['viewers']):
if self.tab(i) is None:
self.new_tab()
Expand Down

0 comments on commit a98eeee

Please sign in to comment.