Red/orange/green thread status in Walker

John did most of the work
db4
nicolas-p 2015-07-26 09:39:18 +02:00 committed by John Benediktsson
parent 61552d2901
commit 279795dbfd
2 changed files with 32 additions and 18 deletions

View File

@ -18,7 +18,7 @@ CONSTANT: column-title-background COLOR: grey95
CONSTANT: roll-button-rollover-border COLOR: gray50 CONSTANT: roll-button-rollover-border COLOR: gray50
CONSTANT: roll-button-selected-background COLOR: dark-gray CONSTANT: roll-button-selected-background COLOR: dark-gray
CONSTANT: source-files-color COLOR: NavajoWhite CONSTANT: source-files-color COLOR: yellow2
CONSTANT: errors-color COLOR: chocolate1 CONSTANT: errors-color COLOR: chocolate1
CONSTANT: details-color COLOR: SlateGray2 CONSTANT: details-color COLOR: SlateGray2
@ -39,7 +39,11 @@ CONSTANT: contents-color COLOR: orchid2
CONSTANT: help-header-background CONSTANT: help-header-background
T{ rgba { red 0.9568 } { green 0.9450 } { blue 0.8509 } { alpha 1.0 } } inline T{ rgba { red 0.9568 } { green 0.9450 } { blue 0.8509 } { alpha 1.0 } } inline
CONSTANT: thread-status-background CONSTANT: thread-status-stopped-background
T{ rgba { red 0.9568 } { green 0.8509 } { blue 0.8509 } { alpha 1.0 } } inline
CONSTANT: thread-status-suspended-background
T{ rgba { red 0.9568 } { green 0.9450 } { blue 0.8509 } { alpha 1.0 } } inline
CONSTANT: thread-status-running-background
T{ rgba { red 0.9295 } { green 0.9569 } { blue 0.8510 } { alpha 1.0 } } inline T{ rgba { red 0.9295 } { green 0.9569 } { blue 0.8510 } { alpha 1.0 } } inline
CONSTANT: error-summary-background CONSTANT: error-summary-background

View File

@ -38,26 +38,36 @@ M: walker-gadget ungraft*
M: walker-gadget focusable-child* M: walker-gadget focusable-child*
traceback>> ; traceback>> ;
: walker-state-string ( status thread -- string ) : thread-status-text ( status thread -- string )
[ name>> swap {
"Thread: " % { +stopped+ "Stopped" }
dup name>> % { +suspended+ "Suspended" }
" (" % { +running+ "Running" }
swap { } at "Thread: %s (%s)" sprintf ;
{ +stopped+ "Stopped" }
{ +suspended+ "Suspended" } : thread-status-color ( status -- color )
{ +running+ "Running" } {
} at % { +stopped+ [ thread-status-stopped-background ] }
")" % { +suspended+ [ thread-status-suspended-background ] }
drop { +running+ [ thread-status-running-background ] }
] "" make ; { f [ content-background ] }
} case ;
TUPLE: thread-status < label thread ;
M: thread-status model-changed
[ value>> ] dip {
[ [ thread>> thread-status-text ] [ string<< ] bi ]
[ [ thread-status-color <solid> ] [ parent>> interior<< ] bi* ]
} 2cleave ;
: <thread-status> ( model thread -- gadget ) : <thread-status> ( model thread -- gadget )
'[ _ walker-state-string ] <arrow> <label-control> ; "" thread-status new-label
swap >>thread
swap >>model ;
: add-thread-status ( track -- track ) : add-thread-status ( track -- track )
dup status>> self <thread-status> margins dup status>> self <thread-status> margins
thread-status-background <solid> >>interior
f track-add ; f track-add ;
: add-traceback ( track -- track ) : add-traceback ( track -- track )