示例#1
0
    def setUp(self):
        events.unsub_all()

        parser = AstromParser()
        directory_manager = LocalDirectoryWorkingContext(
            self._get_working_dir())
        self.context = directory_manager
        progress_manager = LocalProgressManager(directory_manager)
        workunit_provider = WorkUnitProvider(
            tasks.get_suffix(self._get_task()), directory_manager,
            progress_manager,
            self._get_workunit_builder(parser, progress_manager))

        self.workunit_provider = workunit_provider
        self.progress_manager = progress_manager

        self.singlet_download_manager = Mock(spec=AsynchronousDownloadManager)
        self.triplet_download_manager = Mock(spec=AsynchronousDownloadManager)
        self.image_manager = ImageManager(self.singlet_download_manager,
                                          self.triplet_download_manager)

        self.model = ValidationModel(self.workunit_provider,
                                     self.image_manager, None)

        self.custom_setup()

        self.model.start_work()
示例#2
0
文件: app.py 项目: stephengwyn/MOP
    def _create_image_manager(self):
        error_handler = DownloadErrorHandler(self)

        def read(slice_config):
            return config.read("CUTOUTS.%s" % slice_config)

        singlet_downloader = ImageCutoutDownloader(
            slice_rows=read("SINGLETS.SLICE_ROWS"),
            slice_cols=read("SINGLETS.SLICE_COLS"))

        singlet_download_manager = AsynchronousDownloadManager(
            singlet_downloader, error_handler)

        triplet_downloader = ImageCutoutDownloader(
            slice_rows=read("TRIPLETS.SLICE_ROWS"),
            slice_cols=read("TRIPLETS.SLICE_COLS"))

        triplet_download_manager = AsynchronousDownloadManager(
            triplet_downloader, error_handler)

        return ImageManager(singlet_download_manager, triplet_download_manager)