@@ -96,39 +96,6 @@ def dropMimeData(self, mime, action, row, column, parent):
9696 return True
9797
9898
99- class ClassVarListItemModel (VariablesListItemModel ):
100- def dropMimeData (self , mime , action , row , column , parent ):
101- """ Ensure only one variable can be dropped onto the view.
102- """
103- vars = mime .property ('_items' )
104- if vars is None :
105- return False
106- if action == Qt .IgnoreAction :
107- return True
108- return VariableListModel .dropMimeData (
109- self , mime , action , row , column , parent )
110-
111-
112- class ClassVariableItemView (VariablesListItemView ):
113- def __init__ (self , parent = None , acceptedType = Orange .data .Variable ):
114- VariablesListItemView .__init__ (self , parent , acceptedType )
115- self .setDropIndicatorShown (False )
116-
117- def acceptsDropEvent (self , event ):
118- """
119- Reimplemented
120-
121- Ensure only one variable is in the model.
122- """
123- accepts = super ().acceptsDropEvent (event )
124- mime = event .mimeData ()
125- vars = mime .property ('_items' )
126- if vars is None :
127- return False
128-
129- return accepts
130-
131-
13299class OWSelectAttributes (widget .OWWidget ):
133100 # pylint: disable=too-many-instance-attributes
134101 name = "Select Columns"
@@ -205,8 +172,8 @@ def dropcompleted(action):
205172 layout .addWidget (box , 0 , 2 , 1 , 1 )
206173
207174 box = gui .vBox (self .controlArea , "Target Variable" , addToLayout = False )
208- self .class_attrs = ClassVarListItemModel ( enable_dnd = True )
209- self .class_attrs_view = ClassVariableItemView (
175+ self .class_attrs = VariablesListItemModel ( )
176+ self .class_attrs_view = VariablesListItemView (
210177 acceptedType = (Orange .data .DiscreteVariable ,
211178 Orange .data .ContinuousVariable ))
212179 self .class_attrs_view .setModel (self .class_attrs )
0 commit comments