Beispiel #1
0
def setVectorFileDir(dir):
    """
    Update the last vector file directory.
    """
    from stdm.settings.registryconfig import QGISRegistryConfig

    qgisReg = QGISRegistryConfig(_UIGroup)
    qgisReg.write({_lastVectorDirKey: dir})
Beispiel #2
0
def setVectorFileDir(dir):
    """
    Update the last vector file directory.
    """
    qgisReg = QGISRegistryConfig(_UIGroup)
    qgisReg.write({_lastVectorDirKey:dir})

    
    
Beispiel #3
0
def vectorFileDir():
    """
    Returns the directory of the last vector file accessed by QGIS.
    """
    qgisReg = QGISRegistryConfig(_UIGroup)
    regValues = qgisReg.read([_lastVectorDirKey])
    
    if len(regValues) == 0:
        return ""
    else:
        return regValues[_lastVectorDirKey]
Beispiel #4
0
def vectorFileDir():
    """
    Returns the directory of the last vector file accessed by QGIS.
    """
    qgisReg = QGISRegistryConfig(_UIGroup)
    regValues = qgisReg.read([_lastVectorDirKey])

    if len(regValues) == 0:
        return ""
    else:
        return regValues[_lastVectorDirKey]
Beispiel #5
0
def pg_profile_names():
    """
    :return: List containing tuple of PostgreSQL database connection names
    and full path stored by QGIS.
    :rtype: list
    """
    pg_connection_path = "/PostgreSQL/connections"
    q_config = QGISRegistryConfig(pg_connection_path)

    pg_connections = q_config.group_children()

    profiles = [(conn_name, u"{0}/{1}".format(pg_connection_path, conn_name))
                for conn_name in pg_connections]

    return profiles
Beispiel #6
0
def pg_profile_names():
    """/
    :return: List containing tuple of PostgreSQL database connection names
    and full path stored by QGIS.
    :rtype: list
    """
    pg_connection_path = "/PostgreSQL/connections"
    q_config = QGISRegistryConfig(pg_connection_path)

    pg_connections = q_config.group_children()

    profiles = [(conn_name, u"{0}/{1}".format(pg_connection_path, conn_name))
                for conn_name in pg_connections]

    return profiles
Beispiel #7
0
    def _on_pg_profile_changed(self, index):
        """
        Slot raised when the index of the pg profile changes. If the
        selection is valid then the system will attempt to extract
        the database connection properties of the selected profile
        stored in the registry.
        """
        if index == 0:
            return

        profile_path = self.cbo_pg_connections.itemData(index)

        q_config = QGISRegistryConfig(profile_path)
        db_items = q_config.read(['Database', 'Host', 'Port'])

        if len(db_items) > 0:
            self.txtDatabase.setText(db_items['Database'])
            self.txtHost.setText(db_items['Host'])
            self.txtPort.setText(db_items['Port'])
Beispiel #8
0
    def _on_pg_profile_changed(self, index):
        """
        Slot raised when the index of the pg profile changes. If the
        selection is valid then the system will attempt to extract
        the database connection properties of the selected profile
        stored in the registry.
        """
        if index == 0:
            return

        profile_path = self.cbo_pg_connections.itemData(index)

        q_config = QGISRegistryConfig(profile_path)
        db_items = q_config.read(['Database', 'Host', 'Port'])

        if len(db_items) > 0:
            self.txtDatabase.setText(db_items['Database'])
            self.txtHost.setText(db_items['Host'])
            self.txtPort.setText(db_items['Port'])
Beispiel #9
0
def setVectorFileDir(dir):
    """
    Update the last vector file directory.
    """
    qgisReg = QGISRegistryConfig(_UIGroup)
    qgisReg.write({_lastVectorDirKey: dir})