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])
@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 ) )
SimpleInlineTableTestRow._codeColumn = AttributeColumn( 'Code', 'code', EmbeddedPython2Suite ) class SimpleInlineTableTest (AbstractInlineTestTable): pass SimpleInlineTableTest._tableEditor = ObjectListTableEditor( [ SimpleInlineTableTestRow._resultColumn, SimpleInlineTableTestRow._codeColumn, SimpleInlineTableTestRow._expectedColumn ], SimpleInlineTableTestRow, True, True, True, True ) # # Commands for inserting standard tests # @EmbeddedStatementAtCaretAction def _newSimpleInlineTableTestAtCaret(caret): return SimpleInlineTableTest() _sittCommand = Command( '&Simple &Inline &Table &Test', chainActions( _newSimpleInlineTableTestAtCaret ) ) inlineTestCommandSet( 'LarchTools.PythonTools.InlineTest.TableTests', [ _sittCommand ] )
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])
commandSet = CommandSet( name, commands ) inlineTestCommands.registerCommandSet( commandSet ) return commandSet # # 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
@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])