from BritefuryJ.Controls import Button, RealSpinEntry from BritefuryJ.Pres import Pres from BritefuryJ.Pres.Primitive import Primitive, Label, Bin, Row, Column, Table from BritefuryJ.StyleSheet import StyleSheet from LarchCore.Languages.Python2 import Schema as Py from LarchTools.PythonTools.GUIEditor.DataModel import GUIObject, TypedEvalField _uniformStyle = StyleSheet.style(Primitive.foreground(Color(0.2, 0.25, 0.3)), Primitive.fontSize(11)) _boxStyle = StyleSheet.style(Primitive.background(FilledOutlinePainter(Color(0.7, 0.75, 0.8), Color(0.6, 0.65, 0.7))), Primitive.fontSize(11), Primitive.foreground(Color(0.0, 0.0, 0.0, 0.5)), Primitive.fontItalic(True)) _tableStyle = StyleSheet.style(Primitive.tableColumnSpacing(2.0), Primitive.tableRowSpacing(2.0)) _liveLabelStyle = StyleSheet.style(Primitive.foreground(Color(0.4, 0.45, 0.5))) class AbstractPadding (GUIObject): def apply(self, p): raise NotImplementedError, 'abstract' def __apply_py_evalmodel__(self, codeGen, py_p): raise NotImplementedError, 'abstract' def _liveLabel(live):
e = xmlmodel.XmlElem(self.tag_name) if child is not None: e.append(child) return e else: return child def store_value_from_element(self, rich_text_attributes, element): rich_text_attributes.putOverride(self.tag_name, True) _italic_style = StyleSheet.instance.withValues(Primitive.fontItalic(True)) _bold_style = StyleSheet.instance.withValues(Primitive.fontBold(True)) _code_style = StyleSheet.instance.withValues( Primitive.fontFace(Primitive.monospacedFontName), Primitive.background( FilledOutlinePainter(Color(0.9, 0.9, 0.9), Color(0.75, 0.75, 0.75)))) _cmd_style = StyleSheet.instance.withValues( Primitive.fontFace(Primitive.monospacedFontName), Primitive.background( FilledOutlinePainter(Color(0.9, 0.9, 0.9), Color(0.75, 0.75, 0.75))), Primitive.foreground(Color(0.0, 0.5, 0.0))) _cmd_prompt_style = StyleSheet.instance.withValues( Primitive.foreground(Color(0.0, 0.6, 0.5))) _app_style = StyleSheet.instance.withValues( Primitive.fontItalic(True), Primitive.foreground(Color(0.5, 0.0, 0.0))) _sys_style = StyleSheet.instance.withValues( Primitive.fontFace(Primitive.monospacedFontName), Primitive.foreground(Color(0.25, 0.0, 0.5))) italic_style_attr = BooleanStyleAttribute('i')
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] class EditorPage (object):
from BritefuryJ.Controls import Button from BritefuryJ.Pres import Pres from BritefuryJ.Pres.Primitive import Primitive, Label, Arrow, Spacer, Box, Row, Column from BritefuryJ.StyleSheet import StyleSheet from BritefuryJ.Util.Coroutine import Coroutine from BritefuryJ.Live import LiveValue from LarchCore.Languages.Python2.PythonCommands import pythonCommandSet, WrapSelectedStatementRangeInEmbeddedObjectAction, EmbeddedStatementAtCaretAction, chainActions from LarchCore.Languages.Python2.Embedded import EmbeddedPython2Suite _headerStyle = StyleSheet.style( Primitive.fontBold(True), Primitive.background(FillPainter(Color(1.0, 0.95, 0.8))), Primitive.rowSpacing(5.0)) _forwardArrow = Arrow(Arrow.Direction.RIGHT, 12.0) _codeBorder = SolidBorder(1.0, 2.0, 8.0, 8.0, Color(0.75, 0.737, 0.675), None) _stepperBorder = SolidBorder(2.0, 2.0, 8.0, 8.0, Color(0.55, 0.52, 0.4), None) _breakPointBorder = SolidBorder(1.0, 1.0, 5.0, 5.0, Color(0.3, 0.3, 0.3), Color(0.85, 0.85, 0.85)) _breakPointCurrentBorder = SolidBorder(1.0, 1.0, 5.0, 5.0, Color(0.0, 0.4, 0.0), Color(0.85, 1.0, 0.85)) _breakPointStyle = StyleSheet.style(Primitive.fontSize(10)) _breakPointArrow = Arrow(Arrow.Direction.RIGHT, 8.0) class StepperCode(object): def __init__(self, stepper, suite):
from BritefuryJ.Pres import Pres from BritefuryJ.Pres.Primitive import Primitive, Label, Bin, Row, Column, Table from BritefuryJ.Pres.UI import Form from BritefuryJ.StyleSheet import StyleSheet from LarchCore.Languages.Python2 import Schema as Py from LarchTools.PythonTools.GUIEditor.DataModel import GUIObject, TypedEvalField from LarchTools.PythonTools.GUIEditor.FieldEditor import optionalTypedEditor _uniformStyle = StyleSheet.style(Primitive.foreground(Color(0.2, 0.25, 0.3)), Primitive.fontSize(11)) _boxStyle = StyleSheet.style( Primitive.background( FilledOutlinePainter(Color(0.7, 0.75, 0.8), Color(0.6, 0.65, 0.7))), Primitive.fontSize(11), Primitive.foreground(Color(0.0, 0.0, 0.0, 0.5)), Primitive.fontItalic(True)) _tableStyle = StyleSheet.style(Primitive.tableColumnSpacing(2.0), Primitive.tableRowSpacing(2.0)) _liveLabelStyle = StyleSheet.style(Primitive.foreground(Color(0.4, 0.45, 0.5))) class AbstractGUIBorder(GUIObject): def formSections(self): raise NotImplementedError, 'abstract' def makeBorder(self): raise NotImplementedError, 'abstract' def apply(self, p):
class PaletteComponentDrag(Object): def __init__(self, factory): self.factory = factory def getItem(self): return self.factory() # # #Control palette: _paletteItemStyle = StyleSheet.style( Primitive.fontSize(11), Primitive.foreground(Color(0.3, 0.3, 0.3)), Primitive.background( FilledOutlinePainter(Color.white, Color(0.8, 0.8, 0.8)))) _paletteItemBorder = SolidBorder(1.0, 2.0, Color(0.7, 0.7, 0.7), None).highlight(Color(0.6, 0.6, 0.6), Color(0.9, 0.9, 0.9)) _paletteSections = [] def paletteItem(contents, factoryCallable): p = _paletteItemStyle(_paletteItemBorder.surround( contents)).alignHExpand().alignVRefYExpand() p = p.withDragSource( PaletteComponentDrag, lambda element, aspect: PaletteComponentDrag(factoryCallable)) p = p.withDragSource( PaletteComponentIntoListDrag,