Howto:Reset/re-init Troubleshooting: Difference between revisions

Jump to navigation Jump to search
m
→‎Nasal dialog: micro-optimization, use a separate column for the status text, so that we can use hide/show at a later time
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 label; # we want to update the label elsewhere
     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
     test.label = addTest(root: scrollContent, layout: list, test: test);
     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.label._view._text.get("text");
         var currentText = test.status._view._text.get("text");
         var neededLabel = test.name ~ suffix;
         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.label.setText(neededLabel);
         test.status.setText(neededLabel);
     }
     }
}
}

Navigation menu