20,741
edits
m (→Nasal dialog: that won't work ...) |
m (→Nasal dialog: micro-optimization, use a separate column for the status text, so that we can use hide/show at a later time) |
||
Line 435: | Line 435: | ||
label.setText(test.name); | label.setText(test.name); | ||
row.addItem(label); | row.addItem(label); | ||
var status = canvas.gui.widgets.Label.new(root, canvas.style, {wordWrap: 0}); | |||
status.setText("nop"); | |||
row.addItem(status); | |||
test.status = status; | |||
# this adds a row of buttons for the 3 currently supported fgcommands | # this adds a row of buttons for the 3 currently supported fgcommands | ||
Line 446: | Line 453: | ||
} | } | ||
return | return status; # we want to update the label elsewhere | ||
}; # addTest | }; # addTest | ||
Line 522: | Line 529: | ||
# will add label fields to each test, so that labels can be dynamically updated | # will add label fields to each test, so that labels can be dynamically updated | ||
# using a different callback | # using a different callback | ||
addTest(root: scrollContent, layout: list, test: test); | |||
} | } | ||
}); # button setup (benchmark) | }); # button setup (benchmark) | ||
Line 529: | Line 536: | ||
var subsystemMonitor = func(){ | var subsystemMonitor = func(){ | ||
# frame rate & frame spacing | |||
foreach(var d; dynamicLabels) { | foreach(var d; dynamicLabels) { | ||
d.label.setText( d.cb() ); | d.label.setText( d.cb() ); | ||
Line 537: | Line 545: | ||
var suffix = isRunning ? " (active)" : " (inactive)"; | var suffix = isRunning ? " (active)" : " (inactive)"; | ||
#test.label.setBackground(color); | #test.label.setBackground(color); | ||
var currentText = test. | var currentText = test.status._view._text.get("text"); | ||
var neededLabel = | var neededLabel = suffix; | ||
#FIXME: better use show()/hide() methods here which is more efficient than changing labels per frame ... | #FIXME: better use show()/hide() methods here which is more efficient than changing labels per frame ... | ||
if (currentText == neededLabel) continue; | if (currentText == neededLabel) continue; | ||
test. | test.status.setText(neededLabel); | ||
} | } | ||
} | } |