def __init__(self, project, parent_widget = None):
        QDialog.__init__(self, parent_widget)

        self.setModal(True)
        self.setupUi(self)
        # self.resultManagerBase = resultManagerBase

        self.project = project
        self.mapnik_options = {}

#        self.model = resultManagerBase.toolboxBase.resultsManagerTree.model
#        self.xml_helper = ResultsManagerXMLHelper(self.resultManagerBase.toolboxBase)
        self.leVizName.setText(QString('New visualization'))
        self.dataset_name = None
#        self.twAvailableIndicators.verticalHeader().hide()
#        self.twIndicatorsToVisualize.verticalHeader().hide()
#
#        self.twAvailableIndicators.horizontalHeader().setResizeMode(QHeaderView.Stretch)
#        self.twIndicatorsToVisualize.horizontalHeader().setResizeMode(QHeaderView.Stretch)

        self.lblOption1.hide()
        self.leOption1.hide()
        self.pbn_set_storage_location.hide()
        #self.setToolTip(QString('In this visualization, a table of values \nwill be output for every simulation year. \nThe table consists of the ID columns \nof the specified dataset and \nthe values for each of the indicators \nspecified in this form.'))
        self.spatial_datasets = get_available_spatial_dataset_names(project = project)
Ejemplo n.º 2
0
    def __init__(self, project, parent_widget=None):
        QDialog.__init__(self, parent_widget)

        self.setModal(True)
        self.setupUi(self)
        # self.resultManagerBase = resultManagerBase

        self.project = project
        self.mapnik_options = {}

        #        self.model = resultManagerBase.toolboxBase.resultsManagerTree.model
        #        self.xml_helper = ResultsManagerXMLHelper(self.resultManagerBase.toolboxBase)
        self.leVizName.setText(QString('New visualization'))
        self.dataset_name = None
        #        self.twAvailableIndicators.verticalHeader().hide()
        #        self.twIndicatorsToVisualize.verticalHeader().hide()
        #
        #        self.twAvailableIndicators.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        #        self.twIndicatorsToVisualize.horizontalHeader().setResizeMode(QHeaderView.Stretch)

        self.lblOption1.hide()
        self.leOption1.hide()
        self.pbn_set_storage_location.hide()
        #self.setToolTip(QString('In this visualization, a table of values \nwill be output for every simulation year. \nThe table consists of the ID columns \nof the specified dataset and \nthe values for each of the indicators \nspecified in this form.'))
        self.spatial_datasets = get_available_spatial_dataset_names(
            project=project)
Ejemplo n.º 3
0
    def __init__(self, mainwindow, runManager, model, xml_config):

        QWidget.__init__(self, mainwindow)

        self.mainwindow = mainwindow
        self.setupUi(self)

        self.runManager = runManager
        self.project = runManager.project
        self.model = model
        self.model.guiElement = self
        self.inGui = False
        self.logFileKey = 0
        self.running = False
        self.paused = False
        self.timer = None
        self.runThread = None
        self.config = None
        self.xml_config = xml_config

        self.config = xml_config.get_run_configuration(
            str(self.model.modeltorun))

        insert_auto_generated_cache_directory_if_needed(self.config)
        (self.start_year, self.end_year) = self.config['years']

        self.tabIcon = QIcon(":/Images/Images/cog.png")
        self.tabLabel = model.modeltorun

        self.setup_run_name_line_edit()
        self.setup_indicator_batch_combobox()

        # Simulation Progress Tab

        self.runProgressBarTotal.setProperty("value", QVariant(0))
        self.runProgressBarTotal.reset()

        ### Year Progress Bar
        self.runProgressBarYear.setProperty("value", QVariant(0))
        self.runProgressBarYear.reset()

        ### Model Progress Bar

        self.runProgressBarModel.setProperty("value", QVariant(0))
        self.runProgressBarModel.reset()

        self.setupDiagnosticIndicatorTab()

        self.gb_model_progress.hide()

        self.spatial_datasets = get_available_spatial_dataset_names(
            project=self.project)
        self.diagnostic_go_button.setEnabled(False)
    def __init__(self, mainwindow, runManager, model, xml_config):

        QWidget.__init__(self, mainwindow)

        self.mainwindow = mainwindow
        self.setupUi(self)

        self.runManager = runManager
        self.project = runManager.project
        self.model = model
        self.model.guiElement = self
        self.inGui = False
        self.logFileKey = 0
        self.running = False
        self.paused = False
        self.timer = None
        self.runThread = None
        self.config = None
        self.xml_config = xml_config

        self.config = xml_config.get_run_configuration(str(self.model.modeltorun))

        insert_auto_generated_cache_directory_if_needed(self.config)
        (self.start_year, self.end_year) = self.config['years']

        self.tabIcon = QIcon(":/Images/Images/cog.png")
        self.tabLabel = model.modeltorun

        self.setup_run_name_line_edit()
        self.setup_indicator_batch_combobox()

        # Simulation Progress Tab

        self.runProgressBarTotal.setProperty("value",QVariant(0))
        self.runProgressBarTotal.reset()

        ### Year Progress Bar
        self.runProgressBarYear.setProperty("value",QVariant(0))
        self.runProgressBarYear.reset()

        ### Model Progress Bar

        self.runProgressBarModel.setProperty("value",QVariant(0))
        self.runProgressBarModel.reset()

        self.setupDiagnosticIndicatorTab()

        self.gb_model_progress.hide()

        self.spatial_datasets = get_available_spatial_dataset_names(project = self.project)
        self.diagnostic_go_button.setEnabled(False)
    def __init__(self, project, indicator_type, indicators, kwargs=None):
        self.finishedCallback = None
        self.errorCallback = None
        self.guiElement = None
        self.config = None
        self.firstRead = True
        self.project = project
        self.indicator_type = indicator_type
        self.indicators = indicators
        self.visualizations = []

        self.spatial_datasets = get_available_spatial_dataset_names(
            project=self.project)

        if kwargs == None: kwargs = {}
        self.kwargs = kwargs
    def __init__(self,
                 project,
                 indicator_type,
                 indicators,
                 kwargs = None):
        self.finishedCallback = None
        self.errorCallback = None
        self.guiElement = None
        self.config = None
        self.firstRead = True
        self.project = project
        self.indicator_type = indicator_type
        self.indicators = indicators
        self.visualizations = []
        
        self.spatial_datasets = get_available_spatial_dataset_names(project = self.project)

        if kwargs == None: kwargs = {}
        self.kwargs = kwargs
