Sensor readings callbacks in all pages
This commit is contained in:
parent
6f7134d6fb
commit
6ef5ad15f7
@ -24,3 +24,8 @@ from gi.repository import Gtk
|
|||||||
class AperturePriorityPage(Gtk.Box):
|
class AperturePriorityPage(Gtk.Box):
|
||||||
__gtype_name__ = 'AperturePriorityPage'
|
__gtype_name__ = 'AperturePriorityPage'
|
||||||
|
|
||||||
|
def onValuesChanged(self, isoSpeed: int, sensorValue: float, sensorUnit: str):
|
||||||
|
# Check the unit is absolute ("lux")
|
||||||
|
if sensorUnit != "lux":
|
||||||
|
return
|
||||||
|
|
||||||
|
@ -24,3 +24,9 @@ from gi.repository import Gtk
|
|||||||
class ManualExposurePage(Gtk.Box):
|
class ManualExposurePage(Gtk.Box):
|
||||||
__gtype_name__ = 'ManualExposurePage'
|
__gtype_name__ = 'ManualExposurePage'
|
||||||
|
|
||||||
|
|
||||||
|
def onValuesChanged(self, isoSpeed: int, sensorValue: float, sensorUnit: str):
|
||||||
|
# Check the unit is absolute ("lux")
|
||||||
|
if sensorUnit != "lux":
|
||||||
|
return
|
||||||
|
|
||||||
|
@ -23,4 +23,9 @@ from gi.repository import Gtk
|
|||||||
@Gtk.Template(resource_path='/eu/ichibi/Lumos/widgets/time_priority_page.ui')
|
@Gtk.Template(resource_path='/eu/ichibi/Lumos/widgets/time_priority_page.ui')
|
||||||
class TimePriorityPage(Gtk.Box):
|
class TimePriorityPage(Gtk.Box):
|
||||||
__gtype_name__ = 'TimePriorityPage'
|
__gtype_name__ = 'TimePriorityPage'
|
||||||
|
|
||||||
|
def onValuesChanged(self, isoSpeed: int, sensorValue: float, sensorUnit: str):
|
||||||
|
# Check the unit is absolute ("lux")
|
||||||
|
if sensorUnit != "lux":
|
||||||
|
return
|
||||||
|
|
||||||
|
@ -28,7 +28,12 @@ class LumosWindow(Adw.ApplicationWindow):
|
|||||||
error_banner = Gtk.Template.Child()
|
error_banner = Gtk.Template.Child()
|
||||||
sensor_unit_error_banner = Gtk.Template.Child()
|
sensor_unit_error_banner = Gtk.Template.Child()
|
||||||
# Pages
|
# Pages
|
||||||
|
aperture_priority_page_widget = Gtk.Template.Child()
|
||||||
|
time_priority_page_widget = Gtk.Template.Child()
|
||||||
|
manual_page_widget = Gtk.Template.Child()
|
||||||
sensor_readings_page_widget = Gtk.Template.Child()
|
sensor_readings_page_widget = Gtk.Template.Child()
|
||||||
|
# ISO selector in title bar
|
||||||
|
iso_dropdown = Gtk.Template.Child()
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
@ -49,8 +54,15 @@ class LumosWindow(Adw.ApplicationWindow):
|
|||||||
|
|
||||||
def onSensorRead(self, value: float, unit: str):
|
def onSensorRead(self, value: float, unit: str):
|
||||||
# Called when the light value changed: notify all pages
|
# Called when the light value changed: notify all pages
|
||||||
|
isoSpeed = int(self.iso_dropdown.get_selected_item().get_string()[4:])
|
||||||
|
if self.aperture_priority_page_widget:
|
||||||
|
self.aperture_priority_page_widget.onValuesChanged(isoSpeed, value, unit)
|
||||||
|
if self.time_priority_page_widget:
|
||||||
|
self.time_priority_page_widget.onValuesChanged(isoSpeed, value, unit)
|
||||||
|
if self.manual_page_widget:
|
||||||
|
self.manual_page_widget.onValuesChanged(isoSpeed, value, unit)
|
||||||
if self.sensor_readings_page_widget:
|
if self.sensor_readings_page_widget:
|
||||||
self.sensor_readings_page_widget.onValuesChanged(100, value, unit)
|
self.sensor_readings_page_widget.onValuesChanged(isoSpeed, value, unit)
|
||||||
|
|
||||||
# Check the unit is absolute ("lux"), otherwise there's no way to convert to an absolute EV value
|
# Check the unit is absolute ("lux"), otherwise there's no way to convert to an absolute EV value
|
||||||
if unit != "lux":
|
if unit != "lux":
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<object class="AdwHeaderBar" id="header_bar">
|
<object class="AdwHeaderBar" id="header_bar">
|
||||||
<child type="start">
|
<child type="start">
|
||||||
<!-- ISO Selector in header bar (left) -->
|
<!-- ISO Selector in header bar (left) -->
|
||||||
<object class="GtkDropDown" id="iso-dropdown">
|
<object class="GtkDropDown" id="iso_dropdown">
|
||||||
<property name="model">
|
<property name="model">
|
||||||
<object class="GtkStringList">
|
<object class="GtkStringList">
|
||||||
<items>
|
<items>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
<property name="icon-name">camera-shutter-symbolic</property>
|
<property name="icon-name">camera-shutter-symbolic</property>
|
||||||
<property name="use-underline">true</property>
|
<property name="use-underline">true</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="AperturePriorityPage" id="aperture-priority-page-widget">
|
<object class="AperturePriorityPage" id="aperture_priority_page_widget">
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
@ -84,7 +84,7 @@
|
|||||||
<property name="icon-name">camera-timer-symbolic</property>
|
<property name="icon-name">camera-timer-symbolic</property>
|
||||||
<property name="use-underline">true</property>
|
<property name="use-underline">true</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="TimePriorityPage" id="time-priority-page-widget">
|
<object class="TimePriorityPage" id="time_priority_page_widget">
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
@ -98,7 +98,7 @@
|
|||||||
<property name="icon-name">encoder-knob-symbolic</property>
|
<property name="icon-name">encoder-knob-symbolic</property>
|
||||||
<property name="use-underline">true</property>
|
<property name="use-underline">true</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="ManualExposurePage" id="manual-page">
|
<object class="ManualExposurePage" id="manual_page_widget">
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
|
Loading…
Reference in New Issue
Block a user