def __init__(self, iface):
     """
     Constructor
     """
     QDialog.__init__(self)
     self.setupUi(self)
     self.iface = iface
     
     self.mc = self.iface.mapCanvas()
     #self.legend = self.iface.legendInterface()
     self.loaded_layers = [layer for layer in QgsProject.instance().mapLayers().values()]
     
     # UI CCONNECTORS
     self.buttonBox_ok_cancel.accepted.connect(self.run)
     self.buttonBox_ok_cancel.rejected.connect(self.close)
     self.comboBox_line_layer.currentIndexChanged.connect(self.update_fields)
     
     # Get line layers and raster layers from legend
     vector_line_layers, raster_layers = self.get_useful_layers()
     
     # Populate comboboxes
     self.comboBox_line_layer.clear()
     self.comboBox_line_layer.addItems(vector_line_layers)
     
     self.comboBox_elevation_layer.clear()
     self.comboBox_elevation_layer.addItems(raster_layers)
 def __init__(self, alg, paramType=None, param=None):
     self.alg = alg
     self.paramType = paramType
     self.param = param
     QDialog.__init__(self)
     self.setModal(True)
     self.setupUi()
Exemple #3
0
    def __init__(self, parent, iface, pluginBase, pluginName, pluginCommand):
        QDialog.__init__(self, parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.iface = iface

        self.process = QProcess(self)
        Utils.setProcessEnvironment(self.process)
        self.process.error.connect(self.processError)
        self.process.finished.connect(self.processFinished)

        self.setupUi(self)
        self.arguments = []

        self.editCmdBtn.setIcon(QIcon(":/icons/edit.png"))
        self.editCmdBtn.toggled.connect(self.editCommand)
        self.resetCmdBtn.setIcon(QIcon(":/icons/reset.png"))
        self.resetCmdBtn.clicked.connect(self.resetCommand)
        self.editCommand(False)

        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.helpRequested.connect(self.help)

        self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True)

        self.plugin = pluginBase
        self.valuesChanged.connect(self.handleRefreshArgs)

        self.pluginLayout.addWidget(self.plugin)
        self.plugin.setFocus()

        self.setWindowTitle(pluginName)
        self.setPluginCommand(pluginCommand)
    def __init__(self, iface):
        self.iface = iface
        QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = uic.loadUi(ui_file, self)

        self.configFilePath = os.path.join(os.path.dirname(__file__), 'config.cfg')
        self.defFlags = Qt.NoItemFlags | Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsSelectable
        
        # Populate the PostGIS connection combo with the available connections
        
        # Determine our current preference
        s = QSettings()
        selectedConnection = str(s.value("constraintchecker/postgisConnection", ''))
        
        s.beginGroup('PostgreSQL/connections')
        i = 0
        for connectionName in s.childGroups():
            self.postgisConnectionComboBox.addItem(connectionName)
            if connectionName == selectedConnection:
                # Select this preference in the combo if exists
                self.postgisConnectionComboBox.setCurrentIndex(i)
            i += 1
        s.endGroup()
        
        # Now read the configuration file (if it exists) into the table widget
        try:
            self.readConfiguration()
        except:
            pass
    def __init__(self, iface):

        self.supportedPaperSizes = ['A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8']  # ISO A series
        self.paperSizesPresent = []
        self.presetScales = ['200', '500', '1 000', '1 250', '2 500', '5 000', '10 000', '25 000', '50 000', '100 000']

        self.iface = iface
        QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = uic.loadUi(ui_file, self)

        # Set up the list of templates
        s = QtCore.QSettings()
        self.identifiable_only = s.value("SelectorTools/ProjectSelector/identifiableOnly", True, type=bool)
        self.templateFileRoot = s.value("SelectorTools/TemplateSelector/templateRoot", '', type=str)
        if len(self.templateFileRoot) == 0 or not os.path.isdir(self.templateFileRoot):
            raise TemplateSelectorException('\'%s\' is not a valid template file root folder.' % self.templateFileRoot)
        self.populateTemplateTypes()
        self.populatePoiLayers()
        self.onPoiLayerChanged()

        self.onTemplateTypeChanged()
        self.plugin_dir = os.path.dirname(__file__)

        # Replacement map
        self.ui.suitableForComboBox.addItem('<custom>')
        self.user = os.environ.get('username', '[user]')
        self.replaceMap = {
            'author': "Compiled by {} on [%concat(day($now ),'/',month($now),'/',year($now))%]".format(self.user)
        }
        self.ui.autofit_btn.clicked.connect(self.autofit_map)
        self.ui.suitableForComboBox.currentIndexChanged.connect(self.specify_dpi)
        self.ui.suitableForComboBox.editTextChanged.connect(self.text_changed)
        self.ui.poiLayerComboBox.currentIndexChanged.connect(self.onPoiLayerChanged)
    def __init__(self, table, parent=None):
        QDialog.__init__(self, parent)
        self.table = table
        self.setupUi(self)

        self.db = self.table.database()

        m = TableFieldsModel(self)
        self.viewFields.setModel(m)

        m = TableConstraintsModel(self)
        self.viewConstraints.setModel(m)

        m = TableIndexesModel(self)
        self.viewIndexes.setModel(m)

        self.btnAddColumn.clicked.connect(self.addColumn)
        self.btnAddGeometryColumn.clicked.connect(self.addGeometryColumn)
        self.btnEditColumn.clicked.connect(self.editColumn)
        self.btnDeleteColumn.clicked.connect(self.deleteColumn)

        self.btnAddConstraint.clicked.connect(self.addConstraint)
        self.btnDeleteConstraint.clicked.connect(self.deleteConstraint)

        self.btnAddIndex.clicked.connect(self.createIndex)
        self.btnAddSpatialIndex.clicked.connect(self.createSpatialIndex)
        self.btnDeleteIndex.clicked.connect(self.deleteIndex)

        self.populateViews()
        self.checkSupports()