Ejemplo n.º 7
0
    def __init__(self,
                 project,
                 batch_indicator_visualization_node,
                 parent_widget=None):
        AbstractConfigureBatchIndicatorVisualization.__init__(
            self, project, parent_widget)

        self.base_node = base_node = batch_indicator_visualization_node
        self.spatial_datasets = get_available_spatial_dataset_names(
            project=project)

        viz_name = base_node.get('name')
        viz_spec = self._get_viz_spec_from_xml_node(base_node)

        self.leVizName.setText(viz_name)

        prev_dataset = str(viz_spec['dataset_name'])
        indicator_list = viz_spec['indicators']
        prev_indicators = self._process_xml_stored_list_of_strings(
            value=indicator_list)
        prev_output_type = viz_spec['output_type']
        viz_type = viz_spec['visualization_type']

        # don't really know what's going on here...
        if viz_type in ['table_per_year', 'table_per_attribute']:
            viz_type = 'Table'
        elif viz_type not in ['Map']:
            viz_type = self._get_inverse_type_mapper()[viz_type]
        prev_viz_type = QString(viz_type)

        self._setup_co_dataset_name(value=prev_dataset)
        self._setup_indicators(existing_indicators=prev_indicators)
        self._setup_co_viz_type(value=prev_viz_type)

        inv_map = dict([
            (v, k) for k, v in self._get_output_types(prev_viz_type).items()
        ])
        self._setup_co_output_type(value=inv_map[str(prev_output_type)])

        fixed_field_specification = None
        if prev_output_type == 'fixed_field':
            fixed_field_specification = viz_spec['fixed_field_specification']
            id_format = viz_spec['id_format'] or ''
            specs = self._process_xml_stored_list_of_strings(
                value=fixed_field_specification)
            self._set_column(column=1, values=specs)
            self.leOption1.setText(QString(id_format))
        elif prev_output_type == 'esri':
            storage_location = viz_spec['storage_location'] or ''
            self.leOption1.setText(QString(storage_location))
        elif prev_output_type == 'sql':
            database_name = viz_spec['database_name'] or ''
            self.leOption1.setText(QString(database_name))
        elif prev_output_type == 'tab':
            try:
                prev_output_style = int(str(viz_spec['output_style'] or ''))
            except:
                pass
            else:
                if prev_output_style == Table.ALL:
                    self.rbSingleTable.setChecked(True)
                elif prev_output_style == Table.PER_ATTRIBUTE:
                    self.rbTablePerIndicator.setChecked(True)
                else:
                    self.rbTablePerYear.setChecked(True)
        elif prev_output_type == 'mapnik_map' or prev_output_type == 'mapnik_animated_map':
            self.mapnik_options['mapnik_bucket_ranges'] = viz_spec[
                'mapnik_bucket_ranges']
            self.mapnik_options['mapnik_bucket_colors'] = viz_spec[
                'mapnik_bucket_colors']
            self.mapnik_options['mapnik_bucket_labels'] = viz_spec[
                'mapnik_bucket_labels']
            self.mapnik_options['mapnik_resolution'] = viz_spec[
                'mapnik_resolution']
            self.mapnik_options['mapnik_page_dims'] = viz_spec[
                'mapnik_page_dims']
            self.mapnik_options['mapnik_map_lower_left'] = viz_spec[
                'mapnik_map_lower_left']
            self.mapnik_options['mapnik_map_upper_right'] = viz_spec[
                'mapnik_map_upper_right']
            self.mapnik_options['mapnik_legend_lower_left'] = viz_spec[
                'mapnik_legend_lower_left']
            self.mapnik_options['mapnik_legend_upper_right'] = viz_spec[
                'mapnik_legend_upper_right']
    def __init__(self, project, batch_indicator_visualization_node, parent_widget = None):
        AbstractConfigureBatchIndicatorVisualization.__init__(self, project, parent_widget)

        self.base_node = base_node = batch_indicator_visualization_node
        self.spatial_datasets = get_available_spatial_dataset_names(project = project)

        viz_name = base_node.get('name')
        viz_spec = self._get_viz_spec_from_xml_node(base_node)

        self.leVizName.setText(viz_name)

        prev_dataset = str(viz_spec['dataset_name'])
        indicator_list = viz_spec['indicators']
        prev_indicators = self._process_xml_stored_list_of_strings(value = indicator_list)
        prev_output_type = viz_spec['output_type']
        viz_type = viz_spec['visualization_type']

        # don't really know what's going on here...
        if viz_type in ['table_per_year', 'table_per_attribute']:
            viz_type = 'Table'
        elif viz_type not in ['Map']:
            viz_type = self._get_inverse_type_mapper()[viz_type]
        prev_viz_type = QString(viz_type)

        self._setup_co_dataset_name(value = prev_dataset)
        self._setup_indicators(existing_indicators = prev_indicators)
        self._setup_co_viz_type(value = prev_viz_type)

        inv_map = dict([(v,k) for k,v in self._get_output_types(prev_viz_type).items()])
        self._setup_co_output_type(value = inv_map[str(prev_output_type)])

        fixed_field_specification = None
        if prev_output_type == 'fixed_field':
            fixed_field_specification = viz_spec['fixed_field_specification']
            id_format = viz_spec['id_format'] or ''
            specs = self._process_xml_stored_list_of_strings(value = fixed_field_specification)
            self._set_column(column = 1, values = specs)
            self.leOption1.setText(QString(id_format))
        elif prev_output_type == 'esri':
            storage_location = viz_spec['storage_location'] or ''
            self.leOption1.setText(QString(storage_location))
        elif prev_output_type == 'sql':
            database_name = viz_spec['database_name'] or ''
            self.leOption1.setText(QString(database_name))
        elif prev_output_type == 'tab':
            try:
                prev_output_style = int(str(viz_spec['output_style'] or ''))
            except: pass
            else:
                if prev_output_style == Table.ALL:
                    self.rbSingleTable.setChecked(True)
                elif prev_output_style == Table.PER_ATTRIBUTE:
                    self.rbTablePerIndicator.setChecked(True)
                else:
                    self.rbTablePerYear.setChecked(True)
        elif prev_output_type == 'mapnik_map' or prev_output_type == 'mapnik_animated_map':
            self.mapnik_options['mapnik_bucket_ranges'] = viz_spec['mapnik_bucket_ranges']
            self.mapnik_options['mapnik_bucket_colors'] = viz_spec['mapnik_bucket_colors']
            self.mapnik_options['mapnik_bucket_labels'] = viz_spec['mapnik_bucket_labels']
            self.mapnik_options['mapnik_resolution'] = viz_spec['mapnik_resolution']
            self.mapnik_options['mapnik_page_dims'] = viz_spec['mapnik_page_dims']
            self.mapnik_options['mapnik_map_lower_left'] = viz_spec['mapnik_map_lower_left']
            self.mapnik_options['mapnik_map_upper_right'] = viz_spec['mapnik_map_upper_right']
            self.mapnik_options['mapnik_legend_lower_left'] = viz_spec['mapnik_legend_lower_left']
            self.mapnik_options['mapnik_legend_upper_right'] = viz_spec['mapnik_legend_upper_right']