Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Orange/widgets/visualize/owmosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ def init_combos(self, data):
for combo in self.attr_combos:
combo.clear()
if data is None:
self.color_model.set_domain(None)
return
for combo in self.attr_combos[1:]:
combo.addItem("(None)")
Expand Down Expand Up @@ -440,6 +441,8 @@ def set_data(self, data):
and len(self.data.domain.attributes) >= 1)

if self.data is None:
self.discrete_data = None
self.init_combos(None)
return

self.color_model.set_domain(self.data.domain)
Expand Down
19 changes: 19 additions & 0 deletions Orange/widgets/visualize/tests/test_owmosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ def test_keyerror(self):
data = data[0:1]
self.send_signal(self.widget.Inputs.data, data)

def test_combos_and_mosaic(self):
"""
Text in combos is wiped away when there is no data and mosaic disappears as well.
GH-2459
GH-2462
"""
def assertCount(cb_color, cb_attr, areas):
self.assertEqual(len(self.widget.areas), areas)
self.assertEqual(self.widget.cb_attr_color.count(), cb_color)
for i, combo in enumerate(self.widget.attr_combos):
self.assertEqual(combo.count(), cb_attr[i])

data = Table("iris")
assertCount(1, [0, 0, 0, 0], 0)
self.send_signal(self.widget.Inputs.data, data)
assertCount(6, [5, 6, 6, 6], 16)
self.send_signal(self.widget.Inputs.data, None)
assertCount(1, [0, 0, 0, 0], 0)

# Derive from WidgetTest to simplify creation of the Mosaic widget, although
# we are actually testing the MosaicVizRank dialog and not the widget

Expand Down