2828
2929import os
3030from PyQt4 import QtCore , QtGui
31- from processing .modeler .ModelerAlgorithm import Input , Algorithm , Output
31+ from processing .modeler .ModelerAlgorithm import ModelerParameter , Algorithm , ModelerOutput
3232from processing .modeler .ModelerParameterDefinitionDialog import \
3333 ModelerParameterDefinitionDialog
3434from processing .modeler .ModelerParametersDialog import ModelerParametersDialog
@@ -43,12 +43,13 @@ def __init__(self, element, model):
4343 super (ModelerGraphicItem , self ).__init__ (None , None )
4444 self .model = model
4545 self .element = element
46- if isinstance (element , Input ):
46+ print element .__class__
47+ if isinstance (element , ModelerParameter ):
4748 icon = QtGui .QIcon (os .path .dirname (__file__ )
4849 + '/../images/input.png' )
4950 self .pixmap = icon .pixmap (20 , 20 , state = QtGui .QIcon .On )
5051 self .text = element .param .description
51- elif isinstance (element , Output ):
52+ elif isinstance (element , ModelerOutput ):
5253 # Output name
5354 icon = QtGui .QIcon (os .path .dirname (__file__ )
5455 + '/../images/output.png' )
@@ -63,7 +64,7 @@ def __init__(self, element, model):
6364 self .setFlag (QtGui .QGraphicsItem .ItemSendsGeometryChanges , True )
6465 self .setZValue (1000 )
6566
66- if not isinstance (element , Output ):
67+ if not isinstance (element , ModelerOutput ):
6768 icon = QtGui .QIcon (os .path .dirname (__file__ )
6869 + '/../images/edit.png' )
6970 pt = QtCore .QPointF (ModelerGraphicItem .BOX_WIDTH / 2
@@ -132,7 +133,7 @@ def mouseDoubleClickEvent(self, event):
132133 self .editElement ()
133134
134135 def contextMenuEvent (self , event ):
135- if isinstance (self .element , Output ):
136+ if isinstance (self .element , ModelerOutput ):
136137 return
137138 popupmenu = QtGui .QMenu ()
138139 removeAction = popupmenu .addAction ('Remove' )
@@ -161,7 +162,7 @@ def activateAlgorithm(self):
161162 'Activate them them before trying to activate it.' )
162163
163164 def editElement (self ):
164- if isinstance (self .element , Input ):
165+ if isinstance (self .element , ModelerParameter ):
165166 dlg = ModelerParameterDefinitionDialog (self .model ,
166167 param = self .element .param )
167168 dlg .exec_ ()
@@ -181,7 +182,7 @@ def editElement(self):
181182 self .model .updateModelerView ()
182183
183184 def removeElement (self ):
184- if isinstance (self .element , Input ):
185+ if isinstance (self .element , ModelerParameter ):
185186 if not self .model .removeParameter (self .element .param .name ):
186187 QtGui .QMessageBox .warning (None , 'Could not remove element' ,
187188 'Other elements depend on the selected one.\n '
@@ -217,7 +218,7 @@ def paint(self, painter, option, widget=None):
217218 ModelerGraphicItem .BOX_HEIGHT + 2 )
218219 painter .setPen (QtGui .QPen (QtCore .Qt .gray , 1 ))
219220 color = QtGui .QColor (125 , 232 , 232 )
220- if isinstance (self .element , Input ):
221+ if isinstance (self .element , ModelerParameter ):
221222 color = QtGui .QColor (179 , 179 , 255 )
222223 elif isinstance (self .element , Algorithm ):
223224 color = QtCore .Qt .white
0 commit comments