def createTabs(self, params): b = BlockInfo(None, "/Foo") for p in params: b.addParameter(p) t = ParamsByGroup(b, params) t.resize(480, 480) t.addName("some name") t.addUserParam("user_param") t.needBlockList.connect(lambda paths: self.needBlockList(t, paths)) t.updateWatchers() if params: self.assertEqual(self.block_list_requested, 1) t.show() return t
def createTabs(self, params): b = BlockInfo(None, "/Foo") for p in params: b.addParameter(p) tmap = {"VariableName": ["/Variables"]} t = ParamsByGroup(b, params, tmap) t.resize(480, 480) t.addName("some name") t.addUserParam("user_param") t.needBlockList.connect(lambda paths: self.needBlockList(t, paths)) t.updateWatchers() if params: self.assertEqual(self.block_list_requested, 1) t.show() return t
def createTable(self, params): b = BlockInfo(None, "/Foo") for p in params: b.addParameter(p) tmap = {"VariableName": ["/Variables", "/AuxVariables"]} t = ParamsTable(b, params, tmap) t.resize(480, 480) t.addName("some name") t.addName("some name") # shouldn't be a problem t.addUserParam("user_param") t.needBlockList.connect(lambda paths: self.needBlockList(t, paths)) t.changed.connect(self.onChanged) t.updateWatchers() if params: self.assertEqual(self.block_list_requested, 1) t.show() return t
def testTypes(self): b = BlockInfo(None, "/Foo", False, "") self.assertEqual(b.paramValue("type"), None) b.setBlockType("t") # shouldn't do anything p = ParameterInfo(None, "type") b.addParameter(p) self.assertEqual(p.parent, b) self.assertEqual(b.paramValue("type"), "") b.setBlockType("t") # shouldn't do anything self.assertEqual(b.paramValue("type"), "t") b1 = BlockInfo(None, "/Foo/t", False, "") p = ParameterInfo(None, "p") b1.addParameter(p) b.types[b1.name] = b1 self.assertEqual(b.paramValue("p"), "") b.setParamValue("p", "val") self.assertEqual(b.paramValue("p"), "val") b.setBlockType("t1") self.assertEqual(b.paramValue("p"), None)
def testTypes(self): b = BlockInfo(None, "/Foo", False, "") self.assertEqual(b.paramValue("type"), None) b.setBlockType("t") # shouldn't do anything p = ParameterInfo(None, "type") b.addParameter(p) self.assertEqual(p.parent, b) self.assertEqual(b.paramValue("type"), "") b.setBlockType("t") # shouldn't do anything self.assertEqual(b.paramValue("type"), "t") b1 = BlockInfo(None, "/Foo/t", False, "") p = ParameterInfo(None, "p") b1.addParameter(p) b.types[b1.name] = b1 self.assertEqual(b.paramValue("p"), "") b.setParamValue("p", "val") self.assertEqual(b.paramValue("p"), "val") b.setBlockType("t1") self.assertEqual(b.paramValue("p"), None)
def testUserParams(self): b = BlockInfo(None, "/Foo", False, "") p = ParameterInfo(None, "p") p.user_added = False b.addParameter(p) b.addUserParam("bar", "val") b.addUserParam("bar", "val") p = b.getParamInfo("bar") self.assertEqual(p.user_added, True) self.assertEqual(b.paramValue("bar"), "val") b.setParamValue("bar", "val1") self.assertEqual(b.paramValue("bar"), "val1") b.removeUserParam("bar1") self.assertEqual(b.paramValue("bar"), "val1") b.removeUserParam("p") self.assertEqual(b.paramValue("p"), "") b.removeUserParam("bar") self.assertEqual(b.paramValue("bar"), None) self.assertNotIn("bar", b.parameters_list) self.assertNotIn("bar", b.parameters) b.addUserParam("bar", "val") b.addUserParam("foo", "val1") self.assertEqual(len(b.parameters_list), 3) self.assertEqual(b.parameters_list.index("bar"), 1) self.assertEqual(b.parameters_list.index("foo"), 2) b.moveUserParam("foo", 0) self.assertEqual(b.parameters_list.index("bar"), 2) self.assertEqual(b.parameters_list.index("foo"), 0) b.renameUserParam("bar1", "bar2") b.renameUserParam("p", "bar2") self.assertEqual(b.paramValue("bar2"), None) b.renameUserParam("bar", "bar1") self.assertEqual(b.paramValue("bar"), None) self.assertEqual(b.paramValue("bar1"), "val")
def testUserParams(self): b = BlockInfo(None, "/Foo", False, "") p = ParameterInfo(None, "p") p.user_added = False b.addParameter(p) b.addUserParam("bar", "val") b.addUserParam("bar", "val") p = b.getParamInfo("bar") self.assertEqual(p.user_added, True) self.assertEqual(b.paramValue("bar"), "val") b.setParamValue("bar", "val1") self.assertEqual(b.paramValue("bar"), "val1") b.removeUserParam("bar1") self.assertEqual(b.paramValue("bar"), "val1") b.removeUserParam("p") self.assertEqual(b.paramValue("p"), "") b.removeUserParam("bar") self.assertEqual(b.paramValue("bar"), None) self.assertNotIn("bar", b.parameters_list) self.assertNotIn("bar", b.parameters) b.addUserParam("bar", "val") b.addUserParam("foo", "val1") self.assertEqual(len(b.parameters_list), 3) self.assertEqual(b.parameters_list.index("bar"), 1) self.assertEqual(b.parameters_list.index("foo"), 2) b.moveUserParam("foo", 0) self.assertEqual(b.parameters_list.index("bar"), 2) self.assertEqual(b.parameters_list.index("foo"), 0) b.renameUserParam("bar1", "bar2") b.renameUserParam("p", "bar2") self.assertEqual(b.paramValue("bar2"), None) b.renameUserParam("bar", "bar1") self.assertEqual(b.paramValue("bar"), None) self.assertEqual(b.paramValue("bar1"), "val")
def createTypes(self): b = BlockInfo(None, "Foo") b.addParameter(self.createParam("type")) b.addParameter(self.createParam("parent0")) b.addParameter(self.createParam("parent1")) b.addParameter(self.createParam("parent2")) for i in range(4): bt = BlockInfo(b, "type_%s" % i) b.addBlockType(bt) self.createParams(bt) return b
def createTypes(self): b = BlockInfo(None, "Foo") b.addParameter(self.createParam("type")) b.addParameter(self.createParam("parent0")) b.addParameter(self.createParam("parent1")) b.addParameter(self.createParam("parent2")) for i in range(4): bt = BlockInfo(b, "type_%s" % i) b.addBlockType(bt) self.createParams(bt) return b