示例#1
0
 def normalSample(fontName,
                  text='The quick brown fox jumps over the lazy dog'):
     style = StyleSheet.style(
         RichText.normalTextAttrs(
             RichText.normalTextAttrs.defaultValue.withValues(
                 Primitive.fontFace(fontName))))
     return style(NormalText(text))
    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 Paragraph(self, fragment, inheritedState, node):
     text = node.getText()
     style = node.getStyle()
     if style == 'normal':
         p = NormalText(text)
     elif style == 'h1':
         p = Heading1(text)
     elif style == 'h2':
         p = Heading2(text)
     elif style == 'h3':
         p = Heading3(text)
     elif style == 'h4':
         p = Heading4(text)
     elif style == 'h5':
         p = Heading5(text)
     elif style == 'h6':
         p = Heading6(text)
     elif style == 'title':
         p = TitleBar(text)
     else:
         p = NormalText(text)
     return p
示例#4
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 Worksheet(self, fragment, inheritedState, node):
        bodyView = Pres.coerce(node.getBody())

        try:
            editSubject = fragment.subject.editSubject
        except AttributeError:
            pageContents = []
        else:
            editLink = Hyperlink('Switch to developer mode', editSubject)
            linkHeader = LinkHeaderBar([editLink])
            pageContents = [linkHeader]

        tip = TipBox([
            NormalText([
                'To edit this worksheet or add content, click ',
                EmphSpan('Switch to developer mode'), ' at the top right'
            ])
        ], 'larchcore.worksheet.view.toedit')

        w = Page(pageContents + [bodyView, tip])
        w = w.withContextMenuInteractor(_worksheetContextMenuFactory)
        return StyleSheet.style(Primitive.editable(False)).applyTo(w)
示例#6
0
    def __present__(self, fragment, inheritedState):
        helpText = NormalText(
            'Click to open the font choosers. Click on a font sample to choose it. Ctrl-click to select additional fonts.'
        )

        def titleSample(fontName, text='The quick brown fox'):
            style = StyleSheet.style(
                RichText.titleTextAttrs(
                    RichText.titleTextAttrs.defaultValue.withValues(
                        Primitive.fontFace(fontName))))
            return style(TitleBar(text))

        titleChooser = _collapsibleFontChooser('Titles', self._title,
                                               titleSample)

        def headingSample(fontName,
                          text='The quick brown fox jumps over the lazy dog'):
            style = StyleSheet.style(
                RichText.headingTextAttrs(
                    RichText.headingTextAttrs.defaultValue.withValues(
                        Primitive.fontFace(fontName))))
            return style(Heading1(text))

        headingChooser = _collapsibleFontChooser('Headings', self._heading,
                                                 headingSample)

        def normalSample(fontName,
                         text='The quick brown fox jumps over the lazy dog'):
            style = StyleSheet.style(
                RichText.normalTextAttrs(
                    RichText.normalTextAttrs.defaultValue.withValues(
                        Primitive.fontFace(fontName))))
            return style(NormalText(text))

        normalChooser = _collapsibleFontChooser('Normal text', self._normal,
                                                normalSample)

        def uiHeadingSample(fontName,
                            text='The quick brown fox jumps over the lazy dog'
                            ):
            style = StyleSheet.style(
                UI.uiTextAttrs(
                    UI.uiTextAttrs.defaultValue.withValues(
                        Primitive.fontFace(fontName))))
            return style(SectionHeading1(text))

        uiHeadingChooser = _collapsibleFontChooser('UI Headings',
                                                   self._uiHeading,
                                                   uiHeadingSample)

        def genericSample(fontName,
                          text='The quick brown fox jumps over the lazy dog'):
            style = StyleSheet.style(Primitive.fontFace(fontName))
            return style(Label(text))

        genericChooser = _collapsibleFontChooser('Generic text', self._generic,
                                                 genericSample)

        chooserColumn = self._chooserColumnStyle(
            Column([
                titleChooser, headingChooser, normalChooser, uiHeadingChooser,
                genericChooser
            ]))

        # Sample page
        @LiveFunction
        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])

        return self._mainColumnStyle(
            Column([helpText, chooserColumn, samplePage]))
	def __present__(self, fragment, inheritedState):
		x = NormalText('')
		x = GUIRichTextController.instance.editableParagraph(self, x)
		return x
