예제 #1
0
	def __present__(self , fragment, inherited_state):
		unload_modules_starting_with(['controls', 'datamodel', 'mallard'])

		from datamodel import xmlmodel
		from mallard import mallard

		title = _info_style(TitleBar(self._filename))

		xml_title = _section_heading_style(SectionHeading1('XML (non-editable)')).alignHExpand()
		rich_text_title = _section_heading_style(SectionHeading1('Rich text (editable)')).alignHExpand()

		if self.__xml_path is not None:
			with open(self.__xml_path, 'r') as f:
				xml_rep = xmlmodel.XmlElem.from_file(f)
		elif self.__xml_bytes is not None:
			xml_rep = xmlmodel.XmlElem.from_string(self.__xml_bytes)
		else:
			raise ValueError, 'Must provide either path or bytes'

		rich_text_rep = mallard.edit(xml_rep)

		scrolled_xml = ScrolledViewport(Pres.coerce(xml_rep).alignVRefY(), 100.0, 400.0, None)
		scrolled_rich_text = ScrolledViewport(_editable_style(rich_text_rep).alignVRefY(), 100.0, 400.0, None)
		xml_contents = Column([xml_title.alignVRefY(), Spacer(0.0, 20.0), scrolled_xml])
		rich_text_contents = Column([rich_text_title.alignVRefY(), Spacer(0.0, 20.0), scrolled_rich_text])

		xml_sec = _section_border.surround(xml_contents).pad(2.0, 2.0)
		rich_text_sec = _section_border.surround(rich_text_contents).pad(2.0, 2.0)

		contents = Row([xml_sec.alignHExpand(), rich_text_sec.alignHExpand()])

		return _info_style(Page([title.alignVRefY(), contents])).alignVExpand()
	def __present__(self, fragment, inheritedState):
		pythonModule = self.getPythonModule()

		executionResult = self.getExecResult()

		caughtException = executionResult.getCaughtException()
		result = executionResult.getResult()
		streams = executionResult.getStreams()

		moduleView = StyleSheet.style( Primitive.editable( False ) ).applyTo( Python2.python2EditorPerspective.applyTo( pythonModule ) )
		caughtExceptionView = ApplyPerspective.defaultPerspective( caughtException )   if caughtException is not None   else None
		resultView = ApplyPerspective.defaultPerspective( result[0] )   if result is not None   else None

		code = _pythonModuleBorderStyle.applyTo( Border( moduleView.alignHExpand() ).alignHExpand() )
		outputContents = []
		for stream in streams:
			if stream.name == 'out':
				outputContents.append( execStdout( stream.richString, True ) )
			elif stream.name == 'err':
				outputContents.append( execStderr( stream.richString, True ) )
			else:
				raise ValueError, 'Unreckognised stream \'{0}\''.format( stream.name )
		if caughtExceptionView is not None:
			outputContents.append( execException( caughtExceptionView ) )
		if resultView is not None:
			outputContents.append( execResult( resultView ) )
		outputColumn = _blockOutputStyle.applyTo( Column( outputContents ).alignHExpand() )
		return _blockStyle.applyTo( Border( Column( [ code, outputColumn ] ) ) ).alignHExpand()
