widalarmeta: reload widget when alarms change
parent
0dd67533ac
commit
f9d6ca1c13
|
|
@ -12,3 +12,4 @@
|
||||||
0.08: Selectable font. Allow to disable hour padding.
|
0.08: Selectable font. Allow to disable hour padding.
|
||||||
0.09: Match draw() API e.g. to allow wid_edit to alter this widget
|
0.09: Match draw() API e.g. to allow wid_edit to alter this widget
|
||||||
0.10: Change 4x5 font to 6x8, teletext is now default font
|
0.10: Change 4x5 font to 6x8, teletext is now default font
|
||||||
|
0.11: Bugfix: handle changes in alarms (e.g. done without a load, such as via fastload)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "widalarmeta",
|
"id": "widalarmeta",
|
||||||
"name": "Alarm & Timer ETA",
|
"name": "Alarm & Timer ETA",
|
||||||
"shortName": "Alarm ETA",
|
"shortName": "Alarm ETA",
|
||||||
"version": "0.10",
|
"version": "0.11",
|
||||||
"description": "A widget that displays the time to the next Alarm or Timer in hours and minutes, maximum 24h (configurable).",
|
"description": "A widget that displays the time to the next Alarm or Timer in hours and minutes, maximum 24h (configurable).",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
function getNextAlarm(date) {
|
function getNextAlarm(date) {
|
||||||
const alarms = require("sched")
|
const alarms = require("sched")
|
||||||
.getAlarms()
|
.getAlarms()
|
||||||
|
// more precise filtering is done using getTimeToAlarm() below
|
||||||
.filter(alarm => alarm.on && alarm.hidden !== true);
|
.filter(alarm => alarm.on && alarm.hidden !== true);
|
||||||
|
|
||||||
WIDGETS["widalarmeta"].numActiveAlarms = alarms.length;
|
WIDGETS["widalarmeta"].numActiveAlarms = alarms.length;
|
||||||
|
|
@ -123,11 +124,15 @@
|
||||||
area:"tl",
|
area:"tl",
|
||||||
width: 0, // hide by default = assume no timer
|
width: 0, // hide by default = assume no timer
|
||||||
draw:draw,
|
draw:draw,
|
||||||
reload: () => {
|
reload: function () {
|
||||||
|
this.nextAlarm = undefined;
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
g.clear();
|
g.clear();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Bangle.on("alarmReload", () => WIDGETS["widalarmeta"].reload());
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue