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

This commit is contained in:
volaya 2014-08-14 10:56:08 +02:00
parent e02f0040d6
commit 8a2f1505d5
4 changed files with 18 additions and 21 deletions

View File

@ -39,15 +39,11 @@ from processing.core.GeoAlgorithmExecutionException import \
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 @@ class Input():
@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

View File

@ -36,7 +36,7 @@ from processing.gui.HelpEditionDialog import HelpEditionDialog
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 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
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

View File

@ -28,7 +28,7 @@ __revision__ = '$Format:%H$'
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 @@ class ModelerGraphicItem(QtGui.QGraphicsItem):
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 @@ class ModelerGraphicItem(QtGui.QGraphicsItem):
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 @@ class ModelerGraphicItem(QtGui.QGraphicsItem):
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 @@ class ModelerGraphicItem(QtGui.QGraphicsItem):
'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 @@ class ModelerGraphicItem(QtGui.QGraphicsItem):
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 @@ class ModelerGraphicItem(QtGui.QGraphicsItem):
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

View File

@ -29,7 +29,7 @@ from PyQt4.QtCore import *
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 @@ class ModelerParametersDialog(QtGui.QDialog):
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 @@ class ModelerParametersDialog(QtGui.QDialog):
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()