예제 #3
0
	def presentPathList(self, pathList):
		def pathItem(index):
			def _onDelete(menuItem):
				del pathList[index]
				self._incr.onChanged()

			def buildContextMenu(element, menu):
				menu.add( MenuItem.menuItemWithLabel( 'Delete', _onDelete ) )
				return True

			return _itemHoverHighlightStyle.applyTo( Label( pathList[index] ) ).withContextMenuInteractor( buildContextMenu )


		def _onNew(hyperlink, event):
			component = hyperlink.getElement().getRootElement().getComponent()
			openDialog = JFileChooser()
			openDialog.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY )
			response = openDialog.showDialog( component, 'Choose path' )
			if response == JFileChooser.APPROVE_OPTION:
				sf = openDialog.getSelectedFile()
				if sf is not None:
					filename = sf.getPath()
					if filename is not None  and  os.path.isdir( filename ):
						pathList.append( filename )
						self._incr.onChanged()
		
		newLink = Hyperlink( 'NEW', _onNew )
		controls = newLink.pad( 10.0, 5.0 )

		pathPres = Column( [ pathItem( i )   for i in xrange( len( pathList ) ) ] )
		return Column( [ controls, pathPres.padX( 5.0 ) ] )
	def _testValue(self, kind, data, excType=None):
		self._actual.setLiteralValue( ( kind, data ) )
		expected = self._expected.getStaticValue()
		if expected is not None:
			expectedKind, expectedData = expected
			if kind == expectedKind:
				if expectedKind == 'exception':
					if excType == expectedData:
						self.__result.setLiteralValue( _resultPass )
					else:
						title = _resultFailStyle( Label( 'FAIL' ) )
						heading = Label( 'Expected exception of type %s, got:' % expectedData.__name__ )
						res = Column( [ title, heading, data ] )
						self.__result.setLiteralValue( res )
				elif expectedKind == 'value':
					if data == expectedData:
						self.__result.setLiteralValue( _resultPass )
					else:
						title = _resultFailStyle( Label( 'FAIL' ) )
						heading1 = Label( 'Expected:' )
						heading2 = Label( 'Got:' )
						res = Column( [ title, heading1, expectedData, heading2, data ] )
						self.__result.setLiteralValue( res )
				else:
					raise TypeError, 'unknown expected result kind %s' % expectedKind
			else:
				resContents = [ _resultFailStyle( Label( 'FAIL' ) ) ]

				if expectedKind == 'exception':
					resContents.append( Label( 'Expected exception of type %s:' % expectedData.__name__ ) )
				elif expectedKind == 'value':
					resContents.append( Label( 'Expected:' ) )
					resContents.append( expectedData )
				else:
					raise TypeError, 'unknown expected result kind %s' % expectedKind

				if kind == 'exception':
					resContents.append( Label( 'Got exception:' ) )
					resContents.append( data )
				elif kind == 'value':
					resContents.append( Label( 'Expected:' ) )
					resContents.append( data )
				else:
					raise TypeError, 'unknown result kind %s' % kind

				self.__result.setLiteralValue( Column( resContents ) )
		else:
			def _onFix(button, event):
				if kind == 'exception':
					self._expected.setLiteralValue( ( kind, excType ) )
				elif kind == 'value':
					self._expected.setLiteralValue( ( kind, data ) )
				else:
					raise TypeError, 'unknown result kind %s' % kind
				self.__result.setLiteralValue( _resultNone )

			fixButton = Button.buttonWithLabel( 'Set expected result', _onFix )
			title = Label( 'No expected result, received:' )
			self.__result.setLiteralValue( Column( [ title, Pres.coerce( data ).pad( 5.0, 0.0, 5.0, 5.0 ), fixButton ] ).alignHPack().alignVTop() )
예제 #5
0
	def __present__(self , fragment, inherited_state):
		title = TitleBarWithSubtitle('Mallard editor', 'development prototype - SAVE FUNCTIONALITY NOT IMPLEMENTED')
		path_heading = SectionHeading2(['Displaying contents of: ', _dir_style(RichSpan(self.__path))])

		links = [Hyperlink(p.filename, editor_page.EditorPageSubject(p, fragment.subject))   for p in self._pages]

		if self._example_pages is not None:
			examples_heading = SectionHeading2('Example mallard documents:')
			example_links = [Hyperlink(p.filename, editor_page.EditorPageSubject(p, fragment.subject))   for p in self._example_pages]
			examples_section = [Spacer(0.0, 20.0), examples_heading, Column(example_links)]
		else:
			examples_section = []

		return _page_style(Page([title, path_heading, Column(links)] + examples_section))
    def __present_contents__(self, fragment, inheritedState):
        self._incr.onAccess()

        dirPres = self._presentDir()
        note = NotesText([
            'Note: please choose the location of the GraphViz ',
            EmphSpan('bin'), ' directory.'
        ])
        columnContents = [note, dirPres]
        if self._config is not None:
            columnContents.append(self._presentConfig())
        pathContents = Column(columnContents)
        pathSection = Section(SectionHeading2('GraphViz path'), pathContents)

        downloadText = ''
        if self.__isConfigured():
            downloadText = 'GraphViz appears to be installed on this machine and configured. If it does not work correctly, you may need to install it. You can download it from the '
        else:
            downloadText = 'If GraphViz is not installed on this machine, please install it. You can download it from the '

        downloadLink = Hyperlink('GraphViz homepage',
                                 URI('http://www.graphviz.org/'))
        download = NormalText([downloadText, downloadLink, '.'])
        downloadSec = Section(
            SectionHeading2('GraphViz download/installation'), download)

        return Body([pathSection, downloadSec])
