def test_constructor(self): m1_param = ModuleParam( val="1.2", type="Float", alias="", ) m1_function = ModuleFunction( name="value", parameters=[m1_param], ) m1 = Module( id=0, name='Float', functions=[m1_function], ) m2 = Module() m2.name = "Float" m2.id = 0 f = ModuleFunction() f.name = "value" m2.functions.append(f) param = ModuleParam() param.strValue = "1.2" param.type = "Float" param.alias = "" f.params.append(param) assert m1 == m2
def test_constructor(self): m1_param = ModuleParam(val="1.2", type="Float", alias="", ) m1_function = ModuleFunction(name="value", parameters=[m1_param], ) m1 = Module(id=0, name='Float', functions=[m1_function], ) m2 = Module() m2.name = "Float" m2.id = 0 f = ModuleFunction() f.name = "value" m2.functions.append(f) param = ModuleParam() param.strValue = "1.2" param.type = "Float" param.alias = "" f.params.append(param) assert m1 == m2
def testComparisonOperators(self): f = ModuleFunction() f.name = "value" param = ModuleParam() param.strValue = "1.2" param.type = "Float" param.alias = "" f.addParameter(param) g = ModuleFunction() g.name = "value" param = ModuleParam() param.strValue = "1.2" param.type = "Float" param.alias = "" g.addParameter(param) assert f == g param = ModuleParam() param.strValue = "1.2" param.type = "Float" param.alias = "" g.addParameter(param) assert f != g
def testComparisonOperators(self): f = ModuleFunction() f.name = "value" param = ModuleParam() param.strValue = "1.2" param.type = "Float" param.alias = "" f.addParameter(param) g = ModuleFunction() g.name = "value" param = ModuleParam() param.strValue = "1.2" param.type = "Float" param.alias = "" g.addParameter(param) assert f == g param = ModuleParam() param.strValue = "1.2" param.type = "Float" param.alias = "" g.addParameter(param) assert f != g
def perform(self, pipeline, step): """ perform(pipeline: VisPipeline, step: int) -> None This will takes a pipeline and apply the interpolated values at step 'step' to the pipeline. Then return the updated pipeline """ m = pipeline.modules[self.module.id] f = ModuleFunction() f.name = self.function f.returnType = 'void' value = self.values[step] for v in value: p = ModuleParam() convert = {'int':'Integer', 'str':'String', 'float':'Float', 'double':'Float'} p.type = convert[type(v).__name__] p.strValue = str(v) f.params.append(p) m.functions.append(f)
def __init__(self, descriptor, var_strValue="", parent=None): """ QVariableInputForm(descriptor: ModuleDescriptor, var_strValue: str, parent: QWidget) -> QVariableInputForm Initialize with a vertical layout """ QtGui.QGroupBox.__init__(self, parent) self.setLayout(QtGui.QGridLayout()) self.layout().setMargin(5) self.layout().setSpacing(5) self.setFocusPolicy(QtCore.Qt.ClickFocus) self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) self.palette().setColor(QtGui.QPalette.Window, CurrentTheme.METHOD_SELECT_COLOR) # Create widget for editing variable p = ModuleParam(type=descriptor.name, identifier=descriptor.identifier, namespace=descriptor.namespace) p.strValue = var_strValue widget_type = get_widget_class(descriptor.module) self.widget = widget_type(p, self) self.label = QDragVariableLabel(p.type) self.layout().addWidget(self.label, 0, 0) self.layout().addWidget(self.widget, 0, 1) self.updateMethod()
def perform(self, pipeline, step): """ perform(pipeline: VisPipeline, step: int) -> None This will takes a pipeline and apply the interpolated values at step 'step' to the pipeline. Then return the updated pipeline """ m = pipeline.modules[self.module.id] f = ModuleFunction() f.name = self.function f.returnType = 'void' value = self.values[step] for v in value: p = ModuleParam() convert = { 'int': 'Integer', 'str': 'String', 'float': 'Float', 'double': 'Float' } p.type = convert[type(v).__name__] p.strValue = str(v) f.params.append(p) m.functions.append(f)