Skip to content

Commit

Permalink
Merge pull request #4544 from VesnaT/proj_base_info_summary
Browse files Browse the repository at this point in the history
[ENH] OWDataProjectionWidget: Upgrade status bar data info
  • Loading branch information
janezd authored Mar 20, 2020
2 parents 6fc0741 + 1d74e68 commit 349d7d8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
14 changes: 14 additions & 0 deletions Orange/widgets/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,10 @@ def test_in_out_summary(self, timeout=DEFAULT_TIMEOUT):
info = self.widget.info
self.assertEqual(info._StateInfo__input_summary.brief, "")
self.assertEqual(info._StateInfo__output_summary.brief, "")
self.assertIn(info._StateInfo__input_summary.details,
["", "No data on input"])
self.assertIn(info._StateInfo__output_summary.details,
["", "No data on output"])

self.send_signal(self.widget.Inputs.data, self.data)
self.assertTrue(
Expand All @@ -761,10 +765,20 @@ def test_in_out_summary(self, timeout=DEFAULT_TIMEOUT):
self.assertEqual(info._StateInfo__input_summary.brief,
str(len(self.data)))
self.assertEqual(info._StateInfo__output_summary.brief, str(len(ind)))
self.assertGreater(info._StateInfo__input_summary.details, "")
self.assertGreater(info._StateInfo__output_summary.details, "")
self.assertNotIn(info._StateInfo__input_summary.details,
["", "No data on input"])
self.assertNotIn(info._StateInfo__output_summary.details,
["", "No data on output"])

self.send_signal(self.widget.Inputs.data, None)
self.assertEqual(info._StateInfo__input_summary.brief, "")
self.assertEqual(info._StateInfo__output_summary.brief, "")
self.assertIn(info._StateInfo__input_summary.details,
["", "No data on input"])
self.assertIn(info._StateInfo__output_summary.details,
["", "No data on output"])


class AnchorProjectionWidgetTestMixin(ProjectionWidgetTestMixin):
Expand Down
11 changes: 7 additions & 4 deletions Orange/widgets/visualize/utils/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
)
from Orange.widgets.utils.plot import OWPlotGUI
from Orange.widgets.utils.sql import check_sql_input
from Orange.widgets.utils.state_summary import format_summary_details
from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotBase
from Orange.widgets.visualize.utils.component import OWGraphWithAnchors
from Orange.widgets.widget import OWWidget, Input, Output, Msg
Expand Down Expand Up @@ -482,12 +483,14 @@ def _handle_subset_data(self):
self.Warning.subset_not_subset()

def set_input_summary(self, data):
summary = str(len(data)) if data else self.info.NoInput
self.info.set_input_summary(summary)
summary = len(data) if data else self.info.NoInput
detail = format_summary_details(data) if data else ""
self.info.set_input_summary(summary, detail)

def set_output_summary(self, data):
summary = str(len(data)) if data else self.info.NoOutput
self.info.set_output_summary(summary)
summary = len(data) if data else self.info.NoOutput
detail = format_summary_details(data) if data else ""
self.info.set_output_summary(summary, detail)

def get_subset_mask(self):
if not self.subset_indices:
Expand Down

0 comments on commit 349d7d8

Please sign in to comment.