def __init__(self, downloader): QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.indicator_lbl = QLabel('Select Indicators') self.indicator_multiselect = MultiSelectComboBox(self) self.scroll_area_contents.layout().addWidget(self.indicator_lbl) self.scroll_area_contents.layout().addWidget( self.indicator_multiselect) self.country_lbl = QLabel('Select Countries') self.country_multiselect = MultiSelectComboBox(self) self.scroll_area_contents.layout().addWidget(self.country_lbl) self.scroll_area_contents.layout().addWidget(self.country_multiselect) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.set_ok_button() # login to platform, to be able to retrieve sv indices self.sv_downloader = downloader self.indicators_info_dict = {} with WaitCursorManager('Filling list of indicators...'): self.fill_names() with WaitCursorManager('Filling list of themes...'): self.fill_themes() with WaitCursorManager('Filling list of countries...'): self.fill_countries() self.indicator_multiselect.item_was_clicked.connect( self.update_indicator_info) self.indicator_multiselect.selection_changed.connect( self.set_ok_button) self.country_multiselect.selection_changed.connect(self.set_ok_button)
def __init__(self, iface): QDialog.__init__(self) self.iface = iface # Set up the user interface from Designer. self.setupUi(self) self.fields_lbl = QLabel( 'Fields containing loss-based damage state probabilities') self.fields_multiselect = MultiSelectComboBox(self) self.vLayout.insertWidget(2, self.fields_lbl) self.vLayout.insertWidget(3, self.fields_multiselect) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) approach_explanation = ( 'Aggregate: building-level recovery model as a single process\n' 'Disaggregate: Building-level recovery modelled using four' ' processes: inspection, assessment, mobilization and repair.') self.approach_cbx.addItems(['Disaggregate', 'Aggregate']) self.approach_cbx.setToolTip(approach_explanation) self.approach_lbl.setToolTip(approach_explanation) simulations_explanation = ( 'Number of damage realizations used in Monte Carlo Simulation') n_simulations = int( QSettings().value('irmt/n_simulations_per_building', 1)) self.n_simulations_sbx.setValue(n_simulations) self.n_simulations_lbl.setToolTip(simulations_explanation) self.n_simulations_sbx.setToolTip(simulations_explanation) self.save_bldg_curves_check.setChecked(False) self.populate_layers_in_combos() self.restore_state() self.set_ok_button()
def __init__(self, iface): QDialog.__init__(self) self.iface = iface self.attr_name_user_def = False self.use_advanced = False # Set up the user interface from Designer. self.setupUi(self) self.fields_lbl = QLabel('Fields to transform') self.fields_multiselect = MultiSelectComboBox(self) hlayout = QHBoxLayout() hlayout.addWidget(self.fields_lbl) hlayout.addWidget(self.fields_multiselect) self.vertical_layout.insertLayout(1, hlayout) self.adjustSize() self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.fill_fields_multiselect() alg_list = list(TRANSFORMATION_ALGS.keys()) self.algorithm_cbx.addItems(alg_list) if self.algorithm_cbx.currentText() in ['RANK', 'QUADRATIC']: self.reload_variant_cbx() self.inverse_ckb.setDisabled( self.algorithm_cbx.currentText() in ['LOG10']) self.warning_lbl.hide() self.warning_lbl.setText( "<font color='red'>" "WARNING: the original attribute will be overwritten by the" " results of the transformation (it can not be undone)" "</font>") self.fields_multiselect.selection_changed.connect(self.set_ok_button) self.fields_multiselect.selection_changed.connect( self.set_new_field_editable) self.fields_multiselect.selection_changed.connect( self.update_default_fieldname) self.set_ok_button() self.set_new_field_editable()
def populate_out_dep_widgets(self): self.visualize_gbx = QGroupBox('Visualize') self.visualize_gbx_h_layout = QHBoxLayout() self.exposure_rbn = QRadioButton('Exposure') self.risk_rbn = QRadioButton('Risk') self.exposure_rbn.toggled.connect(self.on_visualize_changed) self.risk_rbn.toggled.connect(self.on_visualize_changed) self.visualize_gbx_h_layout.addWidget(self.exposure_rbn) self.visualize_gbx_h_layout.addWidget(self.risk_rbn) self.visualize_gbx.setLayout(self.visualize_gbx_h_layout) self.vlayout.addWidget(self.visualize_gbx) self.create_selector("peril", "Peril", filter_ckb=False, on_text_changed=self.on_peril_changed) self.peril_cbx.setDisabled(True) self.peril_lbl.setVisible(False) self.peril_cbx.setVisible(False) self.create_selector("category", "Category", filter_ckb=False) self.peril_cbx.addItems(sorted(self.perils)) self.taxonomies_gbx = QGroupBox() self.taxonomies_gbx.setTitle('Filter by taxonomy') self.taxonomies_gbx.setCheckable(True) self.taxonomies_gbx.setChecked(False) self.taxonomies_gbx_v_layout = QVBoxLayout() self.taxonomies_gbx.setLayout(self.taxonomies_gbx_v_layout) self.taxonomies_lbl = QLabel("Taxonomies") self.taxonomies_multisel = MultiSelectComboBox(self) self.taxonomies_multisel.add_unselected_items( sorted([ taxonomy for taxonomy in self.exposure_metadata['taxonomy'] if taxonomy != '?' ])) self.taxonomies_gbx_v_layout.addWidget(self.taxonomies_lbl) self.taxonomies_gbx_v_layout.addWidget(self.taxonomies_multisel) self.taxonomies_gbx.toggled[bool].connect( self.on_taxonomies_gbx_toggled) self.vlayout.addWidget(self.taxonomies_gbx) self.tag_gbx = QGroupBox() self.tag_gbx.setTitle('Filter by tag') self.tag_gbx.setCheckable(True) self.tag_gbx.setChecked(False) self.tag_gbx_v_layout = QVBoxLayout() self.tag_gbx.setLayout(self.tag_gbx_v_layout) self.tag_values_lbl = QLabel("Tag values") self.tag_values_multisel = MultiSelectComboBox(self) self.create_selector("tag", "Tag", add_to_layout=self.tag_gbx_v_layout, on_text_changed=self.on_tag_changed) self.tag_cbx.addItems([ tag_name for tag_name in self.tag_names if tag_name != 'taxonomy' ]) self.tag_gbx_v_layout.addWidget(self.tag_values_lbl) self.tag_gbx_v_layout.addWidget(self.tag_values_multisel) self.tag_gbx.toggled[bool].connect(self.on_tag_gbx_toggled) self.vlayout.addWidget(self.tag_gbx) self.higher_on_top_chk = QCheckBox('Render higher values on top') self.higher_on_top_chk.setChecked(True) self.vlayout.addWidget(self.higher_on_top_chk) self.create_zonal_layer_selector() if self.zonal_layer_path: zonal_layer = self.load_zonal_layer(self.zonal_layer_path) self.populate_zonal_layer_cbx(zonal_layer) else: self.pre_populate_zonal_layer_cbx() self.exposure_rbn.setChecked(True)
def setUpClass(cls): cls.wdg = QWidget() cls.mscb = MultiSelectComboBox(cls.wdg)