def bind_bluetooth_device(self, sender): if len(self.blue_util.paired) == 0: system_api.open_preference('Bluetooth', wait=True, new=True) devices = {} for device in self.blue_util.paired: devices[device.name] = device.address if len(devices) > 0: return self.generate_callback_config_select( 'device_address', self.lang.description_bind_bluetooth_device, devices)(sender)
def welcome(self): self.about(True) self.select_language() self.check_accessibility(True) self.menu_set_password.callback(self.menu_set_password) self.message_box(self.lang.title_welcome, self.lang.description_welcome_pair_device) system_api.open_preference('Bluetooth', wait=True, new=True) self.bind_bluetooth_device(self.menu_bind_bluetooth_device) self.message_box(self.lang.title_welcome, self.lang.description_welcome_end) super().welcome()
def check_accessibility(self, welcome=False): for i in range(2): [stat, _, err] = osa_api.key_stroke('key code 63', constant=True) if stat == 1 and '1002' in err: if i == 0: self.message_box( self.lang.title_welcome if welcome else self.lang.title_info, self.lang.description_need_accessibility) system_api.open_preference('Security', wait=True, new=True) elif i == 1: self.message_box( self.lang.title_info, self.lang.description_cancel_accessibility) elif stat == 0: break