Example #1
0
from BritefuryJ.Pres.UI import SectionHeading1
from BritefuryJ.Controls import ScrolledViewport

from BritefuryJ.Graphics import SolidBorder, FillPainter

from BritefuryJ.StyleSheet import StyleSheet

from BritefuryJ.DefaultPerspective import DefaultPerspective
from BritefuryJ.Projection import TransientSubject
from Britefury.Kernel.Document import Document

from LarchCore.MainApp.MainAppViewer.View import perspective
from LarchCore.MainApp.MainAppViewer.AboutPage import AboutPage


_info_style = StyleSheet.style(Primitive.selectable(False), Primitive.editable(False))
_editable_style = StyleSheet.style(Primitive.selectable(True), Primitive.editable(True))

_section_heading_style = StyleSheet.style(Primitive.background(FillPainter(Color(0.925, 0.925, 0.925))))

_section_border = SolidBorder(1.0, 3.0, 4.0, 4.0, Color(0.4, 0.4, 0.4), None)


def unload_modules_starting_with(prefixes):
	to_remove = []
	for m in sys.modules:
		for prefix in prefixes:
			if m.startswith(prefix):
				to_remove.append(m)
	for m in to_remove:
		del sys.modules[m]
Example #2
0
from BritefuryJ.StyleSheet import StyleSheet

from BritefuryJ.DefaultPerspective import DefaultPerspective
from BritefuryJ.Projection import TransientSubject
from Britefury.Kernel.Document import Document

from LarchCore.MainApp.MainAppViewer.View import perspective
from LarchCore.MainApp.MainAppViewer.AboutPage import AboutPage

from Britefury import app_in_jar

from main_app import editor_page



_page_style = StyleSheet.style(Primitive.selectable(False), Primitive.editable(False))
_dir_style = StyleSheet.style(Primitive.foreground(Color(0.0, 0.2, 0.4)))



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
_fragSelectorEntryBorder = SolidBorder(1.0, 3.0, 6.0, 6.0,
                                       Color(0.8, 0.8, 0.8), None,
                                       Color(0.5, 0.5, 0.5),
                                       Color(0.9, 0.9, 0.9))

_fragContentHighlighter = ElementHighlighter(
    FilledOutlinePainter(Color(0.0, 1.0, 0.0, 0.1), Color(0.0, 0.5, 0.0, 0.5)))
_objectKindStyleJava = StyleSheet.style(
    Primitive.fontSize(10), Primitive.foreground(Color(0.0, 0.0, 0.5)))
_objectKindStylePython = StyleSheet.style(
    Primitive.fontSize(10), Primitive.foreground(Color(0.0, 0.5, 0.0)))
_objectKindStyleDocModel = StyleSheet.style(
    Primitive.fontSize(10), Primitive.foreground(Color(0.5, 0.5, 0.5)))
_consoleStyle = StyleSheet.style(Primitive.editable(True),
                                 Primitive.selectable(True))
_inspectorStyle = StyleSheet.style(Primitive.editable(False),
                                   Primitive.selectable(False))

_objectKindJava = _objectKindStyleJava(Label('Java'))
_objectKindPython = _objectKindStylePython(Label('Python'))
_objectKindDocModel = _objectKindStyleDocModel(Label('DocModel'))

_objectKindMap = {
    TypeUtils.ObjectKind.JAVA: _objectKindJava,
    TypeUtils.ObjectKind.PYTHON: _objectKindPython,
    TypeUtils.ObjectKind.DOCMODEL: _objectKindDocModel,
}


class _FragmentSelectorEntryInteractor(HoverElementInteractor,