def test_set_exposure(self): """ Test the function to set and change exposure """ exposure = Exposure(min_t=1 / 500, max_t=1 / 125) (f, t, iso, bias) = exposure.set_exposure(4.0, 1 / 100, 100, 0) self.assertEqual(f, 4.0) self.assertEqual(t, 1 / 100) (f, t, iso, base) = exposure.set_exposure(f=5.6) self.assertAlmostEqual(t, 1 / 50, 1) (f, t, iso, base) = exposure.set_exposure(t=1 / 200) self.assertAlmostEqual(f, 2.8, 1)
#! /usr/bin/env python3 # ToughExposure '''An exposure suggestor and calculator''' from collections import deque import ui import clipboard from console import hud_alert from exposure import Exposure exp = Exposure(2.0, 32.0) exp.set_exposure(5.6, 1 / 100, 100, 0) # Initialize the list of last clicked switches with two items last_adjusted = deque([None, None], maxlen=5) def slider_toggle(sender): """ The user has clicked a switch. Set the last two switches to have been clicked to on and enable the corresponding sliders. Disable the other sliders. :param sender: The switch object which was clicked :return: """ v = sender.superview name = sender.name aperture_slider = v['aperture_slider']