def __init__(self,compiler): self.compiler = compiler self.typeinfo = [ TypeInfo(self, compiler, fc.FormulaTypes.FRACTAL), TypeInfo(self, compiler, fc.FormulaTypes.COLORFUNC, "INSIDE"), TypeInfo(self, compiler, fc.FormulaTypes.COLORFUNC, "OUTSIDE"), TypeInfo(self, compiler, fc.FormulaTypes.TRANSFORM), TypeInfo(self, compiler, fc.FormulaTypes.GRADIENT) ] self.current_type = -1 self.type_changed = event.T() self.file_changed = event.T() self.formula_changed = event.T() self.set_type(FRACTAL)
def testAdd(self): e = event.T() def foo(): pass e += foo self.assertEqual([foo], e.targets)
def testCall(self): results = [] def call(arg): results.append(arg) e = event.T() e += call e(2) self.assertEqual([2], results) e += call e("fish") self.assertEqual([2, "fish", "fish"], results)
def testCreate(self): e = event.T() self.assertEqual([], e.targets)
def __init__(self): self.x = event.T() self.x()