class Chooser: """ Class to choose :param device_type: the type of device like 'Camera' or 'Filterwheel' :type device_type: str """ def __init__(self, device_type='Camera'): self.c = CreateObject("ASCOM.Utilities.Chooser") self.c.DeviceType = device_type def choose(self): """ Open a dialog to select the driver """ name = self.c.Choose('') return name def telescope(self): self.c.DeviceType = 'Telescope' return CreateObject(self.choose())
def show_chooser(self, last_choice): chooser = CreateObject("ASCOM.Utilities.Chooser") chooser.DeviceType = "Camera" camera = chooser.Choose(last_choice) logging.debug(f'choice = {camera}') return camera