Пример #1
0
def init_context(screen, clock, pt):
    D = initialize()
    d = display.Display(screen, D.__contains__,
                        *((144 - 89, 144, 89) if FULLSCREEN else (89, 144)))
    log = d.init_text(pt, 0, 0, 'log.txt')
    tho = d.init_text(pt, 0, d.h / 3, 'menu.txt')
    t = d.init_text(pt, d.w / 2, 0, 'scratch.txt')
    loop = core.TheLoop(d, clock)
    stack_id, stack_holder = pt.open('stack.pickle')
    world = core.World(stack_id, stack_holder, D, d.broadcast, log)
    loop.install_task(pt.task_run, 10000)  # save files every ten seconds
    d.handlers.append(pt.handle)
    d.handlers.append(world.handle)
    load_definitions(pt, D)
    return locals()
Пример #2
0
#
#    Joypy is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Joypy.  If not see <http://www.gnu.org/licenses/>.
#
from traceback import print_exc, format_exc
from joy.joy import run
from joy.library import initialize, DefinitionWrapper
from joy.utils.stack import stack_to_string
from joy.utils.pretty_print import TracePrinter

D = initialize()
S = ()


def J(text, stack=S, dictionary=D):
    print stack_to_string(run(text, stack, dictionary)[0])


def V(text, stack=S, dictionary=D):
    tp = TracePrinter()
    try:
        run(text, stack, dictionary, tp.viewer)
    except:
        exc = format_exc()
        tp.print_()
        print '-' * 73
Пример #3
0
 def __init__(self, *a, **b):
   self.D = initialize()
   default_defs(self.D)
   self.S = ()
   super(JoyKernel, self).__init__(*a, **b)
Пример #4
0
from joy.library import initialize
from joy.joy import joy

dictionary = initialize()


def JOY(expression, stack):
    global dictionary
    stack, _, D = joy(stack, expression, dictionary)
    dictionary = D
    return stack