示例#8
0
    def ProjectRoot(self, fragment, inheritedState, project):
        # Save and Save As
        def _onSave(control, buttonEvent):
            if document.hasFilename():
                document.save()
            else:

                def handleSaveDocumentAsFn(filename):
                    document.saveAs(filename)

                DocumentManagement.promptSaveDocumentAs(
                    world,
                    control.getElement().getRootElement().getComponent(),
                    handleSaveDocumentAsFn)

        def _onSaveAs(control, buttonEvent):
            def handleSaveDocumentAsFn(filename):
                document.saveAs(filename)

            DocumentManagement.promptSaveDocumentAs(
                world,
                control.getElement().getRootElement().getComponent(),
                handleSaveDocumentAsFn, document.getFilename())

        def _onReload(control, buttonEvent):
            if document.hasFilename():
                document.save()
                document.reload()
                project.reset()
            else:

                def handleSaveDocumentAsFn(filename):
                    document.saveAs(filename)
                    document.reload()
                    project.reset()

                DocumentManagement.promptSaveDocumentAs(
                    world,
                    control.getElement().getRootElement().getComponent(),
                    handleSaveDocumentAsFn)

        def _onExport(control, event):
            component = control.getElement().getRootElement().getComponent()
            openDialog = JFileChooser()
            openDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
            response = openDialog.showDialog(component, 'Export')
            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):
                        response = JOptionPane.showOptionDialog(
                            component,
                            'Existing content will be overwritten. Proceed?',
                            'Overwrite existing content',
                            JOptionPane.YES_NO_OPTION,
                            JOptionPane.WARNING_MESSAGE, None,
                            ['Overwrite', 'Cancel'], 'Cancel')
                        if response == JFileChooser.APPROVE_OPTION:
                            exc = None
                            try:
                                project.export(filename)
                            except:
                                exc = JythonException.getCurrentException()
                            if exc is not None:
                                BubblePopup.popupInBubbleAdjacentTo(
                                    DefaultPerspective.instance(exc),
                                    control.getElement(), Anchor.BOTTOM, True,
                                    True)

        # Python package name
        class _PythonPackageNameListener(EditableLabel.EditableLabelListener):
            def onTextChanged(self, editableLabel, text):
                if text != '':
                    project.pythonPackageName = text
                else:
                    project.pythonPackageName = None

        # Project index
        def _addPackage(menuItem):
            project.append(ProjectPackage('NewPackage'))

        def _addPage(page):
            project.append(page)

        def _projectIndexContextMenuFactory(element, menu):
            menu.add(MenuItem.menuItemWithLabel('New package', _addPackage))
            newPageMenu = PageData.newPageMenu(_addPage)
            importPageMenu = PageData.importPageMenu(
                element.getRootElement().getComponent(), _addPage)
            menu.add(
                MenuItem.menuItemWithLabel(
                    'New page', newPageMenu,
                    MenuItem.SubmenuPopupDirection.RIGHT))
            menu.add(
                MenuItem.menuItemWithLabel(
                    'Import page', importPageMenu,
                    MenuItem.SubmenuPopupDirection.RIGHT))
            return True

        # Get some initial variables
        document = fragment.subject.document
        world = fragment.subject.world

        # Title
        title = TitleBar(document.getDocumentName())

        # Controls for 'save' and 'save as'
        saveExportHeader = SectionHeading1('Save/export')
        saveButton = Button.buttonWithLabel('Save', _onSave)
        saveAsButton = Button.buttonWithLabel('Save as', _onSaveAs)
        reloadButton = Button.buttonWithLabel('Save and reload', _onReload)
        reloadButton = AttachTooltip(
            reloadButton,
            'Saves and reloads the project from scratch\nCauses all embedded objects to be re-created.'
        )
        exportButton = Button.buttonWithLabel('Export', _onExport)
        exportButton = AttachTooltip(
            exportButton,
            'Exports project contents to text files where possible.')
        saveBox = Row([
            saveButton.padX(10.0),
            Spacer(30.0, 0.0),
            saveAsButton.padX(10.0),
            Spacer(30.0, 0.0),
            reloadButton.padX(10.0),
            Spacer(50.0, 0.0),
            exportButton.padX(10.0)
        ]).alignHLeft()
        saveExportSection = Section(saveExportHeader, saveBox)

        #
        # Project Section
        #

        # Python package name
        notSet = _pythonPackageNameNotSetStyle.applyTo(Label('<not set>'))
        pythonPackageNameLabel = EditableLabel(
            project.pythonPackageName, notSet,
            _PythonPackageNameListener()).regexValidated(
                _pythonPackageNameRegex,
                'Please enter a valid dotted identifier')
        pythonPackageNameLabel = AttachTooltip( pythonPackageNameLabel, 'The root python package name is the name under which the contents of the project can be imported using import statements within the project.\n' + \
         'If this is not set, pages from this project cannot be imported.', False )
        pythonPackageNameRow = Form.Section(
            'Root Python package name',
            'Pages will not be importable unless this is set',
            pythonPackageNameLabel)

        # Clear imported modules
        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)

        resetButton = Button.buttonWithLabel('Reset', _onReset)
        resetButton = AttachTooltip(
            resetButton,
            'Unloads all modules that were imported from this project from the Python module cache. This way they can be re-imported, allowing modifications to take effect.'
        )
        resetRow = Form.Section('Reset', 'Unload project modules', resetButton)

        projectSection = Form('Project', [pythonPackageNameRow, resetRow])

        # Project index
        indexHeader = SectionHeading1('Index')

        nameElement = _projectIndexNameStyle.applyTo(Label('Project root'))
        nameBox = _itemHoverHighlightStyle.applyTo(nameElement.alignVCentre())
        nameBox = nameBox.withContextMenuInteractor(
            _projectIndexContextMenuFactory)
        nameBox = _ProjectTreeController.instance.item(project, nameBox)
        nameBox = AttachTooltip( nameBox, 'Right click to access context menu, from which new pages and packages can be created.\n' + \
         'A page called index at the root will appear instead of the project page. A page called __startup__ will be executed at start time.', False )

        itemsBox = Column(project[:]).alignHExpand()
        itemsBox = _ProjectTreeController.instance.editableList(
            project, itemsBox)

        contentsView = Column([
            nameBox.alignHExpand(),
            itemsBox.padX(_packageContentsIndentation, 0.0).alignHExpand()
        ])

        indexSection = Section(indexHeader, contentsView)

        def _onBuildJar(button, event):
            _buildProjectJar(button.element, document)

        buildJarButton = Button.buttonWithLabel('Build JAR', _onBuildJar)
        jarRow = Form.Section('Build executable app',
                              'Export the project as an executable JAR',
                              buildJarButton)

        packagingSection = Form('Packaging', [jarRow])

        indexTip = TipBox([
            NormalText([
                StrongSpan('Index: '),
                'Larch projects act like Python programs. Packages act as directories/packages and pages act as Python source files. Pages can import code from one another as if they are modules.'
            ]),
            NormalText([
                'New pages and packages can be created by right clicking on the entries in the index or on ',
                EmphSpan('Project root'),
                ' (they will highlight as you hover over them).'
            ]),
            NormalText([
                StrongSpan('Front and startup pages: '),
                'If a page is set as the front page it will appear instead of the project page. In these cases, the project page can still be reached using the links in the location bar at the top of the window.'
            ]),
            'If a page is set as the startup page, code within it will be executed before all other pages. This can be used for registering editor extensions.',
            'To set a page as the front page or the startup page, right-click on it to show its context menu and choose the appropriate option.'
        ], 'larchcore.worksheet.worksheeteditor')

        # The page
        head = Head([title])
        body = Body([
            saveExportSection, projectSection, indexSection, packagingSection,
            indexTip
        ]).alignHPack()

        return StyleSheet.style(Primitive.editable(False)).applyTo(
            Page([head, body]))
