def render(self): symbolVariablePairs = [] for i in range(len(self.symbol_variable_pairs)): (s,v) = self.symbol_variable_pairs[i] (c0, c1) = colors.productPairsColor(i) symbolVariablePairs.append(renderSymbolVariablePair(renderSymbol(s), v.render(), c0, c1)) return stack.stackAll(0, symbolVariablePairs, spacing = distances.productVariableHorizontalSpacing)
def render(self, context): infix = getInfix(self) if infix is not None: holds = variable.renderInfix(productVariable=self.held, infixSymbols=infix, infixVariable=self.holding) else: holds = stack.stackAll( 0, [self.held.render(), primitives.holds(), self.holding.render()], spacing=distances.holdsSpacing ) if context.covariant: return holds else: return primitives.surroundWithNot(holds)
def renderInfix(productVariable, infixSymbols, infixVariable): (firstSymbol, secondSymbol) = infixSymbols assert(len(productVariable.symbol_variable_pairs) == 2) (aSymbol, aVariable) = productVariable.symbol_variable_pairs[0] (bSymbol, bVariable) = productVariable.symbol_variable_pairs[1] if aSymbol == secondSymbol: assert(bSymbol == firstSymbol) (firstSymbol, secondSymbol) = (secondSymbol, firstSymbol) else: assert(aSymbol == firstSymbol) assert(bSymbol == secondSymbol) return stack.stackAll(0, [ aVariable.render() , infixVariable.render() , bVariable.render()], spacing = distances.infixSpacing)
def render(self, context): dimension = 0 if not context.covariant: dimension += 1 if self.__class__ == Or: dimension += 1 dimension = dimension % 2 other_dimension = primitives._dual_dimension(dimension) length = distances.min_unit_divider_length values = [] for kid in self.values: s = kid.render(context) length = max(length, s.widths()[other_dimension]) values.append(s) return stack.stackAll( dimension, misc._interleave(self.renderDivider(context.covariant, length), values), spacing=distances.divider_spacing, )