Skip to content
Permalink
Browse files

[processing] renamed Input and Output classes in modeler, to avoid co…

…nfusion
  • Loading branch information
volaya committed Aug 14, 2014
1 parent e02f004 commit 8a2f1505d56f67aad353df37ecc7f35a0cb6f291
@@ -39,15 +39,11 @@
GeoAlgorithmExecutionException
from processing.gui.Help2Html import getHtmlFromHelpFile
from processing.modeler.ModelerUtils import ModelerUtils
from processing.core.parameters import ParameterRaster
from processing.core.parameters import ParameterDataObject
from processing.core.parameters import ParameterExtent
from processing.core.parameters import ParameterMultipleInput
from processing.core.parameters import ParameterVector
from processing.core.parameters import *
from processing.tools import dataobjects


class Input():
class ModelerParameter():

def __init__(self, param=None, pos=None):
self.param = param
@@ -58,10 +54,10 @@ def todict(self):

@staticmethod
def fromdict(d):
return Input(d["param"], d["pos"])
return ModelerParameter(d["param"], d["pos"])


class Output():
class ModelerOutput():

def __init__(self, description=""):
self.description = description
@@ -36,7 +36,7 @@
from processing.gui.ParametersDialog import ParametersDialog
from processing.gui.AlgorithmClassification import AlgorithmDecorator
from processing.modeler.ModelerParameterDefinitionDialog import ModelerParameterDefinitionDialog
from processing.modeler.ModelerAlgorithm import ModelerAlgorithm, Input
from processing.modeler.ModelerAlgorithm import ModelerAlgorithm, ModelerParameter
from processing.modeler.ModelerParametersDialog import ModelerParametersDialog
from processing.modeler.ModelerUtils import ModelerUtils
from processing.modeler.ModelerScene import ModelerScene
@@ -365,7 +365,7 @@ def addInputOfType(self, paramType, pos=None):
pos = self.getPositionForParameterItem()
if isinstance(pos, QPoint):
pos = QPointF(pos)
self.alg.addParameter(Input(dlg.param, pos))
self.alg.addParameter(ModelerParameter(dlg.param, pos))
self.repaintModel()
#self.view.ensureVisible(self.scene.getLastParameterItem())
self.hasChanged = True
@@ -28,7 +28,7 @@

import os
from PyQt4 import QtCore, QtGui
from processing.modeler.ModelerAlgorithm import Input, Algorithm, Output
from processing.modeler.ModelerAlgorithm import ModelerParameter, Algorithm, ModelerOutput
from processing.modeler.ModelerParameterDefinitionDialog import \
ModelerParameterDefinitionDialog
from processing.modeler.ModelerParametersDialog import ModelerParametersDialog
@@ -43,12 +43,13 @@ def __init__(self, element, model):
super(ModelerGraphicItem, self).__init__(None, None)
self.model = model
self.element = element
if isinstance(element, Input):
print element.__class__
if isinstance(element, ModelerParameter):
icon = QtGui.QIcon(os.path.dirname(__file__)
+ '/../images/input.png')
self.pixmap = icon.pixmap(20, 20, state=QtGui.QIcon.On)
self.text = element.param.description
elif isinstance(element, Output):
elif isinstance(element, ModelerOutput):
# Output name
icon = QtGui.QIcon(os.path.dirname(__file__)
+ '/../images/output.png')
@@ -63,7 +64,7 @@ def __init__(self, element, model):
self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, True)
self.setZValue(1000)

if not isinstance(element, Output):
if not isinstance(element, ModelerOutput):
icon = QtGui.QIcon(os.path.dirname(__file__)
+ '/../images/edit.png')
pt = QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH / 2
@@ -132,7 +133,7 @@ def mouseDoubleClickEvent(self, event):
self.editElement()

def contextMenuEvent(self, event):
if isinstance(self.element, Output):
if isinstance(self.element, ModelerOutput):
return
popupmenu = QtGui.QMenu()
removeAction = popupmenu.addAction('Remove')
@@ -161,7 +162,7 @@ def activateAlgorithm(self):
'Activate them them before trying to activate it.')

def editElement(self):
if isinstance(self.element, Input):
if isinstance(self.element, ModelerParameter):
dlg = ModelerParameterDefinitionDialog(self.model,
param=self.element.param)
dlg.exec_()
@@ -181,7 +182,7 @@ def editElement(self):
self.model.updateModelerView()

def removeElement(self):
if isinstance(self.element, Input):
if isinstance(self.element, ModelerParameter):
if not self.model.removeParameter(self.element.param.name):
QtGui.QMessageBox.warning(None, 'Could not remove element',
'Other elements depend on the selected one.\n'
@@ -217,7 +218,7 @@ def paint(self, painter, option, widget=None):
ModelerGraphicItem.BOX_HEIGHT + 2)
painter.setPen(QtGui.QPen(QtCore.Qt.gray, 1))
color = QtGui.QColor(125, 232, 232)
if isinstance(self.element, Input):
if isinstance(self.element, ModelerParameter):
color = QtGui.QColor(179, 179, 255)
elif isinstance(self.element, Algorithm):
color = QtCore.Qt.white
@@ -29,7 +29,7 @@
from PyQt4.QtGui import *
from PyQt4 import QtCore, QtGui, QtWebKit
from processing.modeler.ModelerAlgorithm import ValueFromInput,\
ValueFromOutput, Algorithm, Output
ValueFromOutput, Algorithm, ModelerOutput
from processing.gui.CrsSelectionPanel import CrsSelectionPanel
from processing.gui.MultipleInputPanel import MultipleInputPanel
from processing.gui.FixedTablePanel import FixedTablePanel
@@ -165,7 +165,7 @@ def setupUi(self):
self.webView = QtWebKit.QWebView()

html = None
url = None
url = None
isText, help = self._alg.help()
if help is not None:
if isText:
@@ -467,7 +467,7 @@ def createAlgorithm(self):
if not output.hidden:
name = unicode(self.valueItems[output.name].text())
if name.strip() != '' and name != ModelerParametersDialog.ENTER_NAME:
alg.outputs[output.name] = Output(name)
alg.outputs[output.name] = ModelerOutput(name)

selectedOptions = self.dependenciesPanel.selectedoptions
availableDependencies = self.getAvailableDependencies()

0 comments on commit 8a2f150

Please sign in to comment.
You can’t perform that action at this time.