28
28
29
29
import os
30
30
from PyQt4 import QtCore , QtGui
31
- from processing .modeler .ModelerAlgorithm import Input , Algorithm , Output
31
+ from processing .modeler .ModelerAlgorithm import ModelerParameter , Algorithm , ModelerOutput
32
32
from processing .modeler .ModelerParameterDefinitionDialog import \
33
33
ModelerParameterDefinitionDialog
34
34
from processing .modeler .ModelerParametersDialog import ModelerParametersDialog
@@ -43,12 +43,13 @@ def __init__(self, element, model):
43
43
super (ModelerGraphicItem , self ).__init__ (None , None )
44
44
self .model = model
45
45
self .element = element
46
- if isinstance (element , Input ):
46
+ print element .__class__
47
+ if isinstance (element , ModelerParameter ):
47
48
icon = QtGui .QIcon (os .path .dirname (__file__ )
48
49
+ '/../images/input.png' )
49
50
self .pixmap = icon .pixmap (20 , 20 , state = QtGui .QIcon .On )
50
51
self .text = element .param .description
51
- elif isinstance (element , Output ):
52
+ elif isinstance (element , ModelerOutput ):
52
53
# Output name
53
54
icon = QtGui .QIcon (os .path .dirname (__file__ )
54
55
+ '/../images/output.png' )
@@ -63,7 +64,7 @@ def __init__(self, element, model):
63
64
self .setFlag (QtGui .QGraphicsItem .ItemSendsGeometryChanges , True )
64
65
self .setZValue (1000 )
65
66
66
- if not isinstance (element , Output ):
67
+ if not isinstance (element , ModelerOutput ):
67
68
icon = QtGui .QIcon (os .path .dirname (__file__ )
68
69
+ '/../images/edit.png' )
69
70
pt = QtCore .QPointF (ModelerGraphicItem .BOX_WIDTH / 2
@@ -132,7 +133,7 @@ def mouseDoubleClickEvent(self, event):
132
133
self .editElement ()
133
134
134
135
def contextMenuEvent (self , event ):
135
- if isinstance (self .element , Output ):
136
+ if isinstance (self .element , ModelerOutput ):
136
137
return
137
138
popupmenu = QtGui .QMenu ()
138
139
removeAction = popupmenu .addAction ('Remove' )
@@ -161,7 +162,7 @@ def activateAlgorithm(self):
161
162
'Activate them them before trying to activate it.' )
162
163
163
164
def editElement (self ):
164
- if isinstance (self .element , Input ):
165
+ if isinstance (self .element , ModelerParameter ):
165
166
dlg = ModelerParameterDefinitionDialog (self .model ,
166
167
param = self .element .param )
167
168
dlg .exec_ ()
@@ -181,7 +182,7 @@ def editElement(self):
181
182
self .model .updateModelerView ()
182
183
183
184
def removeElement (self ):
184
- if isinstance (self .element , Input ):
185
+ if isinstance (self .element , ModelerParameter ):
185
186
if not self .model .removeParameter (self .element .param .name ):
186
187
QtGui .QMessageBox .warning (None , 'Could not remove element' ,
187
188
'Other elements depend on the selected one.\n '
@@ -217,7 +218,7 @@ def paint(self, painter, option, widget=None):
217
218
ModelerGraphicItem .BOX_HEIGHT + 2 )
218
219
painter .setPen (QtGui .QPen (QtCore .Qt .gray , 1 ))
219
220
color = QtGui .QColor (125 , 232 , 232 )
220
- if isinstance (self .element , Input ):
221
+ if isinstance (self .element , ModelerParameter ):
221
222
color = QtGui .QColor (179 , 179 , 255 )
222
223
elif isinstance (self .element , Algorithm ):
223
224
color = QtCore .Qt .white
0 commit comments