def executionResultBox(streams, exception, resultInTuple,
                       bUseDefaultPerspecitveForException,
                       bUseDefaultPerspectiveForResult):
    boxContents = []
    for stream in streams:
        if stream.name == 'out':
            boxContents.append(
                execStdout(stream.richString, bUseDefaultPerspectiveForResult))
        elif stream.name == 'err':
            boxContents.append(
                execStderr(stream.richString, bUseDefaultPerspectiveForResult))
        else:
            raise ValueError, 'Unreckognised stream \'{0}\''.format(
                stream.name)
    if exception is not None:
        exceptionView = Pres.coerce(exception).alignHPack()
        if bUseDefaultPerspecitveForException:
            exceptionView = ApplyPerspective.defaultPerspective(exceptionView)
        boxContents.append(execException(exceptionView))
    if resultInTuple is not None:
        resultView = Pres.coercePresentingNull(resultInTuple[0]).alignHPack()
        if bUseDefaultPerspectiveForResult:
            resultView = ApplyPerspective.defaultPerspective(resultView)
        boxContents.append(execResult(resultView))

    if len(boxContents) > 0:
        return ApplyStyleSheetFromAttribute(ExecutionStyle.resultBoxStyle,
                                            Column(boxContents).alignHExpand())
    else:
        return None
        def paddingUI():
            padding = self.padding.value

            if padding is None:

                def onPadUniform(button, event):
                    self.padding.value = UniformPadding()

                def onPadNonUniform(button, event):
                    self.padding.value = NonUniformPadding()

                return ControlsRow([
                    Button.buttonWithLabel('Uniform', onPadUniform),
                    Button.buttonWithLabel('Non-uniform', onPadNonUniform)
                ]).alignHPack()
            else:

                def onRemove(button, event):
                    self.padding.value = None

                def setPadding(padding):
                    self.padding.value = padding

                removeButton = Button.buttonWithLabel('Remove padding',
                                                      onRemove).alignHPack()

                return Column([
                    removeButton.alignHPack(),
                    Spacer(0.0, 5.0),
                    padding.editUI(setPadding)
                ])
    def editUI(self, controlFactoryFn):
        self.__incr.onAccess()
        valueControl = controlFactoryFn(self._live)

        if self._expr is None:

            def _onAdd(button, event):
                self.expr = EmbeddedPython2Expr()

            addButton = Button(self._addButtonContents, _onAdd).alignHPack()

            return Row([valueControl, Spacer(10.0, 0.0), addButton])
        else:

            def _onRemove(button, event):
                self.expr = None

            removeButton = Button(self._removeButtonContents,
                                  _onRemove).alignHPack()

            return Column([
                valueControl,
                Row([
                    removeButton,
                    Spacer(10.0, 0.0),
                    exprBorder.surround(self._expr)
                ])
            ])
예제 #10
0
def _get_examples():
	names_and_bytes = None

	# z is the zip file containing the examples
	z = None
	if app_in_jar.startedFromJar():
		# App started from JAR; attempt to acquire through java.lang.Class.getResourceAsStream()
		stream = Column.getResourceAsStream('/mallard_examples.zip')

		if stream is not None:
			# Convert to cStringIO; FileUtil.wrap does not seem to work well with ZipFile
			fbytes = StringUtil.fromBytes(FileUtil.readBytes(stream))
			f = cStringIO.StringIO(fbytes)
			try:
				z = zipfile.ZipFile(f, 'r')
			except zipfile.BadZipfile:
				pass

	# App was not started from JAR, or loading failed; see if the ZIP file can be found in the file system
	if z is None:
		if os.path.isfile('mallard_examples.zip'):
			try:
				z = zipfile.ZipFile('mallard_examples.zip', 'r')
			except zipfile.BadZipfile:
				pass


	if z is not None:
		names_and_bytes = []
		infos = z.infolist()
		for info in infos:
			if info.filename.lower().endswith('.page'):
				names_and_bytes.append((info.filename, z.read(info)))
	return names_and_bytes
