MCPcopy Index your code
hub / github.com/corecoding/Vitals / _updateDisplay

Method _updateDisplay

extension.js:654–687  ·  view source on GitHub ↗
(label, value, type, key)

Source from the content-addressed store, hash-verified

652 }
653
654 _updateDisplay(label, value, type, key) {
655 // update sensor value in menubar
656 if (this._hotLabels[key]) {
657 this._hotLabels[key].set_text(value);
658
659 // support for fixed widths #55
660 if (this._settings.get_boolean('fixed-widths')) {
661 // grab text box width and see if new text is wider than old text
662 let width2 = this._hotLabels[key].get_clutter_text().width;
663 if (width2 > this._widths[key]) {
664 this._hotLabels[key].set_width(width2);
665 this._widths[key] = width2;
666 }
667 }
668 }
669
670 // have we added this sensor before?
671 let item = this._sensorMenuItems[key];
672 if (item) {
673 // update sensor value in the group
674 item.value = value;
675 } else if (type.includes('-group')) {
676 // update text next to group header
677 let group = type.split('-')[0];
678 if (this._groups[group]) {
679 this._groups[group].status.text = value;
680 this._sensorMenuItems[type] = this._groups[group];
681 }
682 } else {
683 // add item to group for the first time
684 let sensor = { 'label': label, 'value': value, 'type': type }
685 this._appendMenuItem(sensor, key);
686 }
687 }
688
689 _appendMenuItem(sensor, key) {
690 let split = sensor.type.split('-');

Callers 1

_querySensorsMethod · 0.95

Calls 1

_appendMenuItemMethod · 0.95

Tested by

no test coverage detected