Skip to content

Commit

Permalink
Data info displayed in the status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
aturanjanin committed Mar 19, 2020
1 parent b838a6d commit 676d7f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Orange/widgets/data/owoutliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from Orange.widgets.utils.concurrent import TaskState, ConcurrentWidgetMixin
from Orange.widgets.utils.sql import check_sql_input
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.utils.state_summary import format_summary_details
from Orange.widgets.widget import Msg, Input, Output, OWWidget


Expand Down Expand Up @@ -265,7 +266,9 @@ def set_data(self, data):
self.cancel()
self.clear_messages()
self.data = data
self.info.set_input_summary(len(data) if data else self.info.NoOutput)
summary = len(data) if data else self.info.NoInput
details = format_summary_details(data) if data else ""
self.info.set_input_summary(summary, details)
self.enable_controls()
self.unconditional_commit()

Expand Down Expand Up @@ -294,7 +297,8 @@ def on_partial_result(self, _):
def on_done(self, result: Results):
inliers, outliers = result.inliers, result.outliers
summary = len(inliers) if inliers else self.info.NoOutput
self.info.set_output_summary(summary)
details = format_summary_details(inliers) if inliers else ""
self.info.set_output_summary(summary, details)
self.n_inliers = len(inliers) if inliers else None
self.n_outliers = len(outliers) if outliers else None

Expand Down
9 changes: 7 additions & 2 deletions Orange/widgets/data/tests/test_owoutliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from Orange.classification import LocalOutlierFactorLearner
from Orange.widgets.data.owoutliers import OWOutliers, run
from Orange.widgets.tests.base import WidgetTest, simulate
from Orange.widgets.utils.state_summary import format_summary_details


class TestRun(unittest.TestCase):
Expand Down Expand Up @@ -130,13 +131,17 @@ def test_nans(self):

def test_in_out_summary(self):
info = self.widget.info
data = self.iris
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()
self.assertEqual(info._StateInfo__input_summary.brief, "")
self.assertEqual(info._StateInfo__output_summary.brief, "")

self.send_signal(self.widget.Inputs.data, self.iris)
self.wait_until_finished()
self.assertEqual(info._StateInfo__input_summary.brief, "150")
self.assertIn(info._StateInfo__output_summary.brief, ["135", "136"])
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.inliers)
output_sum.assert_called_with(len(output), format_summary_details(output))

self.send_signal(self.widget.Inputs.data, None)
self.wait_until_finished()
Expand Down

0 comments on commit 676d7f5

Please sign in to comment.