2525from Orange .widgets .utils .plot import OWPlotGUI , SELECT , PANNING , ZOOMING
2626from Orange .widgets .utils .sql import check_sql_input
2727from Orange .widgets .utils .widgetpreview import WidgetPreview
28+ from Orange .widgets .utils .state_summary import format_summary_details
2829from Orange .widgets .visualize .owdistributions import LegendItem
2930from Orange .widgets .widget import OWWidget , Input , Output , Msg
3031
@@ -475,8 +476,6 @@ def _add_graph(self):
475476 box .layout ().addWidget (self .graph )
476477
477478 def _add_controls (self ):
478- infobox = gui .widgetBox (self .controlArea , "Info" )
479- self .infoLabel = gui .widgetLabel (infobox , "No data on input." )
480479 displaybox = gui .widgetBox (self .controlArea , "Display" )
481480 gui .checkBox (displaybox , self , "show_profiles" , "Lines" ,
482481 callback = self .__show_profiles_changed ,
@@ -505,6 +504,9 @@ def _add_controls(self):
505504 gui .rubber (self .controlArea )
506505 gui .auto_send (self .controlArea , self , "auto_commit" )
507506
507+ self .info .set_input_summary (self .info .NoInput )
508+ self .info .set_output_summary (self .info .NoOutput )
509+
508510 def __show_profiles_changed (self ):
509511 self .check_display_options ()
510512 self ._update_visibility ("profiles" )
@@ -534,6 +536,7 @@ def __group_var_changed(self):
534536 def set_data (self , data ):
535537 self .closeContext ()
536538 self .data = data
539+ self ._set_input_summary ()
537540 self .clear ()
538541 self .check_data ()
539542 self .check_display_options ()
@@ -555,8 +558,6 @@ def error(err):
555558
556559 self .clear_messages ()
557560 if self .data is not None :
558- self .infoLabel .setText ("%i instances on input\n %i features" % (
559- len (self .data ), len (self .data .domain .attributes )))
560561 self .graph_variables = [var for var in self .data .domain .attributes
561562 if var .is_continuous ]
562563 self .valid_data = ~ countnans (self .data .X , axis = 1 ).astype (bool )
@@ -580,6 +581,11 @@ def check_display_options(self):
580581 len (self .data [self .valid_data ]) < SEL_MAX_INSTANCES
581582 self .enable_selection .emit (enable )
582583
584+ def _set_input_summary (self ):
585+ summary = len (self .data ) if self .data else self .info .NoInput
586+ details = format_summary_details (self .data ) if self .data else ""
587+ self .info .set_input_summary (summary , details )
588+
583589 @Inputs .data_subset
584590 @check_sql_input
585591 def set_subset_data (self , subset ):
@@ -733,6 +739,10 @@ def commit(self):
733739 selected = self .data [self .selection ] \
734740 if self .data is not None and bool (self .selection ) else None
735741 annotated = create_annotated_table (self .data , self .selection )
742+
743+ summary = len (selected ) if selected else self .info .NoOutput
744+ details = format_summary_details (selected ) if selected else ""
745+ self .info .set_output_summary (summary , details )
736746 self .Outputs .selected_data .send (selected )
737747 self .Outputs .annotated_data .send (annotated )
738748
@@ -754,7 +764,6 @@ def clear(self):
754764 self .__groups = []
755765 self .graph_variables = []
756766 self .graph .reset ()
757- self .infoLabel .setText ("No data on input." )
758767 self .group_vars .set_domain (None )
759768 self .group_view .setEnabled (False )
760769
0 commit comments