306
306
field.write(name)
307
307
self.pointing_device.click_object(ok)
310
:returns: Whether or not hotspot can be used.
312
@autopilot.logging.log_action(logger.debug)
313
def have_hotspot(self):
314
return self.wait_select_single(objectName='hotspotEntry').visible
317
:param: Configuration with keys ssid and password.
318
:returns: Hotspot page.
320
@autopilot.logging.log_action(logger.debug)
321
def setup_hotspot(self, config=None):
322
hotspot_page = self._enter_hotspot()
323
hotspot_page.setup_hotspot(config)
328
:returns: Hotspot page.
330
@autopilot.logging.log_action(logger.debug)
331
def enable_hotspot(self):
332
hotspot_page = self._enter_hotspot()
333
hotspot_page.enable_hotspot()
338
:returns: Hotspot page.
340
@autopilot.logging.log_action(logger.debug)
341
def disable_hotspot(self):
342
hotspot_page = self._enter_hotspot()
343
hotspot_page.disable_hotspot()
346
@autopilot.logging.log_action(logger.debug)
347
def _enter_hotspot(self):
348
obj = self.wait_select_single(objectName="hotspotEntry")
349
self.pointing_device.click_object(obj)
350
return self.get_root_instance().wait_select_single(
351
objectName='hotspotPage')
354
class Hotspot(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
356
"""Autopilot helper for Hotspot page."""
359
def validate_dbus_object(cls, path, state):
360
name = introspection.get_classname_from_path(path)
361
if name == b'ItemPage':
362
if state['objectName'][1] == 'hotspotPage':
368
return self.wait_select_single(
369
ubuntuuitoolkit.CheckBox,
370
objectName='hotspotSwitch')
372
@autopilot.logging.log_action(logger.debug)
373
def enable_hotspot(self):
376
@autopilot.logging.log_action(logger.debug)
377
def disable_hotspot(self):
378
self._switch.uncheck()
380
@autopilot.logging.log_action(logger.debug)
381
def setup_hotspot(self, config):
382
obj = self.select_single(objectName='hotspotSetupEntry')
383
self.pointing_device.click_object(obj)
384
setup = self.get_root_instance().wait_select_single(
385
objectName='hotspotSetup')
388
setup.set_ssid(config['ssid'])
389
if 'password' in config:
390
setup.set_password(config['password'])
393
setup.wait_until_destroyed()
395
@autopilot.logging.log_action(logger.debug)
396
def get_hotspot_status(self):
397
return self._switch.checked
400
class HotspotSetup(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
402
"""Autopilot helper for Hotspot setup."""
405
def validate_dbus_object(cls, path, state):
406
name = introspection.get_classname_from_path(path)
407
if name == b'Dialog':
408
if state['objectName'][1] == 'hotspotSetup':
413
def _ssid_field(self):
414
return self.wait_select_single(
415
ubuntuuitoolkit.TextField,
416
objectName='ssidField')
419
def _password_field(self):
420
return self.wait_select_single(
421
ubuntuuitoolkit.TextField,
422
objectName='passwordField')
425
def _enable_button(self):
426
return self.wait_select_single(
427
'Button', objectName='confirmButton')
429
@autopilot.logging.log_action(logger.debug)
430
def set_ssid(self, ssid):
431
self._ssid_field.write(ssid)
433
@autopilot.logging.log_action(logger.debug)
434
def set_password(self, password):
435
self._password_field.write(password)
437
@autopilot.logging.log_action(logger.debug)
439
self.pointing_device.click_object(self._enable_button)
310
442
class BluetoothPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):