330 likes | 363 Views
Explore the transformation of the BOY code into a more efficient and reliable Display Builder system, featuring enhanced widgets, properties, and JavaFX representation. Navigate through the new model design and persistent updates for seamless monitoring and control.
E N D
Display Builder Update Kay Kasemir, Megan Grodowitz Amanda Carpenter May 2016, ESS EPICS Meeting
Issue: Too much on UI Thread • Load *.opi file • Load embedded *.opi (Linking Container) • Handle PV updates • Execute scripts CS-Studio “freezes”
BOY code: Change step by step? Difficult: Based on GEditorF • SWT/Draw2d • UI Thread Risky: BOY is used in operation • Unintended side effects (Linking Container, macros, views) • Rewrite Editor Runtime PV Representation JavaFX Model
Editor Runtime Display builder Update PV Representation JavaFX “Looks like BOY”, but better • Model: Widgets, Properties, file format • Representation: On-screen objects, JavaFX (or SWT) • Runtime: PVs, scripts Model BOY Update
Load Displays: BOY vs. Display Builder UI thread (BOY) vs. Background threads (Display Builder) boy_delay1.mov vs. builder_delay1.mov (Both BOY and display.builder have 2 sec delay in file access to simulate slow file access)
Editor Runtime Model PV Representation JavaFX Widgets • Arc, Rectangle, Label, LED, TextUpdate, .. • Group (contains other widgets) • Embedded Display Properties • Allow changes from any thread • Change notification • Controlled order Persistence • Loads existing *.opi files • Saves in defined order Macros • For ‘text’ as well as ‘x’, ‘visible’, .. Colors, Fonts Model TODO • Many more properties and widgets • Defaults based on ‘class’ property
Editor Runtime Representation PV Representation JavaFX Java FX • For all widgets SWT • Very few widgets, just to show it’s possible Fixed the font size problem! • BOY “point size” vs. pixel Model TODO • Many more widgets • Many properties • Web Representation?
Editor Runtime Runtime PV Representation JavaFX Common Widget Runtime • Loads model in background • Creates representation on UI thread • Handles PVs and scripts (rules) in background • One Jython interpreter & thread per window • Throttles UI updates EmbeddedDisplay Runtime • Keeps hosted display private ActionButton Runtime • Replaces current oropens new window Model TODO • ??
File Format • Similar • Concise • Useful order
Widget Model: Consolidate, Refine • Rectangle, Rounded Rectangle • Rectangle w/ corner width, height • LED with different PV behavior • LED for binary PV or ‘bit’ • MultiStateLED for N states
Properties: Arrays and Structures “trace_0_color”, .., “state_value_11” • Actual arrays and structures:“traces[0].color”, “states[11].value”Array size only limited by memory
Keyboard Navigation in JavaFX • ‘Tab’ move in widget order • ‘Shift-Cursor’ move in on-screen order .. was impossible because of SWT/Draw2d mix
Alarm-sensitive Border Space-efficient,distinguishable • Minor:Single-line • Major:Double-line • Invalid/Disconnected:Broken line.. now without widget body resize
Plotting Basics of Image and XYPlot “work”
Image Widget Default color map: Viridis “perceptually uniform” https://twitter.com/LeedeMora,SciPy2015 on YouTube
Editor Runtime Editor PV Representation JavaFX • Palette • Properties • In defined order • No more off-screen value column • Tracker to move/resize • Snap-to-Grid • Snap-to-Geometry (parallelized) • Toolbar • Un-do • Front/back • Align top/center/.., distribute • Selection • Rubberband, multi-widget, • In and out of ‘Group’ • Outline (Widget Tree) Model TODO • Rulers?
Context-based Inline Editor • In editor, Double-click widget for • PV Name (Any widget with PV) • Text (Label Widget)
Poly Editor • ‘Append’ Mode • Add points • Delete last point • ‘Edit’ Mode • Move • Add • Delete points Toggle between modes
Scripts • Execute in background Minimalscript compatibility: val = PVUtil.getDouble(pvs[0]) pos = 100 + 20*val widget.setPropertyValue(“x”, pos) Weren’t kidding when telling youto avoid scripts because compatibilityis not guaranteed. http://imgs.xkcd.com/comics/workflow.png
Rule & Script Dialog Streamlining All rules of a widget in one dialog
You should still avoid scripts .. but if you ignore this advice,you’ll find they work better than before (Long running script example)
Status • Examined ~200 SNS Instrument screens • Many screens complete or nearly complete! • Missing widgets: • Menu Button • Byte Monitor • .. • Missing Properties • XYPlot • Image (Intensity Graph) • Some need manual work • Scripts, Rules
Outlook • Implement most BOY-type Widgets & Properties • Priority based on SNS instrument needs • Plan to add vtype.pv.mqtt • IoT • Continue to allow Standalone Editor, Runtime • Use outside of CS-Studio • Eclipse Project?
Boy, Only Better • Separate Model, Representation, Runtime • Background threads, less freezing • Minimal script compatibility Status • Reads existing files • Handles basic instrument displays • 1/3 of BOY widgets withessential features • First release end-2016
Design Time Data Flow Add Widget, Set Property Editor Presentcurrent stateof Model Update File Save Representation Model JFX Notify of changes
Runtime Data Flow Runtime PV Scripts, (Rules) UI Event Presentcurrent stateof Model Enter Text,Push Button File Update Load Representation Model JFX Notify of changes