487def main(argv: typing.Sequence[str]) -> int:
488 app = QtWidgets.QApplication(argv)
489 app.setApplicationName("Microscope GUI")
490 app.setOrganizationDomain("python-microscope.org")
491
492 type_to_widget = {
493 "Camera": CameraWidget,
494 "Controller": ControllerWidget,
495 "DeformableMirror": DeformableMirrorWidget,
496 "DeviceSettings": DeviceSettingsWidget,
497 "FilterWheel": FilterWheelWidget,
498 "LightSourceWidget": LightSourceWidget,
499 "Stage": StageWidget,
500 }
501
502 parser = argparse.ArgumentParser(prog="microscope-gui")
503
504
505
506
507
508
509
510
511 parser.add_argument(
512 "type",
513 action="store",
514 type=str,
515 metavar="DEVICE-TYPE",
516 choices=type_to_widget.keys(),
517 help="Type of device/widget to show",
518 )
519
520 parser.add_argument(
521 "uri",
522 action="store",
523 type=str,
524 metavar="DEVICE-URI",
525 help="URI for device",
526 )
527 args = parser.parse_args(app.arguments()[1:])
528
529 device = Pyro4.Proxy(args.uri)
530 widget_cls = type_to_widget[args.type]
531 widget = widget_cls(device)
532 window = MainWindow(widget)
533 window.show()
534
535 return app.exec_()
536
537