예제 #11
0
def choice(subexps):
	rows = []
	for subexp in subexps[:-1]:
		rows.append( Row( [ subexp.alignHPack(), _controlCharStyle( Text( '|' ).alignHRight() ) ] ).alignHExpand() )
		rows.append( _choiceRuleStyle.applyTo( Box( 1.0, 1.0 ).pad( 5.0, 3.0 ).alignHExpand() ) )
	rows.append( subexps[-1].alignHPack() )
	return _choiceBorder.surround( Column( rows ) )
예제 #12
0
 def _onReset(button, event):
     project.reset()
     modules = document.unloadAllImportedModules()
     heading = SectionHeading2('Unloaded modules:')
     modules = Column([Label(module) for module in modules])
     report = Section(heading, modules)
     BubblePopup.popupInBubbleAdjacentTo(report, button.getElement(),
                                         Anchor.BOTTOM, True, True)
def execException(exceptionView):
    label = ApplyStyleSheetFromAttribute(ExecutionStyle.labelStyle,
                                         StaticText('EXCEPTION:'))
    return ApplyStyleSheetFromAttribute(
        ExecutionStyle.exceptionBorderStyle,
        Border(
            Column([label, exceptionView.padX(5.0, 0.0).alignHExpand()
                    ]).alignHExpand()).alignHExpand())
 def __present__(self, fragment, inheritedState):
     self._listeners = PresentationStateListenerList.addListener(
         self._listeners, fragment)
     name = Label(self._name)
     kind = _objectKindMap[self._kind]
     contents = Column([name, Spacer(0.0, 2.0), kind.padX(10.0, 0.0)])
     return _fragSelectorEntryBorder.surround(
         contents).withElementInteractor(self._interactor)
예제 #15
0
def badIndentedBlock(ctx, style, indentElement, lines, dedentElement):
    rectStyle = PythonEditorStyle._badIndentationRectangleStyle.get(style)
    blockIndentation = style.get(PythonEditorStyle.blockIndentation)

    block = Column([indentElement] + lines + [dedentElement])

    return Row(
        [rectStyle.applyTo(Box(blockIndentation, 0.0).alignVExpand()),
         block]).alignHPack().present(ctx, style)
예제 #16
0
def _fontSample(fontName, sampleFn):
    sample = sampleFn(fontName)
    name = Label(fontName)
    return _hoverStyle(
        Bin(
            Column([
                sample,
                _nameStyle(name).padX(10.0, 0.0),
            ]).pad(5.0, 5.0)))
예제 #17
0
    def __present_contents__(self, fragment, inheritedState):
        def _onApply(button, event):
            self._config = self._userConfig.getStaticValue()
            self.apply()

        def _onRevert(button, event):
            self._userConfig.setLiteralValue(self._config)

        choices = [Label(c[1]) for c in _fontConfigChoices]
        choices.append(Label('Custom'))

        @LiveFunction
        def indexOfChoice():
            config = self._userConfig.getValue()
            if isinstance(config, FontConfiguration):
                return len(choices) - 1
            else:
                try:
                    return [c[0] for c in _fontConfigChoices
                            ].index(self._userConfig.getValue())
                except ValueError:
                    return 0

        @LiveFunction
        def footer():
            config = self._userConfig.getValue()
            if isinstance(config, FontConfiguration):
                return config
            else:
                return Blank()

        def _onChoice(menu, prevChoice, choice):
            if choice == len(choices) - 1:
                # Custom
                if prevChoice != choice:
                    prevConfig = _fontConfigChoices[prevChoice][0]
                    prevConfig = _fontConfigForName(prevConfig)
                    config = FontConfiguration()
                    config.copyFrom(prevConfig)
                    self._userConfig.setLiteralValue(config)
            else:
                self._userConfig.setLiteralValue(_fontConfigChoices[choice][0])

        applyButton = Button.buttonWithLabel('Apply', _onApply)
        revertButton = Button.buttonWithLabel('Revert', _onRevert)
        buttons = Row([applyButton,
                       Spacer(15.0, 0.0), revertButton]).alignHPack()

        configMenu = OptionMenu(choices, indexOfChoice, _onChoice)

        chooserHeader = Row([
            Label('Choose a font configuration:'),
            Spacer(25.0, 0.0), configMenu
        ]).alignHPack()

        return self._pageColumnStyle(Column([buttons, chooserHeader, footer]))
