def __init__(self, iface, viewer_dock): self.iface = iface self.viewer_dock = viewer_dock # needed to change the output_type QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.params_dlg = None self.console_dlg = None self.full_report_dlg = None # keep track of the log lines acquired for each calculation self.calc_log_line = {} self.session = None self.hostname = None self.current_calc_id = None # list of outputs refers to this calc_id self.pointed_calc_id = None # we will scroll to it self.is_logged_in = False self.timer = None # Keep retrieving the list of calculations (especially important to # update the status of the calculation) # NOTE: start_polling() is called from outside, in order to reset # the timer whenever the button to open the dialog is pressed self.finished.connect(self.stop_polling) self.message_bar = QgsMessageBar(self) self.layout().insertWidget(0, self.message_bar) self.engine_version = None self.attempt_login()
def __init__(self, downloader): QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.indicator_multiselect = ListMultiSelectWidget( title='Select Indicators') self.vertical_layout.insertWidget(4, self.indicator_multiselect) self.country_multiselect = ListMultiSelectWidget( title='Select Countries') self.vertical_layout.insertWidget(7, 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(): self.fill_themes() self.fill_countries() self.indicator_multiselect.unselected_widget.itemClicked.connect( self.update_indicator_info) self.indicator_multiselect.selected_widget.itemClicked.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, layer): QDialog.__init__(self) # set up the user interface self.ui = FORM_CLASS() self.ui.setupUi(self) self.setWindowTitle(u"%s - %s" % (self.tr("Layer Properties"), layer.name())) self.layer = layer # signals self.ui.horizontalSlider_Transparency.valueChanged.connect(self.ui.spinBox_Transparency.setValue) self.ui.spinBox_Transparency.valueChanged.connect(self.ui.horizontalSlider_Transparency.setValue) self.ui.horizontalSlider_Brightness.valueChanged.connect(self.ui.spinBox_Brightness.setValue) self.ui.spinBox_Brightness.valueChanged.connect(self.ui.horizontalSlider_Brightness.setValue) self.ui.horizontalSlider_Contrast.valueChanged.connect(lambda x: self.ui.doubleSpinBox_Contrast.setValue(x/100.0)) self.ui.doubleSpinBox_Contrast.valueChanged.connect(lambda x: self.ui.horizontalSlider_Contrast.setValue(x*100)) self.ui.buttonBox.button(QDialogButtonBox.Apply).clicked.connect(self.applyClicked.emit) # set init values self.initBlendingCombo() self.ui.textEdit_Properties.setText(layer.metadata()) self.ui.spinBox_Transparency.setValue(layer.transparency) self.ui.spinBox_Brightness.setValue(layer.brigthness) self.ui.doubleSpinBox_Contrast.setValue(layer.contrast) i = self.ui.comboBox_BlendingMode.findText(layer.blendModeName) if i != -1: self.ui.comboBox_BlendingMode.setCurrentIndex(i) self.ui.checkBox_SmoothRender.setChecked(layer.smoothRender) self.ui.checkBox_CreditVisibility.setChecked(layer.creditVisibility) self.ui.checkBox_Grayscale.setChecked(layer.grayscaleRender)
def __init__(self): QDialog.__init__(self) # Set up the user interface from Designer. ui_path = os.path.join(os.path.dirname(__file__), 'Ui_QuickWKT.ui') uic.loadUi(ui_path, self) self.exampleComboBox.addItems(list(EXAMPLES.keys())) self.exampleComboBox.currentIndexChanged.connect(self.on_exampleComboBox_currentIndexChanged)
def __init__(self, iface, viewer_dock, session, hostname, calc_id, output_type=None, path=None, mode=None, zonal_layer_path=None, engine_version=None): # sanity check if output_type not in OQ_TO_LAYER_TYPES: raise NotImplementedError(output_type) self.iface = iface self.viewer_dock = viewer_dock self.path = path self.session = session self.hostname = hostname self.calc_id = calc_id self.output_type = output_type self.mode = mode # if 'testing' it will avoid some user interaction self.zonal_layer_path = zonal_layer_path self.engine_version = engine_version QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) # Disable ok_button until all user options are set self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.ok_button.setDisabled(True)
def __init__(self, iface): QDialog.__init__(self) self.setupUi(self) self.iface = iface self.workThread = None self.btnOk = self.buttonBox.button(QDialogButtonBox.Ok) self.btnOk.setEnabled(False) self.btnClose = self.buttonBox.button(QDialogButtonBox.Close) # FIXME: this is needed if you can't compile the UI # self.project_name_lbl = QLabel('Project name') # self.project_name_le = QLineEdit() # self.checkBoxZip = QCheckBox('Consolidate in a Zip file') # self.layout().addWidget(self.project_name_lbl) # self.layout().addWidget(self.project_name_le) # self.layout().addWidget(self.checkBoxZip) self.project_name_le.editingFinished.connect( self.on_project_name_editing_finished) self.leOutputDir.textChanged.connect(self.set_ok_button) project_name = self.get_project_name() if project_name: self.project_name_le.setText(project_name) self.btnBrowse.clicked.connect(self.setOutDirectory)
def __init__(self, iface): QDialog.__init__(self) self.iface = iface # Set up the user interface from Designer. self.setupUi(self) title = ( 'Select fields containing loss-based damage state probabilities') self.fields_multiselect = ListMultiSelectWidget(title=title) self.vLayout.insertWidget(2, 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, filepath): QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) with open(filepath, 'rb') as rst_file: text = rst_file.read() self.text_browser.setText(text)
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_multiselect = ListMultiSelectWidget( title='Select fields to transform') self.vertical_layout.insertWidget(1, self.fields_multiselect) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.fill_fields_multiselect() alg_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 __init__(self): QDialog.__init__(self) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self)
def __init__(self): QDialog.__init__(self) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self)
def __init__(self, iface, project_definition): self.iface = iface QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.added_attrs_ids = set() self.discarded_feats = set() self.any_changes_made = False # keep track of changes made to the tree while on-the-fly calculations # are off (the tree has changed, but indices haven't been recalculated) self.modified_project_definition = None self.active_layer_numeric_fields = [] self.active_layer_numeric_fields_aliases = [] self.update_active_layer_numeric_fields() # keep track of the fact that the user has explicitly selected a field # to base the style on. Note that also the selection of the empty item # means that the user explicitly wants the system to use the default # behavior. self.style_by_field_selected = False self.project_definition = deepcopy(project_definition) try: proj_title = self.project_definition['title'] except KeyError: proj_title = 'Untitled' dialog_title = ( 'Set weights and operators for project: "%s"' % proj_title) self.setWindowTitle(dialog_title) self.web_view = self.web_view self.web_view.page().mainFrame().setScrollBarPolicy( Qt.Vertical, Qt.ScrollBarAlwaysOff) self.web_view.page().mainFrame().setScrollBarPolicy( Qt.Horizontal, Qt.ScrollBarAlwaysOff) self.web_view.load(QUrl('qrc:/plugins/irmt/weight_data.html')) self.printer = QPrinter(QPrinter.HighResolution) self.printer.setPageSize(QPrinter.A4) self.printer.setOutputFormat(QPrinter.PdfFormat) self.printer.setPrintRange(QPrinter.AllPages) self.printer.setOrientation(QPrinter.Portrait) self.printer.setDocName(proj_title) self.printer.setCreator( 'GEM Integrated Risk Modelling Toolkit QGIS Plugin') self.frame = self.web_view.page().mainFrame() self.frame.javaScriptWindowObjectCleared.connect(self.setup_js) self.web_view.loadFinished.connect(self.show_tree) self.json_updated.connect(self.handle_json_updated) self.populate_style_by_field_cbx() self.web_view.setContextMenuPolicy(Qt.NoContextMenu)
def __init__(self, iface): self.iface = iface self.layer = self.iface.activeLayer() QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.restore_state(restore_defaults=False) self.set_ok_button()
def __init__(self, iface): self.iface = iface QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) # Disable ok_button until loss and zonal layers are selected self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.ok_button.setDisabled(True) self.loss_layer_is_vector = True self.populate_cbx()
def __init__(self, parent=None): """Constructor.""" self.parent = parent QDialog.__init__(self) self.setupUi(self) # Connect self.blur.signalAskCloseWindow.connect(self.signalAskCloseWindow.emit) self.statistics.signalAskCloseWindow.connect( self.signalAskCloseWindow.emit)
def add_authentication(self): """Slot for when the add auth button is clicked.""" if qgis_version() >= 21200: from qgis.gui import QgsAuthConfigSelect dlg = QDialog(self) dlg.setWindowTitle(self.tr("Select Authentication")) layout = QVBoxLayout(dlg) acs = QgsAuthConfigSelect(dlg) if self.line_edit_auth_id.text(): acs.setConfigId(self.line_edit_auth_id.text()) layout.addWidget(acs) button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, dlg) layout.addWidget(button_box) button_box.accepted.connect(dlg.accept) button_box.rejected.connect(dlg.close) dlg.setLayout(layout) dlg.setWindowModality(Qt.WindowModal) if dlg.exec_(): self.line_edit_auth_id.setText(acs.configId()) del dlg
def __init__(self, iface): self.iface = iface QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.cancel_button = self.buttonBox.button(QDialogButtonBox.Cancel) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.ok_button.setEnabled(False) self.suppl_info = {} self.selected_proj_def = None self.get_suppl_info() self.populate_proj_def_cbx()
def __init__(self, iface): QDialog.__init__(self) ui_path = os.path.join(os.path.dirname(__file__), 'BBoxPreviewWindow.ui') uic.loadUi(ui_path, self) self.canvas = iface.mapCanvas() self.destinationLayer.setCurrentIndex(0) self.destinationLayer.setFilters( qgis.core.QgsMapLayerProxyModel.PolygonLayer) self.showButton.clicked.connect(self.showBbox) self.formatManager = biz.FormatManager() for format in self.formatManager.formatClasses: self.formatsComboBox.addItem( self.formatManager.formatClasses[format].displayName(), format)
def add_authentication(self): """Slot for when the add auth button is clicked.""" if qgis_version() >= 21200: from qgis.gui import QgsAuthConfigSelect dlg = QDialog(self) dlg.setWindowTitle(self.tr("Select Authentication")) layout = QVBoxLayout(dlg) acs = QgsAuthConfigSelect(dlg) if self.line_edit_auth_id.text(): acs.setConfigId(self.line_edit_auth_id.text()) layout.addWidget(acs) button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, dlg) layout.addWidget(button_box) button_box.accepted.connect(dlg.accept) button_box.rejected.connect(dlg.close) dlg.setLayout(layout) dlg.setWindowModality(Qt.WindowModal) if dlg.exec_(): self.line_edit_auth_id.setText(acs.configId()) del dlg
def __init__(self, driver_dialog, calc_id): QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.driver_dialog = driver_dialog self.calc_id = calc_id # when re-opening the dialog for a calculation, display the log from # the beginning self.driver_dialog.calc_log_line[calc_id] = 0 self.timer = QTimer() QObject.connect( self.timer, SIGNAL('timeout()'), self.refresh_calc_log) self.timer.start(1000) # refresh time in milliseconds # show the log before the first iteration of the timer self.refresh_calc_log()
def __init__(self): QDialog.__init__(self) self.setupUi(self) self.btnHelp = self.buttonBox.button(QDialogButtonBox.Help) self.lblLogo.setPixmap(QPixmap(":/icons/qconsolidate.png")) cfg = ConfigParser.SafeConfigParser() cfg.read(os.path.join(os.path.dirname(__file__), "metadata.txt")) version = cfg.get("general", "version") self.lblVersion.setText(self.tr("Version: %s") % (version)) doc = QTextDocument() doc.setHtml(self.getAboutText()) self.textBrowser.setDocument(doc) self.textBrowser.setOpenExternalLinks(True) self.buttonBox.helpRequested.connect(self.openHelp)
def __init__(self, iface, suppl_info, file_stem): QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.ok_button.setEnabled(False) self.iface = iface self.vertices_count = None self.file_stem = file_stem self.xml_file = file_stem + '.xml' self.suppl_info = suppl_info self.selected_idx = self.suppl_info['selected_project_definition_idx'] self.project_definition = self.suppl_info['project_definitions'][ self.selected_idx] if 'title' in self.project_definition: self.title_le.setText(self.project_definition['title']) else: self.title_le.setText(DEFAULTS['ISO19115_TITLE']) if 'description' in self.project_definition: self.description_te.setPlainText(self.project_definition[ 'description']) # if no field is selected, we should not allow uploading self.zone_label_field_is_specified = False reload_attrib_cbx( self.zone_label_field_cbx, iface.activeLayer(), True) self.set_zone_label_field() self.set_license() self.exists_on_platform = 'platform_layer_id' in self.suppl_info self.do_update = False self.update_radio.setEnabled(self.exists_on_platform) self.update_radio.setChecked(self.exists_on_platform) self.set_labels() with WaitCursorManager("Counting layer's vertices", iface.messageBar()): self.vertices_count = ProcessLayer( iface.activeLayer()).count_vertices()
def __init__(self, iface, downloader): QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.iface = iface # login to platform, to be able to retrieve sv indices self.sv_downloader = downloader self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.layer_lbl.setText('Project definition') self.layer_id = None # needed after ok is pressed self.downloaded_layer_id = None # the id of the layer created self.extra_infos = {} self.set_ok_button() with WaitCursorManager(): self.get_capabilities()
def __init__(self, parent=None): """Constructor.""" QDialog.__init__(self, parent) self.setupUi(self) # Connect slot. self.button_box.button(QDialogButtonBox.Ok).clicked.connect( self.draw_plot) self.button_box.button(QDialogButtonBox.Cancel).clicked.connect( self.hide) self.button_box.button(QDialogButtonBox.Cancel).clicked.connect( self.signalAskCloseWindow.emit) # Setup the graph. self.figure = Figure() self.ax = self.figure.add_subplot(1, 1, 1) self.canvas = FigureCanvas(self.figure) self.canvas.setMinimumSize(QSize(300, 0)) self.toolbar = CustomNavigationToolbar(self.canvas, self) self.layout_plot.addWidget(self.toolbar) self.layout_plot.addWidget(self.canvas)
def __init__(self, iface, data, data_path=""): QDialog.__init__(self) self.setupUi(self) self.settings = MySettings() self.data = data self.currentProjectId = None self.channelNameEdit.setFocus() self.cancel = False self.data_path_line_edit.setText(data_path) self.pdf_path_widget.setDefaultRoot(data_path) self.cannotImportLabel.hide() self.progressBar.setTextVisible(True) self.progressBar.hide() self.cancelButton.hide() self.pdf_path_widget.setDefaultRoot(data_path) self.relationWidgetWrapper = None maintenance_layer = QgsMapLayerRegistry.instance().mapLayer(self.settings.value("maintenance_layer")) if maintenance_layer is not None: field_idx = maintenance_layer.fieldNameIndex('fk_operating_company') widget_config = maintenance_layer.editorWidgetV2Config(field_idx) editor_context = QgsAttributeEditorContext() editor_context.setVectorLayerTools(iface.vectorLayerTools()) self.relationWidgetWrapper = QgsEditorWidgetRegistry.instance().create("ValueRelation", maintenance_layer, field_idx, widget_config, self.operatingCompanyComboBox, self, editor_context) self.sectionWidget.finish_init(iface, self.data) for p_id, project in self.data.items(): self.projectCombo.addItem(project['Name'], p_id) self.channelNameEdit.setText('')
def __init__(self, parent=None): """Constructor. Base class for Incidence and Density dialogs. use_area : If you use the area of the polygon or the population field. use_point_layer : If you a point a layer, or a field in the polygon layer. """ self.parent = parent QDialog.__init__(self, parent) self.name_field = None self.admin_layer = None self.figure = None self.canvas = None self.toolbar = None self.output_file_path = None self.output_layer = None # Settings self.use_area = None self.use_point_layer = None
def __init__(self, iface, irmt_main=None, parent=None): QDialog.__init__(self, parent) self.iface = iface self.parent = parent # in order to reset login when new credentials are saved self.irmt_main = irmt_main # Set up the user interface from Designer. self.setupUi(self) self.message_bar = QgsMessageBar(self) self.layout().insertWidget(0, self.message_bar) link_text = ('<a href="%s">Register to the OpenQuake Platform</a>' % PLATFORM_REGISTRATION_URL) self.registration_link_lbl.setText(link_text) self.style_color_from.setFocusPolicy(Qt.NoFocus) self.style_color_to.setFocusPolicy(Qt.NoFocus) modes = { QgsGraduatedSymbolRendererV2.EqualInterval: self.tr('Equal Interval'), QgsGraduatedSymbolRendererV2.Quantile: self.tr('Quantile (Equal Count)'), QgsGraduatedSymbolRendererV2.Jenks: self.tr('Natural Breaks (Jenks)'), QgsGraduatedSymbolRendererV2.StdDev: self.tr('Standard Deviation'), QgsGraduatedSymbolRendererV2.Pretty: self.tr('Pretty Breaks'), } for key in modes: self.style_mode.addItem(modes[key], key) for log_level in sorted(LOG_LEVELS): self.log_level_cbx.addItem(LOG_LEVELS[log_level], log_level) self.restore_state() self.initial_engine_hostname = QSettings().value( 'irmt/engine_hostname')
def __init__(self, platform_or_engine, profile_name='', parent=None): QDialog.__init__(self, parent) assert platform_or_engine in ('platform', 'engine'), platform_or_engine # Set up the user interface from Designer. self.setupUi(self) self.platform_or_engine = platform_or_engine self.initial_profile_name = profile_name if self.initial_profile_name: profiles = json.loads( QSettings().value( 'irmt/%s_profiles' % self.platform_or_engine, (DEFAULT_PLATFORM_PROFILES if self.platform_or_engine == 'platform' else DEFAULT_ENGINE_PROFILES))) profile = profiles[self.initial_profile_name] self.profile_name_edt.setText(self.initial_profile_name) self.username_edt.setText(profile['username']) self.password_edt.setText(profile['password']) self.hostname_edt.setText(profile['hostname']) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.ok_button.setEnabled(self.initial_profile_name != '')
def __init__(self, iface, file_stem): self.iface = iface QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.message_bar = QgsMessageBar() self.message_bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.layout().insertWidget(0, self.message_bar) self.message_bar_item = None self.button_box = self.buttonBox self.hostname, self.username, self.password = get_credentials( 'platform') self.web_view = self.web_view self.page = self.web_view.page() self.frame = self.page.mainFrame() self.session = Session() self.network_access_manager = self.page.networkAccessManager() self.cookie_jar = QNetworkCookieJar() self.network_access_manager.setCookieJar(self.cookie_jar) self._setup_context_menu() self.frame.javaScriptWindowObjectCleared.connect(self._setup_js) self.file_stem = file_stem self.layout().setContentsMargins(0, 0, 0, 0) self.web_view.loadFinished.connect(self.load_finished) self.layer_url = None
def __init__(self, loss_layer, zonal_layer): QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self) self.ok_button = self.buttonBox.button(QDialogButtonBox.Ok) self.set_ok_button() # if the loss layer does not contain an attribute specifying the ids of # zones, the user must not be forced to select such attribute, so we # add an "empty" option to the combobox self.zone_id_attr_name_loss_cbox.addItem(tr("Use zonal geometries")) # if the zonal_layer doesn't have a field containing a unique zone id, # the user can choose to add such unique id self.zone_id_attr_name_zone_cbox.addItem( tr("Add field with unique zone id")) # Load in the comboboxes only the names of the attributes compatible # with the following analyses for field in loss_layer.fields(): # for the zone id accept both numeric or textual fields self.zone_id_attr_name_loss_cbox.addItem(field.name()) # Accept only numeric fields to contain loss data if field.typeName() in NUMERIC_FIELD_TYPES: self.loss_attrs_multisel.add_unselected_items([field.name()]) self.zone_id_attr_name_loss_cbox.setCurrentIndex(0) for field in zonal_layer.fields(): # for the zone id accept both numeric or textual fields self.zone_id_attr_name_zone_cbox.addItem(field.name()) # by default, set the selection to the first textual field self.zone_id_attr_name_zone_cbox.setCurrentIndex(0) self.loss_attrs_multisel.selection_changed.connect(self.set_ok_button)
def reject(self): QDialog.reject(self)
def show(self): self.formatManager.getAllFormats() proj = qgis.core.QgsProject.instance() self.projectionSelectionWidget.setCrs(proj.crs()) QDialog.show(self)
def __init__(self, parent=None): """Constructor.""" QDialog.__init__(self) self.parent = parent self.setupUi(self) # noinspection PyUnresolvedReferences self.menu.clicked.connect(self.expand) # noinspection PyUnresolvedReferences self.menu.clicked.connect(self.display_content) self.tree_menu = [{ 'label': 'Import', 'icon': resource('import.png'), 'content': [{ 'label': 'Shapefile', 'icon': resource('shp.png'), 'content': { 'widget': OpenShapefileWidget(), 'help': help_open_shapefile() } }, { 'label': 'Raster', 'icon': resource('raster.png'), 'content': { 'widget': OpenRasterWidget(), 'help': help_open_raster() } }, { 'label': 'Table XLS/DBF', 'icon': resource('xls.png'), 'content': { 'widget': OpenXlsDbfFileWidget(), 'help': help_open_table() } }, { 'label': 'Table CSV', 'icon': resource('csv.png'), 'content': { 'widget': OpenCsv(), 'help': help_open_csv() } }, { 'label': 'XY to map', 'icon': resource('xy.png'), 'content': { 'widget': OpenCsv(), 'help': help_open_csv() } }] }, { 'label': 'Analyse', 'icon': resource('gears.png'), 'content': [{ 'label': 'Blur', 'icon': resource('blur.png'), 'content': [{ 'label': 'Blur', 'icon': resource('blur.png'), 'content': { 'widget': BlurWidget(), 'help': help_blur() } }, { 'label': 'Stats', 'icon': resource('sigma.png'), 'content': { 'widget': StatsWidget(), 'help': help_stats_blurring() } }] }, { 'label': 'Incidence', 'icon': resource('incidence.png'), 'content': [{ 'label': 'Polygon layer only', 'icon': resource('incidence.png'), 'content': { 'widget': IncidenceDialog(), 'help': help_incidence() } }, { 'label': 'Case and aggregation layers', 'icon': resource('incidence.png'), 'content': { 'widget': IncidencePointDialog(), 'help': help_incidence_point() } }] }, { 'label': 'Density', 'icon': resource('incidence.png'), 'content': [{ 'label': 'Polygon layer only', 'icon': resource('incidence.png'), 'content': { 'widget': DensityDialog(), 'help': help_density() } }, { 'label': 'Case and aggregation layers', 'icon': resource('incidence.png'), 'content': { 'widget': DensityPointDialog(), 'help': help_density_point() } }] }] }, { 'label': 'Export', 'icon': resource('export.png'), 'content': [{ 'label': 'Attribute table', 'icon': resource('csv.png'), 'content': { 'widget': CsvExport(), 'help': help_attribute_table() } }] }] self.stack.addWidget(AboutWidget()) self.help_list = [] # A category is import, process and export. for category_def in self.tree_menu: category_menu = QTreeWidgetItem(self.menu) category_menu.setIcon(0, QIcon(category_def['icon'])) category_menu.setText(0, category_def['label']) # Sub item for sub_category_def in category_def['content']: menu_entry = QTreeWidgetItem(category_menu) menu_entry.setIcon(0, QIcon(sub_category_def['icon'])) menu_entry.setText(0, sub_category_def['label']) # Add widget or add tab if isinstance(sub_category_def['content'], dict): widget = sub_category_def['content']['widget'] self.stack.addWidget(widget) self.help_list.append(sub_category_def['content']['help']) else: tab = QTabWidget(self.stack) tab.setIconSize(QSize(32, 32)) self.stack.addWidget(tab) tab_help = [] tab_bar = sub_category_def['content'] for item in tab_bar: label = item['label'] icon = QIcon(item['icon']) widget = item['content']['widget'] help_widget = item['content']['help'] tab_help.append(help_widget) tab.addTab(widget, icon, label) self.help_list.append(tab_help) self.stack.setCurrentIndex(1)
def __init__(self): QDialog.__init__(self) # Set up the user interface from Designer. self.setupUi(self)