示例#9
0
    def AppState(self, fragment, state, node):
        def _onNewDoc(link, event):
            def handleNewDocumentFn(document, firstPageSubjectFn):
                name = _newDocumentName(openDocuments)
                document.setDocumentName(name)

                node.registerOpenDocument(document)

                subject = document.newSubject(fragment.subject, None,
                                              document.getDocumentName())
                subject = firstPageSubjectFn(subject)

                pageController = link.element.rootElement.pageController
                pageController.openSubject(
                    subject, PageController.OpenOperation.OPEN_IN_CURRENT_TAB)

            element = link.getElement()
            openDocuments = node.getOpenDocuments()
            DocumentManagement.promptNewDocument(fragment.subject.world,
                                                 element, handleNewDocumentFn)

            return True

        def _onOpenDoc(link, event):
            def handleOpenedDocumentFn(fullPath, document):
                appDoc = node.registerOpenDocument(document)

            element = link.getElement()
            DocumentManagement.promptOpenDocument(
                fragment.subject.world,
                element.getRootElement().getComponent(),
                handleOpenedDocumentFn)

            return True

        def _onFileListDrop(element, targetPosition, data, action):
            world = fragment.subject.world
            for filename in data:
                filename = str(filename)

                document = Document.readFile(world, filename)
                node.registerOpenDocument(document)
            return True

        def _onNewConsole(link, event):
            consoles = node.getConsoles()
            index = _newConsoleIndex(consoles)
            appConsole = Application.AppConsole(index)
            node.addConsole(appConsole)

            subject = appConsole.subject(fragment.subject)

            pageController = link.element.rootElement.pageController
            pageController.openSubject(
                subject, PageController.OpenOperation.OPEN_IN_CURRENT_TAB)

            return True

        openDocViews = Pres.mapCoerce(node.getOpenDocuments())
        consoles = Pres.mapCoerce(node.getConsoles())

        systemLink = Hyperlink('TEST PAGES', TestsRootPage.instanceSubject)
        configurationLink = Hyperlink(
            'CONFIGURATION PAGE',
            fragment.subject.world.configuration.subject())
        aboutLink = Hyperlink('ABOUT', fragment.subject.aboutPageSubject)
        linkHeader = SplitLinkHeaderBar([aboutLink],
                                        [configurationLink, systemLink])

        title = TitleBar('The Larch Environment')

        newLink = Hyperlink('NEW', _onNewDoc)
        openLink = Hyperlink('OPEN', _onOpenDoc)
        openDocumentsBox = _contentsList([newLink, openLink], openDocViews,
                                         'Documents')
        openDocumentsBox = openDocumentsBox.withNonLocalDropDest(
            DataFlavor.javaFileListFlavor, _onFileListDrop)
        openDocumentsBox = AttachTooltip(
            openDocumentsBox,
            'Click NEW to create a new document. To open from a file, click OPEN, or drag files from a file explorer application.',
            False)

        newConsoleLink = Hyperlink('NEW', _onNewConsole)
        consolesBox = _contentsList([newConsoleLink], consoles,
                                    'Python consoles')


        tip = TipBox( [ NormalText( [ StrongSpan( 'Getting started: ' ), 'To get programming quickly, create a new Python console by pressing ', EmphSpan( 'new' ), ', beneath', EmphSpan( ' Python consoles' ), '.' ] ),
          NormalText( [ 'For something more easily modifiable and something you can save, press ', EmphSpan( 'new' ), ' beneath ', EmphSpan( 'Documents' ), ' and choose the ', EmphSpan( 'Quickstart: worksheet' ), ' option.' ] ),
          NormalText( [ StrongSpan( 'Tips: ' ), 'You can highlight items that have help tips by pressing F2. Hover the pointer over them to display the tips. ' + \
                   'Some items do not display their tips unless highlighting is enabled, in order to reduce clutter.' ] ),
          NormalText( [ StrongSpan( 'Command bar: ' ), 'The command bar can be invoked by pressing the ', EmphSpan( 'escape' ), ' key. From there you can type abbreviated commands to invoke them. '
            'Alternatively, type in part of the full name of a command and autocomplete will show a list of commands that match. '
            'Press ', EmphSpan( 'tab' ), ' to switch between the entries in the autocomplete list and press ', EmphSpan( 'enter' ), ' to execute the highlighted command. '
            'Bold letters shown within command names indicate abbreviations, e.g. ', EmphSpan( 's' ), ' for ', EmphSpan( 'save' ), ' and ', EmphSpan( 'sa' ), ' for ', EmphSpan( 'save as' ), '. '
            'You can type these to execute them quickly.' ] )],
               'larchcore.mainapp.tooltiphighlights' )

        head = Head([linkHeader, title])
        body = Body([
            openDocumentsBox.pad(0.0, 10.0).alignHLeft(),
            consolesBox.pad(0.0, 10.0).alignHLeft(), tip
        ])
        return StyleSheet.style(Primitive.editable(False)).applyTo(
            Page([head, body]))
    def __present__(self, fragment, inheritedState):
        configurationLink = Hyperlink(
            'CONFIGURATION PAGE',
            fragment.subject.world.configuration.subject())
        linkHeader = LinkHeaderBar([configurationLink])

        title = TitleBar('About')

        splash = Image.systemImage('SplashScreen.png')

        desc = NormalText(
            'The Larch Environment was designed and written by Geoffrey French'
        )

        jythonLink = Hyperlink('Jython', URI('http://www.jython.org/'))
        jerichoLink = Hyperlink('Jericho HTML parser',
                                URI('http://jericho.htmlparser.net'))
        salamanderLink = Hyperlink('SVG Salamander',
                                   URI('http://svgsalamander.java.net/'))
        googleFontsLink = Hyperlink('Google Fonts',
                                    URI('http://www.google.com/fonts'))

        jythonAcks = NormalText([
            'The Larch Environment incorporates the ', jythonLink,
            ' interpreter.'
        ])
        libraryAcks = NormalText([
            'Larch incorporates the ', jerichoLink, ', and ', salamanderLink,
            ' libraries.'
        ])
        fontAcks = NormalText([
            'Larch incorporates the following fonts (found at ',
            googleFontsLink, '): ',
            'Arimo (by Steve Matteson), Lora (by Cyreal), Nobile (by Vernon Adams), Noto Sans (by Google), ',
            'Open Sans (by Steve Matteson), PT Serif (by ParaType), and Source Sans Pro (by Paul D. Hunt)'
        ])

        copyright = NormalText('(C) copyright Geoffrey French 2008-2013')

        homePage = Hyperlink('The Larch Environment website',
                             URI('http://www.larchenvironment.com'))

        head = Head([linkHeader, title])
        body = Body([
            splash.padY(20.0).alignHCentre(),
            desc.padY(10.0).alignHCentre(),
            Spacer(0.0, 10.0),
            jythonAcks.pad(25.0, 5.0).alignHLeft(),
            libraryAcks.pad(25.0, 5.0).alignHLeft(),
            fontAcks.pad(25.0, 5.0).alignHLeft(),
            Spacer(0.0, 10.0),
            Row([copyright.alignHLeft(),
                 homePage.alignHRight()]).pad(10.0, 10.0).alignHExpand()
        ])
        return StyleSheet.style(Primitive.editable(False)).applyTo(
            Page([head, body]))
