Esempio n. 1
0
def embeddedObjectLiteral(ctx, style, valueView, hideFrame):
    embeddedObjectLiteralBorder = style.get(
        PythonEditorStyle.embeddedObjectLiteralBorder)
    embeddedObjectTagLabelStyle = style.get(
        PythonEditorStyle.embeddedObjectTagLabelStyle)
    embeddedObjectTagBorder = style.get(
        PythonEditorStyle.embeddedObjectTagBorder)

    tagLabel = embeddedObjectTagBorder.surround(
        embeddedObjectTagLabelStyle(Label('l')))
    contents = Row([tagLabel.alignVCentre(), valueView.pad(2.0, 2.0)])
    box = embeddedObjectLiteralBorder.surround(contents).padX(1.0, 1.0)

    segment = Segment(box)
    return segment.present(ctx, style)
Esempio n. 2
0
def unquote(ctx, style, valueView, title, sequentialEditor):
    unquoteBorderStyle = style.get(PythonEditorStyle.unquoteBorderStyle)
    unquoteTitleStyle = style.get(PythonEditorStyle.unquoteTitleStyle)

    titleLabel = unquoteTitleStyle.applyTo(Label(title))

    region = sequentialEditor.region(valueView)

    header = titleLabel.alignHLeft()
    box = unquoteBorderStyle.applyTo(
        Border(Column([header.alignHExpand(),
                       region.pad(3.0, 3.0)]))).pad(1.0, 1.0)

    segment = Segment(box)
    return segment.present(ctx, style)
Esempio n. 3
0
def externalExpr(ctx, style, exprView, title, deleteButton):
    externalExprBorderStyle = style.get(
        PythonEditorStyle.externalExprBorderStyle)
    externalExprTitleStyle = style.get(
        PythonEditorStyle.externalExprTitleStyle)

    titleLabel = externalExprTitleStyle.applyTo(Label(title))

    header = Row(
        [titleLabel.alignHLeft(),
         deleteButton.alignHRight().alignVCentre()])
    box = externalExprBorderStyle.applyTo(
        Border(Column([header.alignHExpand(),
                       exprView.pad(3.0, 3.0)]))).pad(1.0, 1.0)

    segment = Segment(box)
    return segment.present(ctx, style)
Esempio n. 4
0
def embeddedObjectStmt(ctx, style, valueView, hideFrame):
    if hideFrame:
        box = valueView
    else:
        embeddedObjectBorder = style.get(
            PythonEditorStyle.embeddedObjectBorder)
        embeddedObjectTagLabelStyle = style.get(
            PythonEditorStyle.embeddedObjectTagLabelStyle)
        embeddedObjectTagBorder = style.get(
            PythonEditorStyle.embeddedObjectTagBorder)

        tagLabel = embeddedObjectTagBorder.surround(
            embeddedObjectTagLabelStyle(Label('Stmt')))
        contents = Column([tagLabel, valueView.pad(2.0, 2.0)])
        box = embeddedObjectBorder.surround(contents).padX(1.0, 1.0)

    segment = Segment(box)
    return segment.present(ctx, style)
Esempio n. 5
0
def embeddedObjectMacro(ctx, style, valueView, modelView):
    modelView = StyleSheet.style(Primitive.editable(False)).applyTo(modelView)

    embeddedObjectBorderStyle = style.get(
        PythonEditorStyle.embeddedObjectBorderStyle)
    embeddedObjectLineStyle = style.get(
        PythonEditorStyle.embeddedObjectLineStyle)
    embeddedObjectExpansionLabelStyle = style.get(
        PythonEditorStyle.embeddedObjectExpansionLabelStyle)

    hLine = embeddedObjectLineStyle.applyTo(Box(1, 1).alignHExpand()).pad(
        8.0, 2.0).alignHExpand()

    expansionLabel = embeddedObjectExpansionLabelStyle.applyTo(
        Label('Expansion'))

    expander = DropDownExpander(expansionLabel, modelView)

    view = embeddedObjectBorderStyle.applyTo(
        Border(Column([valueView, expander])))

    segment = Segment(view)
    return segment.present(ctx, style)