コード例 #1
0
@EmbeddedExpressionAtCaretAction
def _newColourPickerAtcaret(caret):
    return ColourEditorPicker()


_colourPickerCommand = Command('&C&o&lour picker', _newColourPickerAtcaret)


@EmbeddedExpressionAtCaretAction
def _newFilePathEntryAtCaret(caret):
    return FilePathEditorTextEntry()


_filePathEntryCommand = Command('&File &Path &Entry', _newFilePathEntryAtCaret)


@EmbeddedExpressionAtCaretAction
def _newDirPathEntryAtCaret(caret):
    return DirPathEditorTextEntry()


_dirPathEntryCommand = Command('&Directory &Path &Entry',
                               _newDirPathEntryAtCaret)

pythonCommandSet('LarchTools.EmbeddedData', [
    _boolCheckCommand, _intSpinCommand, _realSpinCommand, _textEntryCommand,
    _textAreaCommand, _colourPickerCommand, _filePathEntryCommand,
    _dirPathEntryCommand
])
コード例 #2
0
        self._incr.onAccess()
        #exprPres = pyPerspective.applyTo( self._expr )
        exprPres = self._expr

        valuesPres = ObjectBox(
            'Values', Column([Paragraph([value]) for value in self._values]))

        contents = Column([exprPres, valuesPres])
        return ObjectBox(
            'Embedded display',
            contents).withContextMenuInteractor(_embeddedDisplayMenu)


@EmbeddedExpressionAtCaretAction
def _newEmbeddedDisplayAtCaret(caret):
    return EmbeddedDisplay()


@WrapSelectionInEmbeddedExpressionAction
def _newEmbeddedDisplayAtSelection(expr, selection):
    d = EmbeddedDisplay()
    d._expr.model['expr'] = deepcopy(expr)
    return d


_edCommand = Command(
    '&Embedded &Display',
    chainActions(_newEmbeddedDisplayAtSelection, _newEmbeddedDisplayAtCaret))

pythonCommandSet('LarchTools.PythonTools.EmbeddedDisplay', [_edCommand])
コード例 #3
0
            assign = Py.AssignStmt(targets=[target], value=value)
            assigns.append(assign)
        return Py.PythonSuite(suite=assigns)

    __py_hide_expansion__ = True

    def __present__(self, fragment, inheritedState):
        return _tableEditor.editTable(self)

    @TrackedListProperty
    def _definitions(self):
        return self._definitions_


_targetColumn = AttributeColumn('Name', 'target', EmbeddedPython2Target)
_valueColumn = AttributeColumn('Value', 'value', EmbeddedPython2Expr)

_tableEditor = ObjectListTableEditor([_targetColumn, _valueColumn],
                                     ConstantDefinition, False, True, True,
                                     True)


@EmbeddedStatementAtCaretAction
def _newConstantTableAtCaret(caret):
    return ConstantTable()


_ctCommand = Command('&Python &Constant &Table', _newConstantTableAtCaret)

pythonCommandSet('LarchTools.PythonTools.ConstantTable', [_ctCommand])
コード例 #4
0
@EmbeddedExpressionAtCaretAction
def _newMonitoredExpressionAtCaret(caret):
	return MonitoredExpression()

@WrapSelectionInEmbeddedExpressionAction
def _newMonitoredExpressionAtSelection(expr, selection):
	d = MonitoredExpression()
	d._expr.model['expr'] = deepcopy( expr )
	if expr.isInstanceOf( Schema.Load ):
		d._name = expr['name']
	return d

_mxCommand = Command( '&Monitored E&xpression', chainActions( _newMonitoredExpressionAtSelection, _newMonitoredExpressionAtCaret ) )

_mxCommands = CommandSet( 'LarchTools.PythonTools.EmbeddedDisplay.MonitoredExpression', [ _mxCommand ] )




@WrapSelectedStatementRangeInEmbeddedObjectAction
def _newTraceVisAtStatementRange(statements, selection):
	d = TraceVisualisation()
	d._suite.model['suite'][:] = deepcopy( statements )
	return d


_tvCommand = Command( '&Trace &Visualisation', chainActions( _newTraceVisAtStatementRange ) )

pythonCommandSet( 'LarchTools.PythonTools.TraceVis', [ _tvCommand ] )
コード例 #5
0
        s = self.asString()
        return Py.strToStrLiteral(s)

    def __clipboard_copy__(self, memo):
        return VisualPythonRegex(memo.copy(self.regex))

    def asString(self):
        return self._codeGen(self.regex)

    __embed_hide_frame__ = True

    def __present__(self, fragment, inherited_state):
        #return VREPerspective( self.regex )
        e = Paragraph([
            HiddenText(u'\ue000'),
            VREPerspective(self.regex),
            HiddenText(u'\ue000')
        ])
        e = _vreBorder.surround(e)
        return e