示例#11
0
 def __present__(self, fragment, inheritedState):
     self._incr.onAccess()
     x = NormalText('')
     x = controller.MallardRichTextController.instance.editableParagraph(
         self, x)
     return x
	def __present__(self, fragment, inheritedState):
		blocks = self.getBlocks()
		currentModule = Python2.python2EditorPerspective.applyTo( self.getCurrentPythonModule() )

		def _onDrop(element, pos, data, action):
			class _VarNameEntryListener (TextEntry.TextEntryListener):
				def onAccept(listenerSelf, entry, text):
					self.assignVariable( text, data.getModel() )
					_finish( entry )

				def onCancel(listenerSelf, entry, text):
					_finish( entry )

			def _finish(entry):
				caret.moveTo( marker )
				dropPromptLive.setLiteralValue( Blank() )

			dropPrompt = _dropPrompt( _VarNameEntryListener() )
			rootElement = element.getRootElement()
			caret = rootElement.getCaret()
			marker = caret.getMarker().copy()
			dropPromptLive.setLiteralValue( dropPrompt )
			rootElement.grabFocus()

			return True



		# Header
		if self._showBanner:
			bannerVersionText = [ _bannerTextStyle.applyTo( NormalText( v ) )   for v in sys.version.split( '\n' ) ]
			helpText1 = Row( [ _bannerHelpKeyTextStyle.applyTo( Label( 'Ctrl+Enter' ) ),
					   _bannerHelpTextStyle.applyTo( Label( ' - execute and evaluate, ' ) ),
					   _bannerHelpKeyTextStyle.applyTo( Label( 'Ctrl+Shift+Enter' ) ),
					   _bannerHelpTextStyle.applyTo( Label( ' - execute only' ) ) ] )
			helpText2 = Row( [ _bannerHelpKeyTextStyle.applyTo( Label( 'Alt+Up' ) ),
					   _bannerHelpTextStyle.applyTo( Label( ' - previous, ' ) ),
					   _bannerHelpKeyTextStyle.applyTo( Label( 'Alt+Down' ) ),
					   _bannerHelpTextStyle.applyTo( Label( ' - next' ) ) ] )
			bannerText = Column( bannerVersionText + [ helpText1, helpText2 ] ).alignHPack()

			banner = _bannerBorder.surround( bannerText )
		else:
			banner = None


		dropDest = ObjectDndHandler.DropDest( FragmentData, _onDrop )

		def _onExecute(element):
			self.execute( True )

		def _onExecuteNoEval(element):
			self.execute( False )

		def _onHistoryPrev(element):
			self.backwards()

		def _onHistoryNext(element):
			self.forwards()

		currentModule = Span( [ currentModule ] )
		currentModule = currentModule.withShortcut( _executeShortcut, _onExecute )
		currentModule = currentModule.withShortcut( _executeNoEvalShortcut, _onExecuteNoEval )
		currentModule = currentModule.withShortcut( _historyPreviousShortcut, _onHistoryPrev )
		currentModule = currentModule.withShortcut( _historyNextShortcut, _onHistoryNext )

		m = _pythonModuleBorderStyle.applyTo( Border( currentModule.alignHExpand() ) ).alignHExpand()
		m = m.withDropDest( dropDest )
		def _ensureCurrentModuleVisible(element, ctx, style):
			element.ensureVisible()
		m = m.withCustomElementAction( _ensureCurrentModuleVisible )

		dropPromptLive = LiveValue( Span( [] ) )
		dropPromptView = dropPromptLive

		consoleColumnContents = [ banner.alignVRefY() ]   if self._showBanner   else []
		if len( blocks ) > 0:
			blockList = _consoleBlockListStyle.applyTo( Column( blocks ) ).alignHExpand()
			consoleColumnContents += [ blockList.alignVRefY(), dropPromptView.alignVRefY(), m.alignVRefY() ]
		else:
			consoleColumnContents += [ dropPromptView.alignVRefY(), m.alignVRefY() ]
		return _consoleStyle.applyTo( Column( consoleColumnContents ) ).alignHExpand().alignVTop()