diff --git a/src/window.py b/src/window.py
index c05c6f6..db3f7df 100644
--- a/src/window.py
+++ b/src/window.py
@@ -29,6 +29,7 @@ class LumosWindow(Adw.ApplicationWindow):
lux_label = Gtk.Template.Child()
ev_label = Gtk.Template.Child()
error_banner = Gtk.Template.Child()
+ sensor_unit_error_banner = Gtk.Template.Child()
def __init__(self, **kwargs):
super().__init__(**kwargs)
@@ -49,9 +50,15 @@ class LumosWindow(Adw.ApplicationWindow):
def onSensorRead(self, value: float, unit: str):
# Called when the light value changed
+
if self.lux_label:
self.lux_label.set_label("{:.0f} {}".format(value, unit))
+ # Check the unit is absolute ("lux"), otherwise there's no way to convert to an absolute EV value
+ if unit != "lux":
+ self.sensor_unit_error_banner.set_revealed(True)
+ return
+
# Convert lux to EV
ev = EVCalculator.luxToEV(value)
if self.ev_label:
diff --git a/src/window.ui b/src/window.ui
index 46b7c8a..e47551c 100644
--- a/src/window.ui
+++ b/src/window.ui
@@ -51,6 +51,12 @@
"
+
+
+
+"
@@ -127,7 +133,7 @@