Ejemplo n.º 1
0
argon = Argon(600, 800)

#from mode import Mode, SelectionMode

default = renderer.get_default_style(argon).inherit(
    color = whiteish,
)

language = __import__('strike')
EditMode = language.EditMode
layouter = language.init(argon, default, theme)

toolbar_height = argon.default_font.height*2
frame = Frame((0, 0, argon.width, argon.height-toolbar_height), document, layouter)
frame.mode = EditMode(frame, mutable.normalize(document, False))

def set_mode(new_mode):
    if frame.mode is not None:
        frame.mode.free()
    frame.mode = new_mode

box7 = argon.load.patch9('box7.png')
frame.style.update(
    background_color = theme.background,
    caret_color = rgba(255, 255, 255, 255),
    selection_background = box7,
    selection_color_inner = rgba(0,   0, 255, 128),
    selection_color_outer = rgba(32, 32, 255, 128),
    selection_color_bad   = rgba(255, 255, 0, 192),
)
Ejemplo n.º 2
0
        return Selection(mutor, *ext)
    else:
        return mutor

def get_str(mutor):
    if isinstance(mutor, Selection):
        info, ctx = mutor.mutator.struct.proxy.unroll()
        index = mutor.mutator.index
        return repr((ctx, index, (mutor.head, mutor.tail)))
    else:
        info, ctx = mutor.struct.unroll()
        return repr((ctx, mutor.index, None))

from schema import language 

frame.mode = None

def set_mode(mode):
    if frame.mode is not None:
        frame.mode.free()
    frame.mode = mode

ctx, index, ext = walk_head(macron.spec, 1)
intron = locate_intron(frame.contents, roll(macron.spec, ctx), index)
intron.controller.enter_descend(intron)

@argon.listen
def on_frame(time):
    width, height = argon.resolution
    hw = width  / 2
    hh = height / 2