Update time priority page on shutter speed dropdown change
This commit is contained in:
parent
95164ddb41
commit
b2c70d5c80
@ -26,7 +26,7 @@ class TimePriorityPage(Gtk.Box):
|
|||||||
__gtype_name__ = 'TimePriorityPage'
|
__gtype_name__ = 'TimePriorityPage'
|
||||||
|
|
||||||
# Values of time dropdown entries defined in the .ui file
|
# Values of time dropdown entries defined in the .ui file
|
||||||
time_priority_speed_dropdown_values = [
|
__time_priority_speed_dropdown_values = [
|
||||||
1/4000,
|
1/4000,
|
||||||
1/2000,
|
1/2000,
|
||||||
1/1000,
|
1/1000,
|
||||||
@ -51,22 +51,29 @@ class TimePriorityPage(Gtk.Box):
|
|||||||
time_priority_speed_dropdown = Gtk.Template.Child()
|
time_priority_speed_dropdown = Gtk.Template.Child()
|
||||||
time_priority_aperture_label = Gtk.Template.Child()
|
time_priority_aperture_label = Gtk.Template.Child()
|
||||||
|
|
||||||
lastSensorValue = None
|
__sensorValue = None
|
||||||
|
__isoSpeed = 100
|
||||||
|
|
||||||
def onValuesChanged(self, isoSpeed: int, sensorValue: float, sensorUnit: str):
|
def onValuesChanged(self, isoSpeed: int, sensorValue: float, sensorUnit: str):
|
||||||
# Check the unit is absolute ("lux")
|
# Check the unit is absolute ("lux")
|
||||||
if sensorUnit != "lux":
|
if sensorUnit != "lux":
|
||||||
return
|
return
|
||||||
|
|
||||||
self.lastSensorValue = sensorValue
|
self.__sensorValue = sensorValue
|
||||||
self.updateView(isoSpeed, sensorValue)
|
self.__isoSpeed = isoSpeed
|
||||||
|
self.updateView()
|
||||||
|
|
||||||
def onIsoSpeedChanged(self, isoSpeed: int):
|
def onIsoSpeedChanged(self, isoSpeed: int):
|
||||||
if self.lastSensorValue:
|
self.__isoSpeed = isoSpeed
|
||||||
self.updateView(isoSpeed, self.lastSensorValue)
|
if self.__sensorValue:
|
||||||
|
self.updateView()
|
||||||
|
|
||||||
def updateView(self, isoSpeed: int, sensorValue: float):
|
def updateView(self):
|
||||||
shutterSpeed = self.time_priority_speed_dropdown_values[self.time_priority_speed_dropdown.get_selected()]
|
shutterSpeed = self.__time_priority_speed_dropdown_values[self.time_priority_speed_dropdown.get_selected()]
|
||||||
apertureValue = EVCalculator.calcAperture(isoSpeed, sensorValue, shutterSpeed)
|
apertureValue = EVCalculator.calcAperture(self.__isoSpeed, self.__sensorValue, shutterSpeed)
|
||||||
# TODO: Round aperture value to nearest existing value and set label color to red if outside 1 stop range
|
# TODO: Round aperture value to nearest existing value and set label color to red if outside 1 stop range
|
||||||
self.time_priority_aperture_label.set_label("f/ {:.2f}".format(apertureValue))
|
self.time_priority_aperture_label.set_label("f/ {:.2f}".format(apertureValue))
|
||||||
|
|
||||||
|
@Gtk.Template.Callback()
|
||||||
|
def onShutterSpeedChanged(self, dropDown: Gtk.DropDown, _: any):
|
||||||
|
self.updateView()
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
</items>
|
</items>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
|
<signal name="notify::selected-item" handler="onShutterSpeedChanged"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user