예제 #18
0
 def __present__(self, fragment, inheritedState):
     title = Label('Code stepper')
     header = _headerStyle(
         Row([
             title.alignVCentre().alignHPack(),
             Pres.coerce(self._stepButton).alignHPack(),
             Pres.coerce(self._runButton).alignHPack()
         ])).alignHExpand()
     main = Column([header, Pres.coerce(self._code).alignHExpand()])
     return _stepperBorder.surround(main).withCommands(_stepperCommands)
예제 #19
0
    def __present__(self, fragment, inh):
        space = Label(' ')
        open_angle = self._punc_style.applyTo(Label('<'))
        close_angle = self._punc_style.applyTo(Label('>'))
        slash = self._punc_style.applyTo(Label('/'))
        tag = self._tag_style.applyTo(Label(self.__tag))
        br = LineBreak()

        complex = False
        for x in self.__contents:
            if isinstance(x, XmlElem):
                complex = True
                break

        if complex:
            end = Row([open_angle, slash, tag, close_angle])
            content = Column(
                [NormalText([x]) for x in self.__contents if x != ''])
            if len(self.__attrs) == 0:
                start = Row([open_angle, tag, close_angle])
            else:
                start = Paragraph(
                    [open_angle, tag, space, br, self.__attrs, close_angle])
            return Column([start, content.padX(20.0, 0.0), end])
        else:
            if len(self.__contents) == 0:
                if len(self.__attrs) == 0:
                    return Row([open_angle, tag, slash, close_angle])
                else:
                    return Paragraph([
                        open_angle, tag, space, br, self.__attrs, slash,
                        close_angle
                    ])
            else:
                end = Row([open_angle, slash, tag, close_angle])
                content = [RichSpan([x]) for x in self.__contents]
                if len(self.__attrs) == 0:
                    start = Row([open_angle, tag, close_angle])
                else:
                    start = Span([
                        open_angle, tag, space, br, self.__attrs, close_angle
                    ])
                return Paragraph([start] + content + [end])
def _createSidePanel(rootElement):
    palette = createPalette()
    bottomPane = _createBottomPane(rootElement)
    palette = ScrolledViewport(palette.alignVTop().alignHPack(), 150.0, 150.0,
                               None).alignHExpand().alignVExpand()
    bottomPane = ScrolledViewport(bottomPane.alignVTop().alignHPack(), 150.0,
                                  150.0, None).alignHExpand().alignVExpand()
    bottomPane = ResizeableBin(bottomPane).resizeTop(350.0)
    return Column([
        palette.alignHExpand().alignVExpand(),
        bottomPane.alignHExpand().alignVExpand()
    ])
예제 #21
0
	def __present__(self, fragment, inheritedState):
		self._incr.onAccess()

		title = SectionHeading2( 'Unit tests' )

		nameEntry = _nameBorder.surround( EditableLabel( self._name, _notSet ).regexValidated( Tokens.identifierPattern, 'Please enter a valid identifier' ) )

		header = Row( [ title, Spacer( 25.0, 0.0 ), nameEntry ] )

		contents = [ header.padY( 0.0, 5.0 ), _standardCodeBorder.surround( self._suite ).padY( 3.0 ).alignHExpand() ]

		if self.__passes is not None  and  self.__failures is not None:
			resultsTitle = SectionHeading3( 'Test results:' )
			passes = _standardPassStyle( Label( '%d / %d test(s) passed' % ( self.__passes, self.__passes + len( self.__failures ) ) ) )
			failuresLabel = _standardFailStyle( Label( '%d test(s) failed:' % len( self.__failures ) ) )
			failures = [ Column( [ _standardFailedTestStyle( Label( name ) ), Pres.coerce( exception ).padX( 5.0, 0.0 ) ] ).padX( 5.0, 0.0 )   for name, exception in self.__failures ]
			results = _standardResultsBorder.surround( Column( [ resultsTitle, passes, failuresLabel ] + failures ) ).pad( 3.0, 3.0 )
			contents.append( results )


		return _standardInlineTestBorder.surround( Column( contents ) )
