def validate_scout_range(node, **_): """Set valid tickmark for scout range spec. TODO Currently we only validate that the spec produces valid frames. We should also validate that at least one scout frame exist in the main frame range. """ takes.enable_for_current(node, "scout_valid") spec = node.parm("scout_frames").eval() valid = Sequence.is_valid_spec(spec) node.parm("scout_valid").set(valid) update_frame_stats_message(node)
def validate_custom_range(node, **_): """Set valid tickmark for custom range spec. A custom range is valid when it is a comma separated list of arithmetic progressions. These can can be formatted as single numbers or ranges with a hyphen and optionally a step value delimited by an x. Example, 1,7,10-20,30-60x3,1001, Spaces and trailing commas are allowed, but not letters or other non numeric characters. """ takes.enable_for_current(node, "custom_valid") spec = node.parm("custom_range").eval() valid = Sequence.is_valid_spec(spec) node.parm("custom_valid").set(valid) update_frame_stats_message(node) uistate.update_button_state(node)
def test_is_valid_method_bad_type(self): with self.assertRaises(TypeError): Sequence.is_valid_spec(1) with self.assertRaises(TypeError): Sequence.is_valid_spec(None)
def test_is_valid_method_false(self): self.assertFalse(Sequence.is_valid_spec("12-26x3d, 1,7,8,2,4-9")) self.assertFalse(Sequence.is_valid_spec(",4x9,2,")) self.assertFalse(Sequence.is_valid_spec(" "))
def test_is_valid_method_true(self): self.assertTrue(Sequence.is_valid_spec("12-26x3, 1,7,8,2,4-9")) self.assertTrue(Sequence.is_valid_spec("1")) self.assertTrue(Sequence.is_valid_spec(",4-9,2,"))
def test_is_valid_method_bad_type(self): with self.assertRaises(TypeError): Sequence.is_valid_spec(1) with self.assertRaises(TypeError): Sequence.is_valid_spec(None)
def test_is_valid_method_false(self): self.assertFalse(Sequence.is_valid_spec("12-26x3d, 1,7,8,2,4-9")) self.assertFalse(Sequence.is_valid_spec(",4x9,2,")) self.assertFalse(Sequence.is_valid_spec(" "))
def test_is_valid_method_true(self): self.assertTrue(Sequence.is_valid_spec("12-26x3, 1,7,8,2,4-9")) self.assertTrue(Sequence.is_valid_spec("1")) self.assertTrue(Sequence.is_valid_spec(",4-9,2,"))