@@ -199,6 +199,7 @@ def __init__(self, widget):
199199 widget .contextAboutToBeOpened .connect (lambda args : self .set_domain (args [0 ]))
200200 widget .contextOpened .connect (lambda : self .model ().set_variables (self .variables ))
201201 widget .contextClosed .connect (lambda : self .model ().set_variables ([]))
202+ self .widget = widget
202203
203204 self .setModel (VarTableModel (self .variables , self ))
204205
@@ -268,6 +269,7 @@ def get_domain(self, domain, data):
268269 variables = self .model ().variables
269270 places = [[], [], []] # attributes, class_vars, metas
270271 cols = [[], [], []] # Xcols, Ycols, Mcols
272+ self .widget .Warning .performance_warning .clear ()
271273
272274 def numbers_are_round (var , col_data ):
273275 if type (var ) == ContinuousVariable :
@@ -304,6 +306,11 @@ def numbers_are_round(var, col_data):
304306 var = orig_var
305307 elif tpe == DiscreteVariable :
306308 values = list (str (i ) for i in unique (col_data ) if not self ._is_missing (i ))
309+ # since some widgets performs poor when number of discrete
310+ # variables is high, it will warn when user who set a variable
311+ # with more than 100 unique values as discrete
312+ if len (values ) > 100 :
313+ self .widget .Warning .performance_warning ()
307314 round_numbers = numbers_are_round (orig_var , col_data )
308315 col_data = [np .nan if self ._is_missing (x ) else values .index (str (x ))
309316 for x in self ._iter_vals (col_data )]
0 commit comments