def _richStringLines(labelText, richString, textStyleAttribute,
                     bUseDefaultPerspectiveForResult):
    label = ApplyStyleSheetFromAttribute(ExecutionStyle.labelStyle,
                                         StaticText(labelText))
    lines = [
        _richStringItem(item, textStyleAttribute,
                        bUseDefaultPerspectiveForResult)
        for item in richString.getItems()
    ]
    return Overlay(
        [Column(lines).alignHExpand(),
         label.alignHRight().alignVTop()])
예제 #23
0
    def __present__(self, fragment, inheritedState):
        def _embeddedDisplayMenu(element, menu):
            def _onClear(item):
                del self._values[:]
                self._incr.onChanged()

            menu.add(
                MenuItem.menuItemWithLabel('Clear collected values', _onClear))

            return False

        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)
	def __present__(self, fragment, inheritedState):
		title = SectionHeading2( 'Unit tests' )

		nameEntry = _nameBorder.surround( EditableLabel( self._name, _notSet ).regexValidated( Tokens.identifierPattern, 'Please enter a valid identifier' ) )

		header = Row( [ title, Spacer( 25.0, 0.0 ), nameEntry ] )

		if self._tableEditor is NotImplemented:
			raise NotImplementedError, 'Table editor is abstract'

		table = self._tableEditor.editTable( self._tests )

		return _inlineTestTableBorder.surround( Column( [ header, Spacer( 0.0, 5.0 ), table ] ) )
예제 #25
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)
예제 #26
0
        def samplePage():
            label = Label('Sample page:')

            title = titleSample(self._title.getValue(), 'Example Page Title')
            heading = headingSample(self._heading.getValue(), 'Main heading')
            normal1 = normalSample(self._normal.getValue(),
                                   'Normal text will appear like this.')
            normal2 = normalSample(
                self._normal.getValue(),
                'Paragraphs of normal text are used for standard content.')
            ui1 = uiHeadingSample(self._uiHeading.getValue(), 'UI heading')
            genericLabel = Label(
                'Generic text (within controls, code, etc) will appear like this.'
            )
            buttons = self._buttonRowStyle(
                Row([
                    Button.buttonWithLabel('Button %d' % (i, ), None)
                    for i in xrange(0, 5)
                ]))
            ui = Section(ui1, Column([genericLabel,
                                      Spacer(0.0, 7.0), buttons]))
            page = Page([title, Body([heading, normal1, normal2, ui])])

            return Column([label, Spacer(0.0, 15.0), page])
예제 #27
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)
예제 #28
0
def _contentsList(controls, contentsLists, title):
    controlsBox = _appDocumentControlsStyle.applyTo(
        Row([c.padX(_controlsPadding) for c in controls]))
    controlsBorder = _appDocumentControlsBorder.surround(controlsBox)

    openDocumentsSeparator = HSeparator()

    docListBox = _documentListTableStyle.applyTo(RGrid(contentsLists))

    contentsBox = Column([
        controlsBorder.pad(2.0, 2.0), openDocumentsSeparator,
        docListBox.pad(12.0, 2.0)
    ])

    heading = SectionHeading1(title)

    return Section(heading, contentsBox)
예제 #29
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)
	def __present__(self, fragment, inheritedState):
		def _embeddedDisplayMenu(element, menu):
			def _onClear(item):
				self._clear()

			menu.add( MenuItem.menuItemWithLabel( 'Clear collected values', _onClear ) )

			return False



		self._incr.onAccess()
		suitePres = self._suite

		valuesPres = TabbedBox( [ [ Label( 'Tree' ), self._treeView ],  [ Label( 'Table' ), self._tableView ] ], None )

		contents = Column( [ suitePres, valuesPres ] )
		return ObjectBox( 'Trace visualisation', contents ).withContextMenuInteractor( _embeddedDisplayMenu ).withCommands( _mxCommands )