示例#1
0
 def register_application_components(self, args, app: Application):
     display = TextDisplay()
     main_window_config = MainWindow.configurator().config_from_args(args)
     layout = MyKeyboardHandler.configurator().layout_from_args(args)
     keyboard = MyKeyboardHandler(layout)
     main = MainWindow([display], keyboard_handler=keyboard, config=main_window_config)
     app.register(main)
示例#2
0
 def __call__(self, args, app: Application = None):
     app.start()
     while app.is_alive():
         try:
             time.sleep(0.1)
         except KeyboardInterrupt:
             break
     app.stop()
示例#3
0
 def register_application_components(self, args, app: Application):
     displays = [
         OpenCvDebugDisplay(),
     ]
     main_window = MainWindow(
         displays, config=MainWindow.configurator().config_from_args(args))
     video_source = VideoSource(
         config=VideoSource.configurator().config_from_args(args))
     app.register(main_window, video_source)
示例#4
0
 def register_application_components(self, args, app: Application):
     main_window_config = MainWindow.configurator().config_from_args(args)
     mouse_handler = EventBasedMouseHandler()
     displays = [
         OpenCvDebugDisplay(),
     ]
     main_window = MainWindow(displays,
                              config=main_window_config,
                              mouse_handler=mouse_handler)
     app.register(main_window)
 def register_application_components(self, args, app: Application):
     source = VideoSource(VideoSource.configurator().config_from_args(args))
     displays = [
         OpenCvDisplay('terminator'),
         OpenCvDebugDisplay(),
     ]
     face_detector = FaceDetector()
     terminator_filter = TerminatorFilter()
     main_window_config = MainWindowConfigurator.config_from_args(args)
     main_window = MainWindow(displays, config=main_window_config)
     app.register(source, face_detector, terminator_filter, main_window)
示例#6
0
 def register_application_components(self, args, app: Application):
     displays = [
         OpenCvDisplay('drawn_people'),
         OpenCvDebugDisplay(),
     ]
     main_window = MainWindow(
         displays, config=MainWindow.configurator().config_from_args(args))
     video_source = VideoSource(
         config=VideoSource.configurator().config_from_args(args))
     person_detect_filter = PersonDetectFilter('source', 'drawn_people')
     app.register(main_window, video_source, person_detect_filter)
示例#7
0
 def register_application_components(self, args, app: Application):
     displays = [
         OpenCvDisplay('flipped'),
         OpenCvDebugDisplay(),
     ]
     main_window = MainWindow(
         displays, config=MainWindow.configurator().config_from_args(args))
     video_source = VideoSource(
         config=VideoSource.configurator().config_from_args(args))
     flip_filter = FlipFilter('source', 'flipped')
     app.register(main_window, video_source, flip_filter)
示例#8
0
 def register_application_components(self, args, app: Application):
     source = VideoSource(VideoSource.configurator().config_from_args(args))
     person_detector = PersonDetector()
     person_display = PersonDisplay()
     displays = [
         OpenCvDisplay('display'),
         OpenCvDebugDisplay(),
     ]
     mouse_handler = EventBasedMouseHandler()
     main_window_config = MainWindowConfigurator.config_from_args(args)
     main_window = MainWindow(displays,
                              mouse_handler=mouse_handler,
                              config=main_window_config)
     app.register(source, person_detector, person_display, main_window)
示例#9
0
    def main(self, args=None):
        """
        Launch the commandline interface.

        :param args: Optionally pass arguments. If not given, the arguments passed to the program will be parsed.
        """
        self._configure_parser()
        argcomplete.autocomplete(self.parser)
        args = self.parser.parse_args(args)
        logwood.basic_config(
            format='%(timestamp).6f %(level)-5s %(name)s: %(message)s',
            level=self._get_loglevel(args),
        )

        if not args.command:
            self.parser.print_usage()
            sys.exit(1)
        else:
            command = self._commands[args.command]
            if command.needs_app:
                app = Application()
                self.register_application_components(args, app)
                command.__call__(args, app)
            else:
                command.__call__(args)
示例#10
0
 def register_application_components(self, args, app: Application):
     source = VideoSource(VideoSource.configurator().config_from_args(args))
     displays = [OpenCvDisplay('flipped')]
     app.register(source)
     app.register(FlipFilter('source', 'flipped'))
     app.register(
         MainWindow(
             displays=displays,
             config=MainWindow.configurator().config_from_args(args)))
 def register_application_components(self, args, app: Application):
     source = VideoSource(VideoSource.configurator().config_from_args(args))
     sink = SimpleDisplaySink('source')
     app.register(source, sink)
示例#12
0
 def register_application_components(self, args, app: Application):
     source = VideoSource(VideoSource.configurator().config_from_args(args))
     app.register(source)
     app.register(FlipFilter('source', 'flipped'))
     app.register(SimpleDisplaySink('flipped'))
示例#13
0
def app(configure_logging) -> Application:
    return Application()
示例#14
0
 def register_application_components(self, args, app: Application):
     displays = [
         OpenCvDebugDisplay(),
     ]
     main_window = MainWindow(displays)
     app.register(main_window)