예제 #1
0
import copy
import os
import traceback
import linecache
import sys

from time import sleep, time

from livecode import LiveExecution
from shoebot.core.events import next_event, QUIT_EVENT, SOURCE_CHANGED_EVENT, event_is, SET_WINDOW_TITLE
from shoebot.core.var_listener import VarListener
from shoebot.data import Variable
from shoebot.util import flushfile


sys.stdout = flushfile(sys.stdout)
sys.stderr = flushfile(sys.stderr)


class Grammar(object):
    ''' 
    A Bot is an interface to receive user commands (through scripts or direct
    calls) and pass them to a canvas for drawing.

    Bae class for all Grammars, contains just the machinery for running the
    grammars, it has only the private API and nothing else, except for
    run which is called to actually run the Bot.
    '''
    def __init__(self, canvas, namespace=None, vars=None):
        self._canvas = canvas
        self._quit = False
예제 #2
0
from __future__ import print_function

import copy
import os
import sys
import traceback
from time import sleep, time

from .livecode import LiveExecution
from shoebot.core.events import next_event, QUIT_EVENT, SOURCE_CHANGED_EVENT, event_is, SET_WINDOW_TITLE
from shoebot.core.var_listener import VarListener
from shoebot.data import Variable
from shoebot.grammar.format_traceback import simple_traceback
from shoebot.util import flushfile

sys.stdout = flushfile(sys.stdout)
sys.stderr = flushfile(sys.stderr)


class Grammar(object):
    '''
    A Bot is an interface to receive user commands (through scripts or direct
    calls) and pass them to a canvas for drawing.

    Bae class for all Grammars, contains just the machinery for running the
    grammars, it has only the private API and nothing else, except for
    run which is called to actually run the Bot.
    '''
    def __init__(self, canvas, namespace=None, vars=None):
        self._canvas = canvas
        self._quit = False