class documentation

class DrsDrawer(object): (source)

Constructor: DrsDrawer(drs, size_canvas, canvas)

View In Hierarchy

Undocumented

Method __init__ No summary
Method draw Draw the DRS
Constant BUFFER Undocumented
Constant OUTERSPACE Undocumented
Constant TOPSPACE Undocumented
Instance Variable canvas Undocumented
Instance Variable drs Undocumented
Instance Variable master Undocumented
Method _draw_command Draw the given item at the given location
Method _get_centered_top Get the y-coordinate of the point that a figure should start at if its height is 'item_height' and it needs to be centered in an area that starts at 'top' and is 'full_height' tall.
Method _get_text_height Get the height of a line of text
Method _handle No summary
Method _handle_ApplicationExpression Undocumented
Method _handle_BinaryExpression Undocumented
Method _handle_DRS Undocumented
Method _handle_DrtProposition Undocumented
Method _handle_LambdaExpression Undocumented
Method _handle_NegatedExpression Undocumented
Method _handle_VariableExpression Undocumented
Method _visit Return the bottom-rightmost point without actually drawing the item
Method _visit_command Return the bottom-rightmost point without actually drawing the item
def __init__(self, drs, size_canvas=True, canvas=None): (source)
Parameters
drsDrtExpression, The DRS to be drawn
size_canvasbool, True if the canvas size should be the exact size of the DRS
canvasCanvas The canvas on which to draw the DRS. If none is given, create a new canvas.
def draw(self, x=OUTERSPACE, y=TOPSPACE): (source)

Draw the DRS

BUFFER: int = (source)

Undocumented

Value
3
OUTERSPACE: int = (source)

Undocumented

Value
6
TOPSPACE: int = (source)

Undocumented

Value
10

Undocumented

Undocumented

Undocumented

def _draw_command(self, item, x, y): (source)

Draw the given item at the given location

Parameters
itemthe item to draw
xthe top of the current drawing area
ythe left side of the current drawing area
Returns
the bottom-rightmost point
def _get_centered_top(self, top, full_height, item_height): (source)

Get the y-coordinate of the point that a figure should start at if its height is 'item_height' and it needs to be centered in an area that starts at 'top' and is 'full_height' tall.

def _get_text_height(self): (source)

Get the height of a line of text

def _handle(self, expression, command, x=0, y=0): (source)
Parameters
expressionthe expression to handle
commandthe function to apply, either _draw_command or _visit_command
xthe top of the current drawing area
ythe left side of the current drawing area
Returns
the bottom-rightmost point
def _handle_ApplicationExpression(self, expression, command, x, y): (source)

Undocumented

def _handle_BinaryExpression(self, expression, command, x, y): (source)

Undocumented

def _handle_DRS(self, expression, command, x, y): (source)

Undocumented

def _handle_DrtProposition(self, expression, command, x, y): (source)

Undocumented

def _handle_LambdaExpression(self, expression, command, x, y): (source)

Undocumented

def _handle_NegatedExpression(self, expression, command, x, y): (source)

Undocumented

def _handle_VariableExpression(self, expression, command, x, y): (source)

Undocumented

def _visit(self, expression, x, y): (source)

Return the bottom-rightmost point without actually drawing the item

Parameters
expressionthe item to visit
xthe top of the current drawing area
ythe left side of the current drawing area
Returns
the bottom-rightmost point
def _visit_command(self, item, x, y): (source)

Return the bottom-rightmost point without actually drawing the item

Parameters
itemthe item to visit
xthe top of the current drawing area
ythe left side of the current drawing area
Returns
the bottom-rightmost point