def on_buttonBox_accepted(self): self.buttonBox.setEnabled(False) start_year = int(self.co_start_year.currentText()) end_year = int(self.co_end_year.currentText()) increment = int(self.co_every_year.currentText()) years = range(start_year, end_year + 1, increment) # (visualization_type, dataset_name, vals) visualizations = get_batch_configuration(project = self.project, batch_name = self.batch_name) self.batch_processor.set_data( visualizations = visualizations, source_data_name = self.run_name, years = years) self.runThread = OpusGuiThread( parentThread = self.mainwindow, parentGuiElement = self, thread_object = self.batch_processor) # Use this signal from the thread if it is capable of producing its own status signal QObject.connect(self.runThread, SIGNAL("runFinished(PyQt_PyObject)"), self.runFinishedFromThread) QObject.connect(self.runThread, SIGNAL("runError(PyQt_PyObject)"), self.runErrorFromThread) self.runThread.start()
def generate_indicators(self): self.filepaths = {} for name, (projconfig, batchname, visname, datasourcename, year) in self.indicators.items(): op = OpusProject() op.open(os.path.join(PROJECTCONFIGBASE, projconfig)) bp = BatchProcessor(op) visualizationsconf = get_batch_configuration(project=op, batch_name=batchname, vis_name=visname) bp.set_data(visualizations=visualizationsconf, source_data_name=datasourcename, years=[year, year]) bp.run() visualizations = bp.get_visualizations() # visualizations in batch assert len(visualizations) == 1 vistype, visualizations = visualizations[0] # indicators in visualization assert len(visualizations) == 1 self.filepaths[name] = visualizations[0].get_file_path()
def runIndicatorBatch(self): visualizations = get_batch_configuration(project=self.project, batch_name=self.batch_name) start, end = self.get_years() self.batch_processor = BatchProcessor(project=self.project) self.batch_processor.errorCallback = self.errorCallback self.batch_processor.finishedCallback = self.indicatorBatchFinishedCallback self.batch_processor.set_data(visualizations=visualizations, source_data_name=self.get_run_name(), years=range(start, end + 1)) self.batch_processor.run()
def runIndicatorBatch(self): visualizations = get_batch_configuration( project = self.project, batch_name = self.batch_name) start, end = self.get_years() self.batch_processor = BatchProcessor(project = self.project) self.batch_processor.errorCallback = self.errorCallback self.batch_processor.finishedCallback = self.indicatorBatchFinishedCallback self.batch_processor.set_data( visualizations = visualizations, source_data_name = self.get_run_name(), years = range(start, end + 1)) self.batch_processor.run()
def run(xml_configuration, indicator_batch, run_name, cache_directory, years): from opus_gui.results_manager.run.batch_processor import BatchProcessor project = OpusProject() project.open(xml_configuration) bp = BatchProcessor(project) visualizations = get_batch_configuration(project = project, batch_name = indicator_batch) bp.set_data(visualizations=visualizations, source_data_name = run_name, cache_directory = cache_directory, years = eval(years), ) bp.errorCallback = lambda x: x ## bp.finishedCallback = lambda x: x ## hack to work around BatchProcessor bp.run()
def generate_indicators(self): self.filepaths = {} for name, (projconfig, batchname, visname, datasourcename, year) in self.indicators.items(): op = OpusProject() op.open(os.path.join(PROJECTCONFIGBASE, projconfig)) bp = BatchProcessor(op) visualizationsconf = get_batch_configuration(project = op, batch_name = batchname, vis_name = visname) bp.set_data(visualizations = visualizationsconf, source_data_name = datasourcename, years = [year,year]) bp.run() visualizations = bp.get_visualizations() # visualizations in batch assert len(visualizations) == 1 vistype, visualizations = visualizations[0] # indicators in visualization assert len(visualizations) == 1 self.filepaths[name] = visualizations[0].get_file_path()
try: import wingdbstub except: pass option_group = MakeIndicatorsOptionGroup() parser = option_group.parser (options, args) = parser.parse_args() if not (options.xml_configuration and options.indicator_batch and ( options.cache_directory or options.run_name) and options.years ): parser.print_help() sys.exit(0) from opus_gui.results_manager.run.batch_processor import BatchProcessor project = OpusProject() project.open(options.xml_configuration) bp = BatchProcessor(project) visualizations = get_batch_configuration(project = project, batch_name = options.indicator_batch) bp.set_data(visualizations=visualizations, source_data_name = options.run_name, cache_directory = options.cache_directory, years = eval(options.years), ) bp.errorCallback = lambda x: x ## bp.finishedCallback = lambda x: x ## hack to work around BatchProcessor bp.run()