Skip to content

Commit

Permalink
Set parent for VarExp editors to fix #5696 so they close with Spyder
Browse files Browse the repository at this point in the history
  • Loading branch information
CAM-Gerlach committed Mar 10, 2018
1 parent 7171f76 commit 7208279
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions spyder/widgets/variableexplorer/collectionseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def createEditor(self, parent, option, index):
or not is_known_type(value)
#---editor = CollectionsEditor
if isinstance(value, (list, tuple, dict)):
editor = CollectionsEditor()
editor = CollectionsEditor(parent)
editor.setup(value, key, icon=self.parent().windowIcon(),
readonly=readonly)
self.create_dialog(editor, dict(model=index.model(), editor=editor,
Expand Down Expand Up @@ -472,7 +472,7 @@ def createEditor(self, parent, option, index):
#--editor = DataFrameEditor
elif isinstance(value, (DataFrame, DatetimeIndex, Series)) \
and DataFrame is not FakeObject:
editor = DataFrameEditor()
editor = DataFrameEditor(parent)
if not editor.setup_and_check(value, title=key):
return
editor.dataModel.set_format(index.model().dataframe_format)
Expand All @@ -494,9 +494,10 @@ def createEditor(self, parent, option, index):
return editor
#---editor = TextEditor
elif is_text_string(value) and len(value) > 40:
te = TextEditor(None)
te = TextEditor(None, parent=parent)
if te.setup_and_check(value):
editor = TextEditor(value, key, readonly=readonly)
editor = TextEditor(value, key,
readonly=readonly, parent=parent)
self.create_dialog(editor, dict(model=index.model(),
editor=editor, key=key,
readonly=readonly))
Expand All @@ -517,7 +518,7 @@ def createEditor(self, parent, option, index):
return editor
#---editor = CollectionsEditor for an arbitrary object
else:
editor = CollectionsEditor()
editor = CollectionsEditor(parent)
editor.setup(value, key, icon=self.parent().windowIcon(),
readonly=readonly)
self.create_dialog(editor, dict(model=index.model(), editor=editor,
Expand Down

0 comments on commit 7208279

Please sign in to comment.