803 + def _select_single_alarm_day(self, index): 804 + """ function for selecting the day passed to the function. 805 + 806 + :param index: the day to be selected 807 + 808 + """ 809 + dayCheckbox = self.wait_select_single( 810 + 'CheckBox', objectName='daySwitch{}'.format(index)) 811 + if not dayCheckbox.checked: 812 + self.pointing_device.click_object(dayCheckbox) 813 + 814 + @autopilot_logging.log_action(logger.info) 815 + def unselect_selected_days(self): 816 + """ function for unselecting already selected days. """ 817 + for index in range(self._get_num_of_days()): 818 + if self.wait_select_single( 819 + 'CheckBox', objectName='daySwitch{}'.format(index))\ 820 + .checked: 821 + self.pointing_device.click_object(self.wait_select_single( 822 + 'CheckBox', objectName='daySwitch{}'.format(index))) 823 + break
In these 2 functions, you are using the IF loop to check if the switch is checked or not. Why not use the Ubuntu SDK helpers for this? http://developer.ubuntu.com/api/devel/ubuntu-14.10/python/autopilot-emulator/ubuntuuitoolkit.html#ubuntuuitoolkit.emulators.CheckBox has two functions check() and uncheck() which will automatically check and do the respective actions.
This would make it as simple as,
dayCheckbox.check()
or
dayCheckbox.uncheck()
« Back to merge proposal
803 + def _select_ single_ alarm_day( self, index): select_ single( 'daySwitch{ }'.format( index)) checked: device. click_object( dayCheckbox) logging. log_action( logger. info) selected_ days(self) : _get_num_ of_days( )): select_ single( 'daySwitch{ }'.format( index)) \ device. click_object( self.wait_ select_ single( 'daySwitch{ }'.format( index)) )
804 + """ function for selecting the day passed to the function.
805 +
806 + :param index: the day to be selected
807 +
808 + """
809 + dayCheckbox = self.wait_
810 + 'CheckBox', objectName=
811 + if not dayCheckbox.
812 + self.pointing_
813 +
814 + @autopilot_
815 + def unselect_
816 + """ function for unselecting already selected days. """
817 + for index in range(self.
818 + if self.wait_
819 + 'CheckBox', objectName=
820 + .checked:
821 + self.pointing_
822 + 'CheckBox', objectName=
823 + break
In these 2 functions, you are using the IF loop to check if the switch is checked or not. Why not use the Ubuntu SDK helpers for this? http:// developer. ubuntu. com/api/ devel/ubuntu- 14.10/python/ autopilot- emulator/ ubuntuuitoolkit .html#ubuntuuit oolkit. emulators. CheckBox has two functions check() and uncheck() which will automatically check and do the respective actions.
This would make it as simple as,
dayCheckbox.check()
or
dayCheckbox. uncheck( )