Exemple #7
0
    def __init__(self, inLayer, outDb, outUri, parent=None):
        QDialog.__init__(self, parent)
        self.inLayer = inLayer
        self.db = outDb
        self.outUri = outUri
        self.setupUi(self)

        supportCom = self.db.supportsComment()
        if not supportCom:
            self.chkCom.setVisible(False)
            self.editCom.setVisible(False)

        self.default_pk = "id"
        self.default_geom = "geom"

        self.mode = self.ASK_FOR_INPUT_MODE if self.inLayer is None else self.HAS_INPUT_MODE

        # used to delete the inlayer whether created inside this dialog
        self.inLayerMustBeDestroyed = False

        self.populateSchemas()
        self.populateTables()
        self.populateLayers()
        self.populateEncodings()

        # updates of UI
        self.setupWorkingMode(self.mode)
        self.cboSchema.currentIndexChanged.connect(self.populateTables)
        self.widgetSourceSrid.setCrs(QgsProject.instance().crs())
        self.widgetTargetSrid.setCrs(QgsProject.instance().crs())
        self.updateInputLayer()
    def __init__(self, iface):
        QDialog.__init__(self, iface.mainWindow())
        self.iface = iface
        # Set up the user interface from Designer.
        self.setupUi(self)
                
        self.populateLayers()
        
        spaced_distance_list = ['1','2','3','4','5']        
        self.spaced_pts_comboBox.clear()
        for distance in spaced_distance_list:
            self.spaced_pts_comboBox.addItem(distance)
        self.spaced_pts_comboBox.setEnabled(False)
        
        self.middle_pts_radioButton.setChecked(1)
        self.spaced_pts_radioButton.setChecked(0)
        
        self.middle_pts_radioButton.toggled.connect(self.method_update)
        self.spaced_pts_radioButton.toggled.connect(self.method_update)

        self.receiver_layer_pushButton.clicked.connect(self.outFile)        
        self.buttonBox = self.buttonBox.button( QDialogButtonBox.Ok )


        self.progressBar.setValue(0)
 def __init__(self, repo, layer=None):
     self.repo = repo
     self.layer = layer
     self.ref = None
     QDialog.__init__(self, config.iface.mainWindow(),
                            Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
     execute(self.initGui)
    def __init__(self, parent=None, table=None, db=None):
        QDialog.__init__(self, parent)
        self.table = table
        self.db = self.table.database() if self.table and self.table.database() else db
        self.setupUi(self)

        self.buttonBox.accepted.connect(self.createGeomColumn)
Exemple #11
0
    def __init__(self):
        QDialog.__init__(self)

        self.setWindowTitle(tr('XY Point drawing tool'))

        self.X = QLineEdit()
        self.Y = QLineEdit()

        X_val = QDoubleValidator()
        Y_val = QDoubleValidator()

        self.X.setValidator(X_val)
        self.Y.setValidator(Y_val)

        self.crsButton = QPushButton("Projection")
        self.crsButton.clicked.connect(self.changeCRS)
        self.crsLabel = QLabel("")

        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        grid = QGridLayout()
        grid.addWidget(QLabel("X"), 0, 0)
        grid.addWidget(QLabel("Y"), 0, 1)
        grid.addWidget(self.X, 1, 0)
        grid.addWidget(self.Y, 1, 1)
        grid.addWidget(self.crsButton, 2, 0)
        grid.addWidget(self.crsLabel, 2, 1)
        grid.addWidget(buttons, 3, 0, 1, 2)

        self.setLayout(grid)
	def __init__(self, parent=None):
		QDialog.__init__(self, parent)
		self.setupUi(self)

		self.titleBoldBtn.hide()
		self.titleItalicBtn.hide()
		self.labelsBoldBtn.hide()
		self.labelsItalicBtn.hide()

		# remove fonts matplotlib doesn't load
		for index in range(self.titleFontCombo.count()-1, -1, -1):
			found = False
			family = unicode( self.titleFontCombo.itemText( index ) )
			try:
				props = self.findFont( {'family':family} )
				if family == props['family']:
					found = True
			except Exception:
				pass
			if not found:
				self.titleFontCombo.removeItem( index )
				self.labelsFontCombo.removeItem( index )

		self.initProps()

		self.titleColorBtn.clicked.connect(self.chooseTitleColor)
		self.labelsColorBtn.clicked.connect(self.chooseLabelsColor)
		self.pointsColorBtn.clicked.connect(self.choosePointsColor)
		self.pointsReplicasColorBtn.clicked.connect(self.choosePointsReplicasColor)
		self.linesColorBtn.clicked.connect(self.chooseLinesColor)
		self.linesThrendColorBtn.clicked.connect(self.chooseLinesThrendColor)
Exemple #13
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setWindowTitle(QCoreApplication.translate("SettingsDialogPythonConsole", "Settings Python Console"))
        self.parent = parent
        self.setupUi(self)

        self.listPath = []
        self.lineEdit.setReadOnly(True)

        self.restoreSettings()
        self.initialCheck()

        self.addAPIpath.setIcon(QIcon(":/images/themes/default/symbologyAdd.svg"))
        self.addAPIpath.setToolTip(QCoreApplication.translate("PythonConsole", "Add API path"))
        self.removeAPIpath.setIcon(QIcon(":/images/themes/default/symbologyRemove.svg"))
        self.removeAPIpath.setToolTip(QCoreApplication.translate("PythonConsole", "Remove API path"))

        self.preloadAPI.stateChanged.connect(self.initialCheck)
        self.addAPIpath.clicked.connect(self.loadAPIFile)
        self.removeAPIpath.clicked.connect(self.removeAPI)
        self.compileAPIs.clicked.connect(self._prepareAPI)

        self.resetFontColor.setIcon(QIcon(":/images/themes/default/console/iconResetColorConsole.png"))
        self.resetFontColor.setIconSize(QSize(18, 18))
        self.resetFontColorEditor.setIcon(QIcon(":/images/themes/default/console/iconResetColorConsole.png"))
        self.resetFontColorEditor.setIconSize(QSize(18, 18))
        self.resetFontColor.clicked.connect(self._resetFontColor)
        self.resetFontColorEditor.clicked.connect(self._resetFontColorEditor)
 def __init__(self, model):
     QDialog.__init__(self)
     # Set up the user interface from Designer.
     self.ui = uic.loadUi(ui_file, self)
     self.resultModel = model
     self.constraintTableView.setModel(self.resultModel)
     self.constraintTableView.resizeColumnsToContents()
Exemple #15
0
    def __init__(self, item, parent=None):
        QDialog.__init__(self, parent)
        self.item = item
        self.setupUi(self)

        self.db = self.item.database()
        self.schemas = self.db.schemas()
        self.hasSchemas = self.schemas is not None

        self.buttonBox.accepted.connect(self.onOK)
        self.buttonBox.helpRequested.connect(self.showHelp)

        self.populateSchemas()
        self.populateTables()

        if isinstance(item, Table):
            index = self.cboTable.findText(self.item.name)
            if index >= 0:
                self.cboTable.setCurrentIndex(index)

        self.cboSchema.currentIndexChanged.connect(self.populateTables)

        # updates of SQL window
        self.cboSchema.currentIndexChanged.connect(self.updateSql)
        self.cboTable.currentIndexChanged.connect(self.updateSql)
        self.chkCreateCurrent.stateChanged.connect(self.updateSql)
        self.editPkey.textChanged.connect(self.updateSql)
        self.editStart.textChanged.connect(self.updateSql)
        self.editEnd.textChanged.connect(self.updateSql)

        self.updateSql()
Exemple #16
0
    def __init__(self):
        """Constructor for the dialog.
        
        """
        
        QDialog.__init__(self)                               
                        
        self.setupUi(self)

        self.btnsave = self.buttonBox.button(QDialogButtonBox.Save)

        self.saveCtrl()

        re = QRegExp('[0-9.]+')
        val = QRegExpValidator(re)
        self.lineEdit.setValidator(val)
        self.lineEdit_2.setValidator(val)

        self.toolButton.setToolTip('Degree - decimal conversion')
        self.toolButton.clicked.connect(self.trafo)

        self.lineEdit_3.textChanged.connect(self.saveCtrl)
        self.lineEdit_5.textChanged.connect(self.saveCtrl)
        self.comboBox.currentIndexChanged.connect(self.saveCtrl)

        self.funcs = VetEpiGISFuncs()
    def __init__(self, title, message, errors, username, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(title)

        self.verticalLayout = QVBoxLayout(self)

        self.label = QLabel(message, self)
        self.verticalLayout.addWidget(self.label)

        self.plainTextEdit = QPlainTextEdit(self)
        self.plainTextEdit.setPlainText(errors)
        self.plainTextEdit.setReadOnly(True)
        self.verticalLayout.addWidget(self.plainTextEdit)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Close)
        self.verticalLayout.addWidget(self.buttonBox)
        self.reportButton = self.buttonBox.addButton(self.tr("Report error"), QDialogButtonBox.ActionRole)

        self.reportButton.clicked.connect(self.__reportError)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

        self.username = username
        self.metadata = MetaData()
    def __init__(self, iface,layer_name):
        QDialog.__init__(self, iface.mainWindow())
        self.iface = iface
        # Set up the user interface from Designer.
        self.setupUi(self)

        self.layer_name = layer_name
        
        # start definition
        self.POWER_P_emission_comboBoxes_dict = {'POWER_P_gen' : self.POWER_P_L_gen_comboBox, 
                                    'POWER_P_day' : self.POWER_P_L_day_comboBox, 
                                    'POWER_P_eve' : self.POWER_P_L_eve_comboBox, 
                                    'POWER_P_nig' : self.POWER_P_L_nig_comboBox
                                    }

        self.all_emission_comboBoxes = [self.POWER_P_L_gen_comboBox, self.POWER_P_L_day_comboBox, self.POWER_P_L_eve_comboBox, self.POWER_P_L_nig_comboBox]
           
        self.source_checkBoxes = [self.POWER_P_L_gen_checkBox,self.POWER_P_L_day_checkBox,self.POWER_P_L_eve_checkBox,self.POWER_P_L_nig_checkBox]
           
        self.source_POWER_P_period_checkBoxes = [self.POWER_P_L_day_checkBox,self.POWER_P_L_eve_checkBox,self.POWER_P_L_nig_checkBox]
        # end definitions        
        
        self.source_fields_update() 

        for source_checkBox in self.source_checkBoxes:
            source_checkBox.setChecked(0)
            source_checkBox.toggled.connect(self.source_checkBox_update)
            
        self.POWER_P_L_gen_checkBox.toggled.connect(self.source_checkBox_update)
        
        self.setToolTips()
        
        self.reload_settings()
Exemple #19
0
    def __init__(self, iface):
        QDialog.__init__(self, iface.mainWindow())
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.iface = iface
        self.setupUi(self)

        # binaries
        self.leGdalBinPath.setText(Utils.getGdalBinPath())
        self.btnSetBinPath.clicked.connect(self.setBinPath)
        self.bin_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.bin_tooltip_label.setToolTip(self.tr(u"""\
A list of colon-separated (Linux and MacOS) or
semicolon-separated (Windows) paths to both binaries
and python executables.

MacOS users usually need to set it to something like
/Library/Frameworks/GDAL.framework/Versions/1.8/Programs"""))

        # python modules
        self.leGdalPymodPath.setText(Utils.getGdalPymodPath())
        self.btnSetPymodPath.clicked.connect(self.setPymodPath)
        self.pymod_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.pymod_tooltip_label.setToolTip(self.tr(u"""\
A list of colon-separated (Linux and MacOS) or
semicolon-separated (Windows) paths to python modules."""))

        # help
        self.leGdalHelpPath.setText(Utils.getHelpPath())
        self.btnSetHelpPath.clicked.connect(self.setHelpPath)
        self.help_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.help_tooltip_label.setToolTip(self.tr(u"""\
Useful to open local GDAL documentation instead of online help
when pressing on the tool dialog's Help button."""))
Exemple #20
0
    def __init__(self):
        QDialog.__init__(self)

        self.setWindowTitle(tr('Rectangle size'))

        self.width = QLineEdit()
        self.height = QLineEdit()

        width_val = QDoubleValidator()
        height_val = QDoubleValidator()

        self.width.setValidator(width_val)
        self.height.setValidator(height_val)

        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        grid = QGridLayout()
        grid.addWidget(QLabel(tr('Give a size in m:')), 0, 0)
        grid.addWidget(QLabel(tr('Width:')), 1, 0)
        grid.addWidget(QLabel(tr('Height:')), 1, 1)
        grid.addWidget(self.width, 2, 0)
        grid.addWidget(self.height, 2, 1)
        grid.addWidget(buttons, 3, 0, 1, 2)

        self.setLayout(grid)
Exemple #21
0
    def __init__(self):
        """Constructor for the dialog.
        
        """

        QDialog.__init__(self)                               
                        
        self.setupUi(self)

        self.comboBox.addItem('ESRI shape file')
        self.comboBox.addItem('Comma separated value (CSV)')
        self.comboBox.addItem('SQLite database')
        self.comboBox.addItem('Copy complete database')
        # self.comboBox.addItem('INSPIRE')
        self.comboBox.currentIndexChanged.connect(self.seler)

        self.comboBox_2.addItem(';')
        self.comboBox_2.addItem(',')
        self.comboBox_2.addItem('tab')

        self.tabWidget.setTabEnabled(0, False)
        self.tabWidget.setTabEnabled(1, False)

        self.seler()

        self.toolButton.clicked.connect(self.filer)
    def __init__(self, alg, model, algName=None, configuration=None):
        QDialog.__init__(self)
        self.setModal(True)

        self._alg = alg # The algorithm to define in this dialog. It is an instance of QgsProcessingAlgorithm
        self.model = model # The model this algorithm is going to be added to. It is an instance of QgsProcessingModelAlgorithm
        self.childId = algName # The name of the algorithm in the model, in case we are editing it and not defining it for the first time
        self.configuration = configuration
        self.context = createContext()

        self.widget_labels = {}

        class ContextGenerator(QgsProcessingContextGenerator):

            def __init__(self, context):
                super().__init__()
                self.processing_context = context

            def processingContext(self):
                return self.processing_context

        self.context_generator = ContextGenerator(self.context)

        self.setupUi()
        self.params = None

        settings = QgsSettings()
        self.restoreGeometry(settings.value("/Processing/modelParametersDialogGeometry", QByteArray()))
    def __init__(self, parent, plugin):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.plugin = plugin
        self.mResult = ""
        self.progressBar.setRange(0, 0)
        self.progressBar.setFormat("%p%")
        self.labelName.setText(plugin["name"])
        self.buttonBox.clicked.connect(self.abort)

        url = QUrl(plugin["download_url"])

        fileName = plugin["filename"]
        tmpDir = QDir.tempPath()
        tmpPath = QDir.cleanPath(tmpDir + "/" + fileName)
        self.file = QFile(tmpPath)

        self.request = QNetworkRequest(url)
        authcfg = repositories.all()[plugin["zip_repository"]]["authcfg"]
        if authcfg and isinstance(authcfg, str):
            if not QgsAuthManager.instance().updateNetworkRequest(
                    self.request, authcfg.strip()):
                self.mResult = self.tr(
                    "Update of network request with authentication "
                    "credentials FAILED for configuration '{0}'").format(authcfg)
                self.request = None

        if self.request is not None:
            self.reply = QgsNetworkAccessManager.instance().get(self.request)
            self.reply.downloadProgress.connect(self.readProgress)
            self.reply.finished.connect(self.requestFinished)

            self.stateChanged(4)
 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):
     """Constructor for the dialog.
     
     """
     
     QDialog.__init__(self)                               
                     
     self.setupUi(self)
    def __init__(self, conn_name=None):
        """init"""

        QDialog.__init__(self)
        self.setupUi(self)
        self.settings = QSettings()
        self.conn_name = None
        self.conn_name_orig = conn_name
 def __init__(self, alg, paramType=None, param=None):
     self.alg = alg
     self.paramType = paramType
     self.param = param
     QDialog.__init__(self)
     self.setModal(True)
     self.setupUi()
     settings = QgsSettings()
     self.restoreGeometry(settings.value("/Processing/modelParametersDefinitionDialogGeometry", QByteArray()))
    def __init__(self, parent, layouts):
        QDialog.__init__(self, parent)

        # Set up the user interface from Designer.
        self.ui = Ui_VoGISProfilToolLayouts()
        self.ui.setupUi(self)

        for l in layouts:
            self.ui.cmbLayouts.addItem(l.name())
 def __init__(self, repo, path):
     QDialog.__init__(self, None, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
     versions = repo.log(path = path, limit = 1)
     if not versions:
         raise GeoGigException("The selected feature is not versioned yet")
     self.blamedata = repo.blame(path)
     self.repo = repo
     self.commitText = {}
     self.setupUi()
 def __init__(self, parent=None):
     QDialog.__init__(self, parent)
     self.setupUi(self)
     self.editURL.setText("http://")
     self.editName.textChanged.connect(self.textChanged)
     self.editURL.textChanged.connect(self.textChanged)
     self.btnClearAuthCfg.clicked.connect(self.editAuthCfg.clear)
     self.btnEditAuthCfg.clicked.connect(self.editAuthCfgId)
     self.textChanged(None)
Exemple #31
0
    def __init__(self, plugIn, parent):
        self.plugIn = plugIn
        self.iface = self.plugIn.iface.mainWindow()
        self.preview = None
        self.ColorVariables = [
        ]  # lista delle variabili di ambiente modificate dalla finestra QadWindowColorDialog

        QDialog.__init__(self, parent)

        self.setupUi(self)

        # Inizializzazione della finestra
        self.init()

        # aggiungo il QWidget chiamato QadPreview
        # che eredita la posizione di widget_Preview (che viene nascosto)
        self.widget_Preview.setHidden(True)
        self.preview = QadPreview(self.plugIn, self.widget_Preview.parent(), \
                                  qad_utils.str2int(self.edit_size.text()), \
                                  qad_utils.str2int(self.edit_transparency.text()))
        self.preview.setGeometry(self.widget_Preview.geometry())
        self.preview.setObjectName("preview")
   def __init__(self, plugIn, parent, dimStyle):
      self.plugIn = plugIn
      self.dimStyle = QadDimStyle(dimStyle) # copio lo stile di quotatura
      self.iface = self.plugIn.iface.mainWindow()

      QDialog.__init__(self, parent)

      self.onInit = False # vero se si è in fase di inizializzazione
      
      self.setupUi(self)
      
      self.init_db_tab()
      self.init_lines_tab()
      self.init_symbols_tab()
      self.init_text_tab()
      self.init_adjust_tab()
      self.init_primaryUnits_tab()
      self.previewDim.drawDim(self.dimStyle)
      
      if self.plugIn.dimStyleLastUsedTabIndex == -1: # non inizializzato
         self.plugIn.dimStyleLastUsedTabIndex = QadDIMSTYLEDETAILSTabIndexEnum.DB
      self.tabWidget.setCurrentIndex(self.plugIn.dimStyleLastUsedTabIndex)
Exemple #33
0
    def __init__(self, iface):
        QDialog.__init__(self)
        loadUi(os.path.join(os.path.dirname(__file__), "dialog.ui"), self)
        self.iface = iface

        # Only point layers and string fields
        self.cbo_points.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.cbo_target_field.setFilters(QgsFieldProxyModel.String)

        # Only polygon layers
        self.cbo_polygons.setFilters(QgsMapLayerProxyModel.PolygonLayer)

        # Initialize field combos
        self.cbo_target_field.setLayer(self.cbo_points.currentLayer())
        self.cbo_source_field.setLayer(self.cbo_polygons.currentLayer())

        # SIGNAL-SLOT connections to link layer and field combos
        self.cbo_points.layerChanged.connect(self.cbo_target_field.setLayer)
        self.cbo_polygons.layerChanged.connect(self.cbo_source_field.setLayer)

        # When users clic on dialog's OK button...
        self.accepted.connect(self.process)
    def __init__(self):
        QDialog.__init__(self, None)
        self.setWindowFlags( self.windowFlags() & ~Qt.WindowContextHelpButtonHint )
        self.setWindowFlags( self.windowFlags() | Qt.WindowStaysOnTopHint)

        # initialize locale
        locale = QSettings().value("locale/userLocale", "en")
        if not locale: locale == 'en' 
        else: locale = locale[0:2]
        localePath = os.path.join(os.path.dirname(__file__), 'i18n', 
                  'geopunt4qgis_{}.qm'.format(locale))
        if os.path.exists(localePath):
            self.translator = QTranslator()
            self.translator.load(localePath)
            QCoreApplication.installTranslator(self.translator)
            
        if locale == 'en': 
            self.htmlFile = os.path.join(os.path.dirname(__file__), 'i18n', 'about-en.html')
        else:
            #dutch is default
            self.htmlFile = os.path.join(os.path.dirname(__file__), 'i18n', 'about-nl.html') 
        self._initGui()
Exemple #35
0
    def __init__(self):
        QDialog.__init__(self)
        self.setupUi(self)
        self.plugin_dir = os.path.dirname(__file__)
        self.metadata = Metadata()

        self.setWindowTitle(
            self.tr('About %s %s' %
                    (self.metadata.name(), self.metadata.version())))
        self.lblVersion.setText(self.tr("Version: ") + self.metadata.version())
        self.tabWidget.setTabText(0, self.metadata.name())
        self.tabWidget.setTabText(1, self.tr("Author"))
        self.tabWidget.setTabText(2, self.tr("Contact"))
        self.tabWidget.setTabText(3, self.tr("Change Log"))

        # setup texts
        aboutString = self.metadata.description()

        contribString = self.tr("<p><center><b>Author(s):</b></center></p>")
        contribString += self.tr("<p>%s<br>" % unicode(self.metadata.author()))

        licenseString = self.tr(
            u"Sourcepole AG - Linux & Open Source Solutions\n")
        licenseString += self.tr(u"Weberstrasse 5, 8004 Zurich, Switzerland\n")

        licenseString += "\n"
        licenseString += self.tr(u"Contact:\n")
        licenseString += self.metadata.author() + "\n"
        licenseString += self.metadata.email() + "\n"
        licenseString += self.metadata.homepage() + "\n"
        licenseString += self.metadata.tracker() + "\n"
        licenseString += self.metadata.repository() + "\n"

        # write texts
        self.memAbout.setText(aboutString)
        self.memContrib.setText(contribString)
        self.memAcknowl.setText(licenseString)
        self.memChangeLog.setText(self.metadata.changelog())
Exemple #36
0
    def __init__(self, iface=None, parent=None, qgis_utils=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.iface = iface
        self.log = QgsApplication.messageLog()
        self._db = None
        self.qgis_utils = qgis_utils
        self.connection_is_dirty = False

        self.cbo_db_source.clear()
        self.cbo_db_source.addItem(self.tr('PostgreSQL / PostGIS'), 'pg')
        self.cbo_db_source.addItem(self.tr('GeoPackage'), 'gpkg')
        self.cbo_db_source.currentIndexChanged.connect(self.db_source_changed)

        # Set connections
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.helpRequested.connect(self.show_help)
        self.btn_test_connection.clicked.connect(self.test_connection)
        self.btn_get_from_project_generator.clicked.connect(
            self.get_from_project_generator)
        self.txt_pg_host.textEdited.connect(self.set_connection_dirty)
        self.txt_pg_port.textEdited.connect(self.set_connection_dirty)
        self.txt_pg_database.textEdited.connect(self.set_connection_dirty)
        self.txt_pg_schema.textEdited.connect(self.set_connection_dirty)
        self.txt_pg_user.textEdited.connect(self.set_connection_dirty)
        self.txt_pg_password.textEdited.connect(self.set_connection_dirty)
        self.txt_gpkg_file.textEdited.connect(self.set_connection_dirty)
        self.btn_test_service.clicked.connect(self.test_service)
        self.chk_use_roads.toggled.connect(self.update_images_state)

        # Trigger some default behaviours
        self.restore_settings()

        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.setLayout(QGridLayout())
        #self.tabWidget.currentWidget().layout().setContentsMargins(0, 0, 0, 0)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)
Exemple #37
0
    def __init__(self, table, parent=None):
        QDialog.__init__(self, parent)
        self.table = table
        self.setupUi(self)

        self.db = self.table.database()

        m = TableFieldsModel(self)
        self.viewFields.setModel(m)

        m = TableConstraintsModel(self)
        self.viewConstraints.setModel(m)

        m = TableIndexesModel(self)
        self.viewIndexes.setModel(m)

        #Display comment in line edit
        m = self.table.comment
        self.viewComment.setText(m)

        self.btnAddColumn.clicked.connect(self.addColumn)
        self.btnAddGeometryColumn.clicked.connect(self.addGeometryColumn)
        self.btnEditColumn.clicked.connect(self.editColumn)
        self.btnDeleteColumn.clicked.connect(self.deleteColumn)

        self.btnAddConstraint.clicked.connect(self.addConstraint)
        self.btnDeleteConstraint.clicked.connect(self.deleteConstraint)

        self.btnAddIndex.clicked.connect(self.createIndex)
        self.btnAddSpatialIndex.clicked.connect(self.createSpatialIndex)
        self.btnDeleteIndex.clicked.connect(self.deleteIndex)

        #Connect button add Comment to function
        self.btnAddComment.clicked.connect(self.createComment)
        #Connect button delete Comment to function
        self.btnDeleteComment.clicked.connect(self.deleteComment)

        self.refresh()
Exemple #38
0
    def __init__(self, item, parent=None):
        QDialog.__init__(self, parent)
        self.item = item
        self.setupUi(self)

        self.db = self.item.database()
        self.schemas = self.db.schemas()
        self.hasSchemas = self.schemas is not None
        self.fieldTypes = self.db.connector.fieldTypes()

        m = TableFieldsModel(self, True)  # it's editable
        self.fields.setModel(m)
        self.fields.setColumnHidden(3, True)  # hide Default column

        d = TableFieldsDelegate(self.fieldTypes, self)
        self.fields.setItemDelegate(d)

        self.fields.setColumnWidth(0, 140)
        self.fields.setColumnWidth(1, 140)
        self.fields.setColumnWidth(2, 50)

        b = QPushButton(self.tr("&Create"))
        self.buttonBox.addButton(b, QDialogButtonBox.ActionRole)

        self.btnAddField.clicked.connect(self.addField)
        self.btnDeleteField.clicked.connect(self.deleteField)
        self.btnFieldUp.clicked.connect(self.fieldUp)
        self.btnFieldDown.clicked.connect(self.fieldDown)
        b.clicked.connect(self.createTable)

        self.chkGeomColumn.clicked.connect(self.updateUi)

        self.fields.selectionModel().selectionChanged.connect(self.updateUiFields)
        d.columnNameChanged.connect(self.updatePkeyCombo)

        self.populateSchemas()
        self.updateUi()
        self.updateUiFields()
Exemple #39
0
    def __init__(self, dockwidget, parent, params):

        QDialog.__init__(self, parent)
        main_lay = QVBoxLayout(self)
        self.dockwidget = dockwidget
        self.params = params

        self.setWindowTitle('Tags editor')

        # Top frame
        self.fra_top = QFrame()
        fra_top_lay = QVBoxLayout(self.fra_top)

        self.lst_main = QListWidget(self)
        self.btn_add = QPushButton('Add tag')
        self.btn_add.clicked.connect(self.add_tag)
        self.btn_remove = QPushButton('Remove tag')
        self.btn_remove.clicked.connect(self.remove_tag)

        fra_top_lay.addWidget(self.lst_main)
        fra_top_lay.addWidget(self.btn_add)
        fra_top_lay.addWidget(self.btn_remove)

        # Bottom frame
        self.fra_bottom = QFrame()
        fra_bottom_lay = QHBoxLayout(self.fra_bottom)

        btb_main = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        btb_main.accepted.connect(self.ok)
        btb_main.rejected.connect(self.reject)

        fra_bottom_lay.addWidget(btb_main)

        # Main
        main_lay.addWidget(self.fra_top)
        main_lay.addWidget(self.fra_bottom)

        self.initialize()
Exemple #40
0
    def __init__(self, layer, canvas, parent=None):
        QDialog.__init__(self)
        self.setupUi(self)
        self.layer = layer

        self.setWindowTitle("{} - style editor".format(self.layer.name()))

        if self.layer.type() == QgsMapLayer.VectorLayer:
            self.StyleEditorWidget = QgsRendererPropertiesDialog(
                self.layer, QgsStyle(), True, parent)

        if self.layer.type() == QgsMapLayer.RasterLayer:
            self.StyleEditorWidget = QgsRendererRasterPropertiesWidget(
                self.layer, canvas, parent)

        self.scrollArea.setWidget(self.StyleEditorWidget)

        self.DialogButtons.button(QDialogButtonBox.Cancel).clicked.connect(
            self.reject)
        self.DialogButtons.button(QDialogButtonBox.Ok).clicked.connect(
            self.accept)
        self.DialogButtons.button(QDialogButtonBox.Apply).clicked.connect(
            self.apply)
Exemple #41
0
 def __init__(self, dropped_files, parent=None):
     QDialog.__init__(self, parent)
     self.setupUi(self)
     self.setFixedSize(QSize())
     QgsGui.instance().enableAutoGeometryRestore(self)
     file_list = "\n- ".join(
         os.path.basename(path)
         for path in dropped_files
         if dropped_files.index(path) < 10
     )
     self.info_label.setText(
         self.tr(
             "Do you want to use the Model Baker plugin to handle the following {}?\n- {} {}"
         ).format(
             self.tr("files") if len(dropped_files) > 1 else self.tr("file"),
             file_list,
             self.tr("\nand {} more...").format(len(dropped_files) - 10)
             if len(dropped_files) > 10
             else "",
         )
     )
     self.accepted.connect(lambda: self.handle_dropped_file_configuration(True))
     self.rejected.connect(lambda: self.handle_dropped_file_configuration(False))
    def __init__(self, iface, setupObject):
        QDialog.__init__(self)
        self.iface = iface
        self.setupUi(self)

        inputText = 'Marxan input folder: ' + setupObject.inputPath
        self.inputLabel.setText(inputText)
        outputText = 'Marxan output folder: ' + setupObject.outputPath
        self.outputLabel.setText(outputText)

        marxanFileList = makeMarxanFileList(setupObject)
        if len(marxanFileList) > 0:
            self.fileListWidget.addItems(marxanFileList)
        else:
            self.startButton.setEnabled(False)
            warningMessage(
                'No files found',
                'The specified Marxan output folder does not contain any individual portfolio files that can be analysed in MinPatch.'
            )

        self.browseButton.clicked.connect(self.setMinpatchDetailFile)
        self.startButton.clicked.connect(
            lambda: self.startMinPatch(setupObject))
Exemple #43
0
    def __init__(self):
        QDialog.__init__(self)

        # Set up the user interface from Designer.
        self.setupUi(self)
        # set up internal GUI signals
        self.closeButton.clicked.connect(self.close)

        # load text
        about_msg = (
            'The "Space Syntax Toolkit" is a collection of tools for space syntax analysis workflows in the QGIS environment.\n'
            'It was originally developed at the Space Syntax Laboratory, the Bartlett, University College London (UCL).\n\n'
            'Mailing list: [email protected]\n\n'
            'Author: Jorge Gil\n\n'
            'It includes contributions from:\n\n'
            '- Space Syntax Limited:\n'
            'Ioanna Kovolou, Abhimanyu Acharya, Stephen Law, Laurens Versluis\n\n'
            '\nReleased under GNU Licence version 3')

        self.messageText.setText(about_msg)

        # load logos
        self.logoLabel.setPixmap(QPixmap(os.path.join(os.path.dirname(__file__), 'icons', 'contrib_logos.png')))
Exemple #44
0
    def __init__(self, plugIn):
        self.plugIn = plugIn
        self.iface = self.plugIn.iface.mainWindow()

        QDialog.__init__(self)
        # non passo il parent perchè altrimenti il font e la sua dimensione verrebbero ereditati dalla dialog scombinando tutto
        #QDialog.__init__(self, self.iface)

        self.selectedDimStyle = None

        self.setupUi(self)
        self.retranslateUi(self)  # aggiungo alcune traduzioni personalizzate
        self.dimStyleList.setContextMenuPolicy(Qt.CustomContextMenu)

        # aggiungo il canvans di preview della quota chiamato QadPreviewDim
        # che eredita la posizione di previewDummy (che viene nascosto)
        self.previewDummy.setHidden(True)
        self.previewDim = QadPreviewDim(self.previewDummy.parent(),
                                        self.plugIn)
        self.previewDim.setGeometry(self.previewDummy.geometry())
        self.previewDim.setObjectName("previewDim")

        self.init()
Exemple #45
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.parent = parent
        self.setWindowTitle(
            QCoreApplication.translate("PythonConsole",
                                       "Python Console - Command History"))
        self.listView.setToolTip(
            QCoreApplication.translate("PythonConsole",
                                       "Double-click on item to execute"))

        self.listView.setFont(QgsCodeEditorPython.getMonospaceFont())

        self.model = QStandardItemModel(self.listView)

        self._reloadHistory()

        self.deleteScut = QShortcut(QKeySequence(Qt.Key_Delete), self)
        self.deleteScut.activated.connect(self._deleteItem)
        self.listView.doubleClicked.connect(self._runHistory)
        self.reloadHistory.clicked.connect(self._reloadHistory)
        self.saveHistory.clicked.connect(self._saveHistory)
        self.runHistoryButton.clicked.connect(self._executeSelectedHistory)
Exemple #46
0
    def __init__(self, parent=None, iface=None):
        """Constructor."""
        super(DialogZoomToFeature, self).__init__(parent)
        # 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
        QDialog.__init__(self, parent)
        self.parent = parent
        self.iface = iface
        self.setupUi(self)

        self.num_chant.textChanged.connect(self.check_form_validation)

        # Set up things for ok button
        self.ok_button = self.button_zoom_to.button(QDialogButtonBox.Ok)
        self.ok_button.setEnabled(False)
        self.ok_button.clicked.connect(self.accept)

        # Set up things for cancel button
        self.cancel_button = self.button_zoom_to.button(QDialogButtonBox.Cancel)
        self.cancel_button.clicked.connect(self.reject)
    def __init__(self, inLayer, outDb, outUri, parent=None):
        QDialog.__init__(self, parent)
        self.inLayer = inLayer
        self.db = outDb
        self.outUri = outUri
        self.setupUi(self)

        self.default_pk = "id"
        self.default_geom = "geom"

        self.mode = self.ASK_FOR_INPUT_MODE if self.inLayer is None else self.HAS_INPUT_MODE

        # used to delete the inlayer whether created inside this dialog
        self.inLayerMustBeDestroyed = False

        self.populateSchemas()
        self.populateTables()
        self.populateLayers()
        self.populateEncodings()

        # updates of UI
        self.setupWorkingMode(self.mode)
        self.cboSchema.currentIndexChanged.connect(self.populateTables)
Exemple #48
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.progressBar.setRange(0, len(repositories.allEnabled()) * 100)
        self.itemProgress = {}
        self.item = {}
        for key in repositories.allEnabled():
            self.item[key] = QTreeWidgetItem(self.treeWidget)
            self.item[key].setText(0, key)
            if repositories.all()[key]["state"] > 1:
                self.itemProgress[key] = 100
                self.displayState(key, 0)
            else:
                self.itemProgress[key] = 0
                self.displayState(key, 2)
        self.treeWidget.resizeColumnToContents(0)
        repositories.repositoryFetched.connect(self.repositoryFetched)
        repositories.anythingChanged.connect(self.displayState)

        settings = QgsSettings()
        self.restoreGeometry(
            settings.value("/Qgis/plugin-installer/fetching_geometry",
                           QByteArray()))
    def __init__(self, utils, parcels_t_ids, parent):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.utils = utils
        self.parcels_t_ids = parcels_t_ids
        self.parent = parent
        self.parcel_t_id = None
        self.parcel_number = None

        self.fill_table()

        self.tbl_changes_parcels.itemSelectionChanged.connect(
            self.react_after_new_selection)
        self.setWindowTitle(
            QCoreApplication.translate("SelectParcelDialog",
                                       "Duplicate Parcels in collected DB"))

        # Remove selection in plot layers
        self.utils._layers[
            self.utils._db.names.OP_PLOT_T][LAYER].removeSelection()
        self.utils._supplies_layers[
            self.utils._supplies_db.names.GC_PLOT_T][LAYER].removeSelection()

        self.select_button_name = QCoreApplication.translate(
            "SelectParcelDialog", "Show details for selected parcel")
        self.zoom_to_all_button_name = QCoreApplication.translate(
            "SelectParcelDialog", "Zoom to all listed parcels")
        self.buttonBox.accepted.disconnect()
        self.buttonBox.clicked.connect(self.button_box_clicked)
        self.buttonBox.clear()
        self.buttonBox.addButton(QDialogButtonBox.Cancel)
        self.buttonBox.addButton(self.zoom_to_all_button_name,
                                 QDialogButtonBox.AcceptRole)
        self.buttonBox.addButton(self.select_button_name,
                                 QDialogButtonBox.AcceptRole)

        self.set_controls_enabled()
Exemple #50
0
    def __init__(self, iface, db, qgis_utils, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.iface = iface
        self._db = db
        self.qgis_utils = qgis_utils
        self.models_tree = dict()
        self.selected_items_dict = dict()
        self.icon_names = ['points', 'lines', 'polygons', 'tables', 'domains', 'structures', 'associations']

        self.txt_search_text.addAction(QIcon(":/Asistente-LADM_COL/resources/images/search.png"), QLineEdit.LeadingPosition)

        # Fill predefined tables combobox
        self.cbo_select_predefined_tables.clear()
        self.cbo_select_predefined_tables.setInsertPolicy(QComboBox.InsertAlphabetically)
        self.cbo_select_predefined_tables.addItem("", []) # By default

        for name, layer_list in LAYER_SETS.items():
            self.cbo_select_predefined_tables.addItem(self.tr(name), layer_list)

        self.cbo_select_predefined_tables.currentIndexChanged.connect(self.select_predefined_changed)

        # Set connections
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.rejected.connect(self.rejected)
        self.buttonBox.helpRequested.connect(self.show_help)
        self.txt_search_text.textChanged.connect(self.search_text_changed)
        self.chk_show_domains.toggled.connect(self.show_table_type_changed)
        self.chk_show_structures.toggled.connect(self.show_table_type_changed)
        self.chk_show_associations.toggled.connect(self.show_table_type_changed)
        self.trw_layers.itemSelectionChanged.connect(self.selection_changed)

        # Reload latest settings
        self.restore_settings()

        # Load layers from the db
        self.load_available_layers()
Exemple #51
0
    def __init__(self, iface):
        QDialog.__init__(self)
        self.iface = iface
        self.setupUi(self)
        self.layer = self.iface.activeLayer()
        self.provider = self.layer.dataProvider()
        self.fields = self.readFields(self.provider.fields())
        self.isUnsaved = False  # No unsaved changes yet
        if self.provider.storageType(
        ) == 'ESRI Shapefile':  # Is provider saveable?
            self.isSaveable = True
        else:
            self.isSaveable = False

        self.needsRedraw = True  # Preview table is redrawed only on demand. This is for initial drawing.
        self.lastFilter = None
        self.selection = -1  # Don't highlight any field on startup
        self.selection_list = []  #Update: Santiago Banchero 09-06-2009

        self.butUp.clicked.connect(self.doMoveUp)
        self.butDown.clicked.connect(self.doMoveDown)
        self.butDel.clicked.connect(self.doDelete)
        self.butIns.clicked.connect(self.doInsert)
        self.butClone.clicked.connect(self.doClone)
        self.butRename.clicked.connect(self.doRename)
        self.butRename.clicked.connect(self.doSave)
        self.butSaveAs.clicked.connect(self.doSaveAs)
        self.buttonBox.rejected.connect(self.doDone)
        self.fieldsTable.itemSelectionChanged.connect(self.selectionChanged)
        self.tabWidget.currentChanged[int].connect(self.drawDataTable)

        self.setWindowTitle(
            self.tr('Table Manager: {0}').format(self.layer.name()))
        self.progressBar.setValue(0)
        self.restoreCfg()
        self.drawFieldsTable()
        self.readData()
Exemple #52
0
    def __init__(self, db_connector, uri, type, parent=None):
        """
        Constructor
        :param db: database connection instance
        :param type: type of parameter to capture (database or schema)
        :param parent: parent of dialog
        """
        QDialog.__init__(self, parent)

        self.type = type
        self.db_connector = db_connector
        self.uri = uri
        self.parent = parent
        self.setupUi(self)
        self.message_label.setText(QCoreApplication.translate("DialogGetDBOrSchemaName", "Enter the name of the {type}:").format(type=self.type))
        self.setWindowTitle(QCoreApplication.translate("DialogGetDBOrSchemaName", "Create {type}").format(type=self.type))

        self.parameter_line_edit.setPlaceholderText(QCoreApplication.translate("DialogGetDBOrSchemaName", "[Name of the {type} to be created]").format(type=self.type))
        self.validators = Validators()

        # schema name mustn't have special characters
        regex = QRegExp("[a-zA-Z0-9_]+")
        validator = QRegExpValidator(regex)
        self.parameter_line_edit.setValidator(validator)
        self.parameter_line_edit.setMaxLength(63)
        self.parameter_line_edit.textChanged.connect(self.validators.validate_line_edits_lower_case)
        self.parameter_line_edit.textChanged.emit(self.parameter_line_edit.text())

        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)

        self.buttonBox.accepted.disconnect()
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.clear()
        self.buttonBox.addButton(QDialogButtonBox.Cancel)
        self.buttonBox.addButton(QCoreApplication.translate("DialogGetDBOrSchemaName", "Create {type}").format(type=self.type), QDialogButtonBox.AcceptRole)
    def __init__(self, qris_project):
        """Used to construct the design dialog"""
        QDialog.__init__(self, None)
        self.setupUi(self)
        self.qris_project = qris_project
        # paths to directory geopackage and tables
        self.directory_path = self.qris_project.project_designs.directory_path(
            self.qris_project.project_path)
        self.geopackage_path = self.qris_project.project_designs.geopackage_path(
            self.qris_project.project_path)
        self.designs_path = self.geopackage_path + '|layername=designs'
        self.structure_types_path = self.geopackage_path + '|layername=structure_types'
        self.status_path = self.geopackage_path + '|layername=lkp_design_status'
        self.phases_path = self.geopackage_path + '|layername=phases'
        self.zoi_path = self.geopackage_path + '|layername=zoi'
        self.complexes_path = self.geopackage_path + '|layername=complexes'
        self.structure_points_path = self.geopackage_path + '|layername=structure_points'
        self.structure_lines_path = self.geopackage_path + '|layername=structure_lines'

        # create the db if it isn't there?
        if not os.path.exists(self.geopackage_path):
            self.create_design_geopackage()

        # populate combo boxes
        conn = sqlite3.connect(self.geopackage_path)
        curs = conn.cursor()
        curs.execute('SELECT * FROM lkp_design_status')
        statuses = curs.fetchall()
        conn.close()
        for status in statuses:
            self.comboBox_design_status.addItem(status[1], status[0])
        self.comboBox_design_geometry.addItems(['Point', 'Line'])

        # add signals to buttons
        self.buttonBox.accepted.connect(self.save_design)
        self.buttonBox.rejected.connect(self.cancel_design)
Exemple #54
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setWindowTitle(
            QCoreApplication.translate("SettingsDialogPythonConsole",
                                       "Settings Python Console"))
        self.parent = parent
        self.setupUi(self)

        self.listPath = []
        self.lineEdit.setReadOnly(True)

        self.restoreSettings()
        self.initialCheck()

        self.addAPIpath.setIcon(
            QIcon(":/images/themes/default/symbologyAdd.svg"))
        self.addAPIpath.setToolTip(
            QCoreApplication.translate("PythonConsole", "Add API path"))
        self.removeAPIpath.setIcon(
            QIcon(":/images/themes/default/symbologyRemove.svg"))
        self.removeAPIpath.setToolTip(
            QCoreApplication.translate("PythonConsole", "Remove API path"))

        self.preloadAPI.stateChanged.connect(self.initialCheck)
        self.addAPIpath.clicked.connect(self.loadAPIFile)
        self.removeAPIpath.clicked.connect(self.removeAPI)
        self.compileAPIs.clicked.connect(self._prepareAPI)

        self.resetFontColor.setIcon(
            QIcon(":/images/themes/default/console/iconResetColorConsole.png"))
        self.resetFontColor.setIconSize(QSize(18, 18))
        self.resetFontColorEditor.setIcon(
            QIcon(":/images/themes/default/console/iconResetColorConsole.png"))
        self.resetFontColorEditor.setIconSize(QSize(18, 18))
        self.resetFontColor.clicked.connect(self._resetFontColor)
        self.resetFontColorEditor.clicked.connect(self._resetFontColorEditor)
    def __init__(self, qris_project):
        """Used to construct the design dialog"""
        QDialog.__init__(self, None)
        self.setupUi(self)
        self.qris_project = qris_project
        # paths to directory geopackage and tables
        self.directory_path = self.qris_project.project_designs.directory_path(
            self.qris_project.project_path)
        self.geopackage_path = self.qris_project.project_designs.geopackage_path(
            self.qris_project.project_path)
        self.structure_types_path = self.geopackage_path + '|layername=structure_types'

        # population combo box
        conn = sqlite3.connect(self.geopackage_path)
        curs = conn.cursor()
        curs.execute('SELECT * FROM lkp_structure_mimics')
        mimics = curs.fetchall()
        conn.close()
        for mimic in mimics:
            self.comboBox_structure_mimics.addItem(mimic[1], mimic[0])

        # add signals
        self.buttonBox.accepted.connect(self.save_structure_type)
        self.buttonBox.rejected.connect(self.cancel_structure_type)
Exemple #56
0
    def __init__(self, iface, base_config, parent):
        QDialog.__init__(self, parent)
        self.iface = iface
        self.base_config = base_config

        self.setWindowTitle(self.tr("QGIS Model Baker - Workflow Wizard"))
        self.log_panel = LogPanel()
        self.workflow_wizard = WorkflowWizard(self.iface, self.base_config,
                                              self)
        self.workflow_wizard.setStartId(PageIds.Intro)
        self.workflow_wizard.setWindowFlags(Qt.Widget)
        self.workflow_wizard.setFixedHeight(self.fontMetrics().lineSpacing() *
                                            36)
        self.workflow_wizard.setMinimumWidth(self.fontMetrics().lineSpacing() *
                                             48)
        self.workflow_wizard.show()

        self.workflow_wizard.finished.connect(self.done)
        layout = QVBoxLayout()
        splitter = QSplitter(Qt.Vertical)
        splitter.addWidget(self.workflow_wizard)
        splitter.addWidget(self.log_panel)
        layout.addWidget(splitter)
        self.setLayout(layout)
    def __init__(self, parent):
        QDialog.__init__(self)
        self.setupUi(self)

        uri = QgsDataSourceUri()
        uri.setConnection('localhost', '5432', 'etienne', 'postgres',
                          os.environ['APP_PASSWORD'])
        uri.setDataSource('public', 'equipements', None)
        self.layer = QgsVectorLayer(uri.uri(False), 'equipements', 'postgres')

        self.layer_cache = QgsVectorLayerCache(self.layer, 120)
        self.model = QgsAttributeTableModel(self.layer_cache)
        self.model.loadLayer()

        tbl_filter_model = QgsAttributeTableFilterModel(
            QgsMapCanvas(), self.model)

        self.attribute_table.setModel(tbl_filter_model)
        self.attribute_table.resizeRowsToContents()
        self.attribute_table.resizeColumnsToContents()

        self.add_item.clicked.connect(self.add_new_item)

        self.exec_()
Exemple #58
0
    def __init__(self, iface):
        QDialog.__init__(self, iface.mainWindow())
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.iface = iface
        self.setupUi(self)

        # binaries
        self.leGdalBinPath.setText(Utils.getGdalBinPath())
        self.btnSetBinPath.clicked.connect(self.setBinPath)
        self.bin_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.bin_tooltip_label.setToolTip(
            self.tr(u"""\
A list of colon-separated (Linux and MacOS) or
semicolon-separated (Windows) paths to both binaries
and python executables.

MacOS users usually need to set it to something like
/Library/Frameworks/GDAL.framework/Versions/1.8/Programs"""))

        # python modules
        self.leGdalPymodPath.setText(Utils.getGdalPymodPath())
        self.btnSetPymodPath.clicked.connect(self.setPymodPath)
        self.pymod_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.pymod_tooltip_label.setToolTip(
            self.tr(u"""\
A list of colon-separated (Linux and MacOS) or
semicolon-separated (Windows) paths to python modules."""))

        # help
        self.leGdalHelpPath.setText(Utils.getHelpPath())
        self.btnSetHelpPath.clicked.connect(self.setHelpPath)
        self.help_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.help_tooltip_label.setToolTip(
            self.tr(u"""\
Useful to open local GDAL documentation instead of online help
when pressing on the tool dialog's Help button."""))
    def __init__(self, iface):
        QDialog.__init__(self, iface.mainWindow())
        self.iface = iface
        # Set up the user interface from Designer.
        self.setupUi(self)

        self.populateLayers()

        spaced_distance_list = ['1', '2', '3', '4', '5']
        self.spaced_pts_comboBox.clear()
        for distance in spaced_distance_list:
            self.spaced_pts_comboBox.addItem(distance)
        self.spaced_pts_comboBox.setEnabled(False)

        self.middle_pts_radioButton.setChecked(1)
        self.spaced_pts_radioButton.setChecked(0)

        self.middle_pts_radioButton.toggled.connect(self.method_update)
        self.spaced_pts_radioButton.toggled.connect(self.method_update)

        self.receiver_layer_pushButton.clicked.connect(self.outFile)
        self.buttonBox = self.buttonBox.button(QDialogButtonBox.Ok)

        self.progressBar.setValue(0)
Exemple #60
0
    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