@EmbeddedExpressionAtCaretAction
def _newVREAtCaret(caret):
    return VisualPythonRegex()


_vreCommand = Command('&Visual &Regular &Expression', _newVREAtCaret)

pythonCommandSet('LarchTools.PythonTools.VisualRegex', [_vreCommand])
コード例 #6
0
        main = Column([header, Pres.coerce(self._code).alignHExpand()])
        return _stepperBorder.surround(main).withCommands(_stepperCommands)


@EmbeddedStatementAtCaretAction
def _newBreakPointAtCaret(caret):
    return StepperBreakpoint()


_bpCommand = Command('&Stepper &Break&point', _newBreakPointAtCaret)

_stepperCommands = CommandSet(
    'LarchTools.PythonTools.Stepper.StepperBreakpoint', [_bpCommand])


@EmbeddedStatementAtCaretAction
def _newStepperAtCaret(caret):
    return Stepper()


@WrapSelectedStatementRangeInEmbeddedObjectAction
def _newStepperAtStatementRange(statements, selection):
    return Stepper(deepcopy(statements))


_psCommand = Command(
    '&Python &S&tepper',
    chainActions(_newStepperAtStatementRange, _newStepperAtCaret))

pythonCommandSet('LarchTools.PythonTools.Stepper', [_psCommand])
コード例 #7
0
#
# Commands for inserting standard tests
#

@EmbeddedStatementAtCaretAction
def _newStandardInlineTestAtCaret(caret):
	return StandardInlineTest()

_sitCommand = Command( '&Standard &Inline &Test', chainActions( _newStandardInlineTestAtCaret ) )

inlineTestCommandSet( 'LarchTools.PythonTools.InlineTest.StandardTests', [ _sitCommand ] )




@EmbeddedStatementAtCaretAction
def _newTestedBlockAtCaret(caret):
	return TestedBlock()

@WrapSelectedStatementRangeInEmbeddedObjectAction
def _newTestedBlockAtStatementRange(statements, selection):
	d = TestedBlock()
	d._suite.model['suite'][:] = deepcopy( statements )
	return d


_tbCommand = Command( '&Tested &Block', chainActions( _newTestedBlockAtStatementRange, _newTestedBlockAtCaret ) )

pythonCommandSet( 'LarchTools.PythonTools.InlineTest', [ _tbCommand ] )
コード例 #8
0
        return [self.__root]

    def __clipboard_copy__(self, memo):
        instance = GUIEditor.__new__(GUIEditor)
        instance.__change_history__ = None
        instance.__root = memo.copy(self.__root)
        instance.__root._guiEditor = self
        return instance

    def __py_evalmodel__(self, codeGen):
        return self.__root.__py_evalmodel__(codeGen)

    __embed_hide_frame__ = True

    def __present__(self, fragment, inheritedState):
        p = Pres.coerce(self.__root)
        p = _guiEditorBorder.surround(p)
        p = p.withContextMenuInteractor(guiEditorContextMenu)
        p = p.withProperty(GUIEdProp.instance, self)
        return p


@EmbeddedExpressionAtCaretAction
def _newGUIEditorAtCaret(caret):
    return GUIEditor(None)


_vreCommand = Command('&G&U&I Editor', _newGUIEditorAtCaret)

pythonCommandSet('LarchTools.PythonTools.GUIEditor', [_vreCommand])
コード例 #9
0

@WrapSelectionInEmbeddedExpressionAction
def _newLiterateExpressionAtSelection(expr, selection):
    d = LiterateExpression()
    d._expr.model['expr'] = deepcopy(expr)
    return d


@EmbeddedStatementAtCaretAction
def _newLiterateSuiteAtCaret(caret):
    return LiterateSuite()


@WrapSelectedStatementRangeInEmbeddedObjectAction
def _newLiterateSuiteAtStatementRange(statements, selection):
    d = LiterateSuite()
    d._definition._suite.model['suite'][:] = deepcopy(statements)
    return d


_lxCommand = Command(
    '&Literate E&xpression',
    chainActions(_newLiterateExpressionAtSelection,
                 _newLiterateExpressionAtCaret))
_lsCommand = Command(
    '&Literate &Suite',
    chainActions(_newLiterateSuiteAtStatementRange, _newLiterateSuiteAtCaret))

pythonCommandSet('LarchTools.PythonTools.Literate', [_lxCommand, _lsCommand])