Exemplo n.º 1
0
def load_qgis_settings(optpath, logger, verbose=False):
    """ Load qgis settings
    """
    from qgis.PyQt.QtCore import QSettings
    from qgis.core import QgsSettings, QgsApplication

    QSettings.setDefaultFormat(QSettings.IniFormat)
    QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, optpath)
    logger.info("Settings loaded from %s", QgsSettings().fileName())
Exemplo n.º 2
0
# Import QGIS AND QT modules
from qgis.core import QgsApplication
from qgis.PyQt.QtCore import QCoreApplication, QSettings
from processing.core.Processing import Processing

# Create QGIS app
QgsApplication.setPrefixPath(qgisPrefixPath, True)
app = QgsApplication([], False, qgisConfigPath)

# Set QSettings format and path
# needed so that db_manager plugin can read the settings from QGIS3.ini
QCoreApplication.setOrganizationName(QgsApplication.QGIS_ORGANIZATION_NAME)
QCoreApplication.setOrganizationDomain(QgsApplication.QGIS_ORGANIZATION_DOMAIN)
QCoreApplication.setApplicationName(QgsApplication.QGIS_APPLICATION_NAME)
QSettings.setDefaultFormat(QSettings.IniFormat)
QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, qgisConfigPath)

# Init QGIS
app.initQgis()

# Initialize processing
Processing.initialize()

# Add Processing providers
reg = app.processingRegistry()
# lizsync provider
from lizsync.processing.provider import LizsyncProvider

reg.addProvider(LizsyncProvider())
# Native QGIS provider