1515from Orange .widgets .widget import Msg
1616
1717
18- class VizRankDialog (QDialog , ProgressBarMixin ):
18+ class VizRankDialog (QDialog , ProgressBarMixin , WidgetMessagesMixin ):
1919 """
2020 Base class for VizRank dialogs, providing a GUI with a table and a button,
2121 and the skeleton for managing the evaluation of visualizations.
@@ -60,18 +60,24 @@ class VizRankDialog(QDialog, ProgressBarMixin):
6060
6161 processingStateChanged = Signal (int )
6262 progressBarValueChanged = Signal (float )
63+ messageActivated = Signal (Msg )
64+ messageDeactivated = Signal (Msg )
6365
6466 def __init__ (self , master ):
6567 """Initialize the attributes and set up the interface"""
66- super ().__init__ (windowTitle = self .captionTitle )
68+ QDialog .__init__ (self , windowTitle = self .captionTitle )
69+ WidgetMessagesMixin .__init__ (self )
70+ self .setLayout (QVBoxLayout ())
71+
72+ self .insert_message_bar ()
73+ self .layout ().insertWidget (0 , self .message_bar )
6774 self .master = master
6875
6976 self .keep_running = False
7077 self .saved_state = None
7178 self .saved_progress = 0
7279 self .scores = []
7380
74- self .setLayout (QVBoxLayout ())
7581 self .rank_model = QStandardItemModel (self )
7682 self .rank_table = view = QTableView (
7783 selectionBehavior = QTableView .SelectRows ,
@@ -206,7 +212,7 @@ def toggle(self):
206212 self .button .setText ("Continue" )
207213
208214
209- class VizRankDialogAttrPair (VizRankDialog , WidgetMessagesMixin ):
215+ class VizRankDialogAttrPair (VizRankDialog ):
210216 """
211217 VizRank dialog for pairs of attributes. The class provides most of the
212218 needed methods, except for `initialize` which is expected to store a
@@ -220,16 +226,14 @@ class VizRankDialogAttrPair(VizRankDialog, WidgetMessagesMixin):
220226 """
221227
222228 pairSelected = Signal (Variable , Variable )
223- messageActivated = Signal (Msg )
224- messageDeactivated = Signal (Msg )
225229
226230 _AttrRole = next (gui .OrangeUserRole )
227231
232+ class Information (VizRankDialog .Information ):
233+ nothing_to_rank = Msg ("There is nothing to rank." )
234+
228235 def __init__ (self , master ):
229236 VizRankDialog .__init__ (self , master )
230- WidgetMessagesMixin .__init__ (self )
231- self .insert_message_bar ()
232- self .layout ().insertWidget (0 , self .message_bar )
233237 self .resize (320 , 512 )
234238 self .attrs = []
235239
@@ -240,12 +244,10 @@ def sizeHint(self):
240244
241245 def check_preconditions (self ):
242246 """Refuse ranking if there are less than two feature or instances."""
243- self .master .Information .add_message (
244- "nothing_to_rank" , "There is nothing to rank." )
245247 can_rank = self .master .data is not None and \
246248 len (self .master .data .domain .attributes ) >= 2 and \
247249 len (self .master .data ) >= 2
248- self .master . Information .nothing_to_rank (shown = not can_rank )
250+ self .Information .nothing_to_rank (shown = not can_rank )
249251 return can_rank
250252
251253 def on_selection_changed (self , selected , deselected ):
0 commit comments