@@ -93,39 +93,6 @@ def dropMimeData(self, mime, action, row, column, parent):
9393 return True
9494
9595
96- class ClassVarListItemModel (VariablesListItemModel ):
97- def dropMimeData (self , mime , action , row , column , parent ):
98- """ Ensure only one variable can be dropped onto the view.
99- """
100- vars = mime .property ('_items' )
101- if vars is None :
102- return False
103- if action == Qt .IgnoreAction :
104- return True
105- return VariableListModel .dropMimeData (
106- self , mime , action , row , column , parent )
107-
108-
109- class ClassVariableItemView (VariablesListItemView ):
110- def __init__ (self , parent = None , acceptedType = Orange .data .Variable ):
111- VariablesListItemView .__init__ (self , parent , acceptedType )
112- self .setDropIndicatorShown (False )
113-
114- def acceptsDropEvent (self , event ):
115- """
116- Reimplemented
117-
118- Ensure only one variable is in the model.
119- """
120- accepts = super ().acceptsDropEvent (event )
121- mime = event .mimeData ()
122- vars = mime .property ('_items' )
123- if vars is None :
124- return False
125-
126- return accepts
127-
128-
12996class OWSelectAttributes (widget .OWWidget ):
13097 name = "Select Columns"
13198 description = "Select columns from the data table and assign them to " \
@@ -189,8 +156,8 @@ def dropcompleted(action):
189156 layout .addWidget (box , 0 , 2 , 1 , 1 )
190157
191158 box = gui .vBox (self .controlArea , "Target Variable" , addToLayout = False )
192- self .class_attrs = ClassVarListItemModel ( enable_dnd = True )
193- self .class_attrs_view = ClassVariableItemView (
159+ self .class_attrs = VariablesListItemModel ( )
160+ self .class_attrs_view = VariablesListItemView (
194161 acceptedType = (Orange .data .DiscreteVariable ,
195162 Orange .data .ContinuousVariable ))
196163 self .class_attrs_view .setModel (self .class_attrs )
0 commit comments