Ejemplo n.º 1
0
def backend_setup_ui(current_backend):
    new_backend = None
    possible_backends = get_backend_choices()

    if len(possible_backends) < 1:
        QtWidgets.QMessageBox.critical(None, 'Error', 'No backends available!',
                                       QtWidgets.QMessageBox.Ok)
        return

    if current_backend in possible_backends:
        selection = possible_backends.index(current_backend)
    else:
        selection = 0

    choice, ok = QtWidgets.QInputDialog.getItem(None, 'Choose Backend',
                                                'Backend', possible_backends,
                                                selection)
    if ok:
        new_backend = choice

    return new_backend
Ejemplo n.º 2
0
                        format=FORMAT,
                        datefmt='%Y-%m-%d %H:%M:%S')

    # add to screen as well
    LOG = logging.getLogger()
    formatter = logging.Formatter(FORMAT)
    CH = logging.StreamHandler()
    CH.setLevel(logging.INFO)
    CH.setFormatter(formatter)
    LOG.addHandler(CH)

    logging.info(f'pyastrobackend_simpledevice_ccd_tests starting')

    parser = argparse.ArgumentParser()
    parser.add_argument('backend',
                        choices=get_backend_choices(),
                        help="Backend to use")
    parser.add_argument('driver', type=str, help="Driver name to use")
    parser.add_argument('--debug',
                        action='store_true',
                        help="Enable debug output")

    args = parser.parse_args()
    logging.info(f'command args = {args}')

    if args.driver is None:
        logging.error('Must supply name of driver to use!')
        sys.exit(1)

    if args.debug:
        CH.setLevel(logging.DEBUG)