本文整理汇总了Python中qgis.core.QgsApplication类的典型用法代码示例。如果您正苦于以下问题:Python QgsApplication类的具体用法?Python QgsApplication怎么用?Python QgsApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QgsApplication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_OTBParameterChoice_Gui
def test_OTBParameterChoice_Gui(self):
"""
This test is similar to GuiTests in processing that is done on other parameter widget in processing
Main difference is this test uses create_wrapper_from_metadata() rather than create_wrapper_from_class()
like rest of processing widgets.
"""
param = OtbParameterChoice('test')
alg = QgsApplication.processingRegistry().createAlgorithmById('otb:Smoothing')
# algorithm dialog
dlg = AlgorithmDialog(alg)
wrapper = WidgetWrapperFactory.create_wrapper_from_metadata(param, dlg)
self.assertIsNotNone(wrapper)
self.assertIsInstance(wrapper, OtbChoiceWidgetWrapper)
self.assertEqual(wrapper.dialog, dlg)
self.assertIsNotNone(wrapper.widget)
alg = QgsApplication.processingRegistry().createAlgorithmById('otb:Smoothing')
# batch dialog
dlg = BatchAlgorithmDialog(alg)
wrapper = WidgetWrapperFactory.create_wrapper_from_metadata(param, dlg)
self.assertIsNotNone(wrapper)
self.assertIsInstance(wrapper, OtbChoiceWidgetWrapper)
self.assertEqual(wrapper.dialog, dlg)
self.assertIsNotNone(wrapper.widget)
alg = QgsApplication.processingRegistry().createAlgorithmById('otb:Smoothing')
# modeler dialog
model = QgsProcessingModelAlgorithm()
dlg = ModelerParametersDialog(alg, model)
wrapper = WidgetWrapperFactory.create_wrapper_from_metadata(param, dlg)
self.assertIsNotNone(wrapper)
self.assertIsInstance(wrapper, OtbChoiceWidgetWrapper)
self.assertEqual(wrapper.dialog, dlg)
self.assertIsNotNone(wrapper.widget)
开发者ID:dwsilk,项目名称:QGIS,代码行数:35,代码来源:OtbAlgorithmsTest.py
示例2: checkConstructWrapper
def checkConstructWrapper(self, param, expected_wrapper_class):
alg = QgsApplication.processingRegistry().createAlgorithmById('native:centroids')
# algorithm dialog
dlg = AlgorithmDialog(alg)
wrapper = WidgetWrapperFactory.create_wrapper_from_class(param, dlg)
self.assertIsNotNone(wrapper)
self.assertIsInstance(wrapper, expected_wrapper_class)
self.assertEqual(wrapper.dialog, dlg)
self.assertIsNotNone(wrapper.widget)
alg = QgsApplication.processingRegistry().createAlgorithmById('native:centroids')
# batch dialog
dlg = BatchAlgorithmDialog(alg)
wrapper = WidgetWrapperFactory.create_wrapper_from_class(param, dlg)
self.assertIsNotNone(wrapper)
self.assertIsInstance(wrapper, expected_wrapper_class)
self.assertEqual(wrapper.dialog, dlg)
self.assertIsNotNone(wrapper.widget)
alg = QgsApplication.processingRegistry().createAlgorithmById('native:centroids')
# modeler dialog
model = QgsProcessingModelAlgorithm()
dlg = ModelerParametersDialog(alg, model)
wrapper = WidgetWrapperFactory.create_wrapper_from_class(param, dlg)
self.assertIsNotNone(wrapper)
self.assertIsInstance(wrapper, expected_wrapper_class)
self.assertEqual(wrapper.dialog, dlg)
self.assertIsNotNone(wrapper.widget)
开发者ID:FERRATON,项目名称:QGIS,代码行数:30,代码来源:GuiTest.py
示例3: unload
def unload(self):
self.toolbox.setVisible(False)
self.iface.removeDockWidget(self.toolbox)
self.iface.attributesToolBar().removeAction(self.toolboxAction)
self.resultsDock.setVisible(False)
self.iface.removeDockWidget(self.resultsDock)
self.toolbox.deleteLater()
self.menu.deleteLater()
# delete temporary output files
folder = QgsProcessingUtils.tempFolder()
if QDir(folder).exists():
shutil.rmtree(folder, True)
# also delete temporary help files
folder = tempHelpFolder()
if QDir(folder).exists():
shutil.rmtree(folder, True)
self.iface.unregisterMainWindowAction(self.toolboxAction)
self.iface.unregisterMainWindowAction(self.modelerAction)
self.iface.unregisterMainWindowAction(self.historyAction)
self.iface.unregisterMainWindowAction(self.resultsAction)
self.iface.unregisterOptionsWidgetFactory(self.options_factory)
self.iface.deregisterLocatorFilter(self.locator_filter)
self.iface.unregisterCustomDropHandler(self.drop_handler)
QgsApplication.dataItemProviderRegistry().removeProvider(self.item_provider)
removeMenus()
Processing.deinitialize()
开发者ID:lbartoletti,项目名称:QGIS,代码行数:33,代码来源:ProcessingPlugin.py
示例4: grassPath
def grassPath():
if not isWindows() and not isMac():
return ''
folder = ProcessingConfig.getSetting(GrassUtils.GRASS_FOLDER) or ''
if not os.path.exists(folder):
folder = None
if folder is None:
if isWindows():
if "OSGEO4W_ROOT" in os.environ:
testfolder = os.path.join(str(os.environ['OSGEO4W_ROOT']), "apps")
else:
testfolder = str(QgsApplication.prefixPath())
testfolder = os.path.join(testfolder, 'grass')
if os.path.isdir(testfolder):
for subfolder in os.listdir(testfolder):
if subfolder.startswith('grass-6'):
folder = os.path.join(testfolder, subfolder)
break
else:
folder = os.path.join(QgsApplication.prefixPath(), 'grass')
if not os.path.isdir(folder):
folder = '/Applications/GRASS-6.4.app/Contents/MacOS'
if folder:
ProcessingConfig.setSettingValue(GrassUtils.GRASS_FOLDER, folder)
return folder or ''
开发者ID:lucacasagrande,项目名称:QGIS,代码行数:27,代码来源:GrassUtils.py
示例5: __init__
def __init__(self, parent, alg):
super(BatchPanel, self).__init__(None)
self.setupUi(self)
self.wrappers = []
self.btnAdvanced.hide()
# Set icons
self.btnAdd.setIcon(QgsApplication.getThemeIcon('/symbologyAdd.svg'))
self.btnRemove.setIcon(QgsApplication.getThemeIcon('/symbologyRemove.svg'))
self.btnOpen.setIcon(QgsApplication.getThemeIcon('/mActionFileOpen.svg'))
self.btnSave.setIcon(QgsApplication.getThemeIcon('/mActionFileSave.svg'))
self.btnAdvanced.setIcon(QIcon(os.path.join(pluginPath, 'images', 'alg.png')))
self.alg = alg
self.parent = parent
self.btnAdd.clicked.connect(self.addRow)
self.btnRemove.clicked.connect(self.removeRows)
self.btnOpen.clicked.connect(self.load)
self.btnSave.clicked.connect(self.save)
self.btnAdvanced.toggled.connect(self.toggleAdvancedMode)
self.tblParameters.horizontalHeader().sectionDoubleClicked.connect(
self.fillParameterValues)
self.initWidgets()
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:27,代码来源:BatchPanel.py
示例6: updateProgressBar
def updateProgressBar(self, progressValue):
QgsApplication.processEvents()
if self.progressBar and not self.lockProgressBar:
self.lockProgressBar = True
self.progressBar.setValue(progressValue)
self.progressValue = progressValue
self.lockProgressBar = False
开发者ID:IGNF,项目名称:saisie_carhab,代码行数:7,代码来源:import_layer.py
示例7: testLayerRemovalBeforeRun
def testLayerRemovalBeforeRun(self):
"""test behavior when layer is removed before task begins"""
path = os.path.join(unitTestDataPath(), 'raster', 'with_color_table.tif')
raster_layer = QgsRasterLayer(path, "test")
self.assertTrue(raster_layer.isValid())
pipe = QgsRasterPipe()
self.assertTrue(pipe.set(raster_layer.dataProvider().clone()))
tmp = create_temp_filename('remove_layer.tif')
writer = QgsRasterFileWriter(tmp)
task = QgsRasterFileWriterTask(writer, pipe, 100, 100, raster_layer.extent(), raster_layer.crs())
task.writeComplete.connect(self.onSuccess)
task.errorOccurred.connect(self.onFail)
# remove layer
raster_layer = None
QgsApplication.taskManager().addTask(task)
while not self.success and not self.fail:
QCoreApplication.processEvents()
# in this case will still get a positive result - since the pipe is cloned before the task
# begins the task is no longer dependent on the original layer
self.assertTrue(self.success)
self.assertFalse(self.fail)
self.assertTrue(os.path.exists(tmp))
开发者ID:phborba,项目名称:QGIS,代码行数:29,代码来源:test_qgsrasterfilewritertask.py
示例8: init
def init(args=None, guienabled=True, configpath=None, sysexit=True):
"""
Create a new QGIS Qt application.
You should use this before creating any Qt widgets or QGIS objects for
your custom QGIS based application.
usage:
from wrappers import QGIS
QGIS.init()
args - args passed to the underlying QApplication.
guienabled - True by default will create a QApplication with a GUI. Pass
False if you wish to create no GUI based app, e.g a server app.
configpath - Custom config path QGIS will use to load settings.
sysexit - Call sys.exit on app exit. True by default.
"""
if not args:
args = []
if not configpath:
configpath = ''
app = QgsApplication(args, guienabled, configpath)
QgsApplication.initQgis()
return app
开发者ID:NathanW2,项目名称:ascii_qgis,代码行数:25,代码来源:QGIS.py
示例9: testResetScriptFolder
def testResetScriptFolder(self):
# if folder exist
defaultScriptFolder = ScriptUtils.defaultScriptsFolder()
folder = ScriptUtils.resetScriptFolder(defaultScriptFolder)
self.assertEqual(folder, defaultScriptFolder)
folder = ScriptUtils.resetScriptFolder('.')
self.assertEqual(folder, '.')
# if folder does not exist and not absolute
folder = ScriptUtils.resetScriptFolder('fake')
self.assertEqual(folder, None)
# if absolute but not relative to QgsApplication.qgisSettingsDirPath()
folder = os.path.join(tempfile.gettempdir(), 'fakePath')
newFolder = ScriptUtils.resetScriptFolder(folder)
self.assertEqual(newFolder, folder)
# if absolute profile but poiting somewhere
# reset the path as pointing to profile into the current settings
folder = QgsApplication.qgisSettingsDirPath()
# modify default profile changing absolute path pointing somewhere
paths = folder.split(os.sep)
paths[0] = '/'
paths[1] = 'fakelocation'
folder = os.path.join(*paths)
folder = ScriptUtils.resetScriptFolder(folder)
self.assertEqual(folder, QgsApplication.qgisSettingsDirPath())
开发者ID:manisandro,项目名称:QGIS,代码行数:27,代码来源:ScriptUtilsTest.py
示例10: getHttp
def getHttp(self, uri, params):
QgsApplication.setOverrideCursor(Qt.WaitCursor)
try:
rq = QUrl(uri)
q = QUrlQuery()
for (k, v) in params.items():
q.addQueryItem(k, v)
rq.setQuery(q)
req = QNetworkRequest(rq)
try:
reply = self.nominatim_networkAccessManager.blockingGet(req)
resource = reply.content().data().decode('utf8')
r = json.loads(resource)
if (isinstance(r, list)):
self.populateTable(r)
else:
self.populateTable([r])
except:
self.tableResult.clearContents()
finally:
QgsApplication.restoreOverrideCursor()
开发者ID:xcaeag,项目名称:Nominatim-Qgis-Plugin,代码行数:25,代码来源:nominatim_dlg.py
示例11: grassPath
def grassPath():
if not isWindows() and not isMac():
return ''
folder = ProcessingConfig.getSetting(Grass7Utils.GRASS_FOLDER) or ''
if not os.path.exists(folder):
folder = None
if folder is None:
if isWindows():
if "OSGEO4W_ROOT" in os.environ:
testfolder = os.path.join(unicode(os.environ['OSGEO4W_ROOT']), "apps")
else:
testfolder = unicode(QgsApplication.prefixPath())
testfolder = os.path.join(testfolder, 'grass')
if os.path.isdir(testfolder):
for subfolder in os.listdir(testfolder):
if subfolder.startswith('grass-7'):
folder = os.path.join(testfolder, subfolder)
fn = os.path.join(folder, "etc", "VERSIONNUMBER")
if not os.path.isfile(fn):
continue
f = open(fn, "r")
Grass7Utils.version = f.read().split(' ')[0]
f.close()
major, minor, patch = Grass7Utils.version.split('.')
Grass7Utils.command = "grass{}{}".format(major, minor)
break
else:
folder = os.path.join(unicode(QgsApplication.prefixPath()), 'grass7')
if not os.path.isdir(folder):
folder = '/Applications/GRASS-7.0.app/Contents/MacOS'
return folder or ''
开发者ID:radosuav,项目名称:ESA_Processing,代码行数:35,代码来源:Grass7Utils.py
示例12: progress_callback
def progress_callback(self, current_value, maximum_value, message=None):
"""GUI based callback implementation for showing progress.
:param current_value: Current progress.
:type current_value: int
:param maximum_value: Maximum range (point at which task is complete.
:type maximum_value: int
:param message: Optional message dictionary to containing content
we can display to the user. See safe.definitions.analysis_steps
for an example of the expected format
:type message: dict
"""
report = m.Message()
report.add(LOGO_ELEMENT)
report.add(m.Heading(
tr('Analysis status'), **INFO_STYLE))
if message is not None:
report.add(m.ImportantText(message['name']))
report.add(m.Paragraph(message['description']))
report.add(self.impact_function.performance_log_message())
send_static_message(self, report)
self.progress_bar.setMaximum(maximum_value)
self.progress_bar.setValue(current_value)
QgsApplication.processEvents()
开发者ID:inasafe,项目名称:inasafe,代码行数:26,代码来源:step_fc90_analysis.py
示例13: qgis_app
def qgis_app():
"""
Start QGIS application to test against. Based on code from Inasafe plugin.
:return: Reference to QGIS application, canvas and parent widget.
:rtype:(QgsApplication, QWidget, QgsMapCanvas)
"""
global QGIS_APP
if QGIS_APP is None:
gui_flag = True
QCoreApplication.setOrganizationName('QGIS')
QCoreApplication.setOrganizationDomain('qgis.org')
QCoreApplication.setApplicationName('STDM_Testing')
QGIS_APP = QgsApplication(sys.argv, gui_flag)
QGIS_APP.initQgis()
global PARENT
if PARENT is None:
PARENT = QWidget()
global CANVAS
if CANVAS is None:
CANVAS = QgsMapCanvas(PARENT)
CANVAS.resize(QSize(400, 400))
return QGIS_APP, CANVAS, PARENT
开发者ID:gltn,项目名称:stdm,代码行数:28,代码来源:utils.py
示例14: __init__
def __init__(self, iface):
Plugin.__init__(self, iface, "PointsInPolygons")
userPluginPath = QtCore.QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + '/python/plugins/points_in_polygons'
systemPluginPath = QgsApplication.prefixPath() + '/python/plugins/points_in_polygons'
overrideLocale = QtCore.QSettings().value('locale/overrideFlag', False, type=bool)
if not overrideLocale:
localeFullName = QtCore.QLocale.system().name()[:2]
else:
localeFullName = QtCore.QSettings().value("locale/userLocale", "")
if QtCore.QFileInfo(userPluginPath).exists():
translationPath = userPluginPath + '/i18n/pointsinpolygons_' + localeFullName + '.qm'
self.pluginPath = userPluginPath
else:
translationPath = systemPluginPath + '/i18n/pointsinpolygons_' + localeFullName + '.qm'
self.pluginPath = systemPluginPath
self.localePath = translationPath
if QtCore.QFileInfo(self.localePath).exists():
self.translator = QtCore.QTranslator()
self.translator.load(self.localePath)
QgsApplication.installTranslator(self.translator)
self.pointLayerName = ""
self.polygonLayerName = ""
self.fieldName = ""
开发者ID:nextgis,项目名称:qgis.points_in_polygons,代码行数:28,代码来源:plugin.py
示例15: init
def init(self, logo, title):
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication, QFont, QIcon
from PyQt4.QtCore import QLocale, QTranslator
try:
import PyQt4.QtSql
except ImportError:
pass
self.app = QgsApplication(self.sysargv, True)
import roam.roam_style
self.app.setStyleSheet(roam.roam_style.appstyle)
QgsApplication.setPrefixPath(self.prefixpath, True)
QgsApplication.initQgis()
locale = QLocale.system().name()
self.translationFile = os.path.join(self.i18npath, '{0}.qm'.format(locale))
translator = QTranslator()
translator.load(self.translationFile, "i18n")
self.app.installTranslator(translator)
QApplication.setStyle("Plastique")
QApplication.setFont(QFont('Segoe UI'))
QApplication.setWindowIcon(QIcon(logo))
QApplication.setApplicationName(title)
import roam.editorwidgets.core
roam.editorwidgets.core.registerallwidgets()
return self
开发者ID:HeatherHillers,项目名称:RoamMac,代码行数:29,代码来源:environ.py
示例16: execute
def execute(self):
settings = QgsSettings()
lastDir = settings.value('Processing/lastScriptsDir', '')
filenames, selected_filter = QFileDialog.getOpenFileNames(self.toolbox,
self.tr('Script files', 'AddScriptFromFileAction'), lastDir,
self.tr('Script files (*.py *.PY)', 'AddScriptFromFileAction'))
if filenames:
validAlgs = 0
wrongAlgs = []
for filename in filenames:
try:
settings.setValue('Processing/lastScriptsDir',
QFileInfo(filename).absoluteDir().absolutePath())
script = ScriptAlgorithm(filename)
destFilename = os.path.join(ScriptUtils.scriptsFolders()[0], os.path.basename(filename))
with open(destFilename, 'w') as f:
f.write(script.script)
validAlgs += 1
except WrongScriptException:
wrongAlgs.append(os.path.basename(filename))
if validAlgs:
QgsApplication.processingRegistry().providerById('script').refreshAlgorithms()
if wrongAlgs:
QMessageBox.warning(self.toolbox,
self.tr('Error reading scripts', 'AddScriptFromFileAction'),
self.tr('The following files do not contain a valid script:\n-', 'AddScriptFromFileAction') +
"\n-".join(wrongAlgs))
开发者ID:nirvn,项目名称:QGIS,代码行数:27,代码来源:AddScriptFromFileAction.py
示例17: test_validate_pki_bundle
def test_validate_pki_bundle(self):
"""Text the pki bundle validation"""
# Valid bundle:
bundle = self.mkPEMBundle('fra_cert.pem', 'fra_key.pem', 'password', 'chain_subissuer-issuer-root.pem')
# Test valid bundle with intermediates and without trusted root
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle), ['The root certificate of the certificate chain is self-signed, and untrusted'])
# Test valid without intermediates
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, False), ['The issuer certificate of a locally looked up certificate could not be found', 'No certificates could be verified'])
# Test valid with intermediates and trusted root
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, True, True), [])
# Wrong chain
bundle = self.mkPEMBundle('fra_cert.pem', 'fra_key.pem', 'password', 'chain_issuer2-root2.pem')
# Test invalid bundle with intermediates and without trusted root
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle), ['The issuer certificate of a locally looked up certificate could not be found', 'No certificates could be verified'])
# Test valid without intermediates
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, False), ['The issuer certificate of a locally looked up certificate could not be found', 'No certificates could be verified'])
# Test valid with intermediates and trusted root
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, True, True), ['The issuer certificate of a locally looked up certificate could not be found', 'No certificates could be verified'])
# Wrong key
bundle = self.mkPEMBundle('fra_cert.pem', 'ptolemy_key.pem', 'password', 'chain_subissuer-issuer-root.pem')
# Test invalid bundle with intermediates and without trusted root
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle), ['The root certificate of the certificate chain is self-signed, and untrusted', 'Private key does not match client certificate public key.'])
# Test invalid without intermediates
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, False), ['The issuer certificate of a locally looked up certificate could not be found', 'No certificates could be verified', 'Private key does not match client certificate public key.'])
# Test invalid with intermediates and trusted root
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, True, True), ['Private key does not match client certificate public key.'])
# Expired root CA
bundle = self.mkPEMBundle('piri_cert.pem', 'piri_key.pem', 'password', 'chain_issuer3-root3-EXPIRED.pem')
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle), ['The root certificate of the certificate chain is self-signed, and untrusted', 'The certificate has expired'])
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, False), ['The issuer certificate of a locally looked up certificate could not be found', 'No certificates could be verified'])
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, True, True), ['The root certificate of the certificate chain is self-signed, and untrusted', 'The certificate has expired'])
# Expired intermediate CA
bundle = self.mkPEMBundle('marinus_cert-EXPIRED.pem', 'marinus_key_w-pass.pem', 'password', 'chain_issuer2-root2.pem')
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle), ['The root certificate of the certificate chain is self-signed, and untrusted', 'The certificate has expired'])
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, False), ['The issuer certificate of a locally looked up certificate could not be found', 'No certificates could be verified'])
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, True, True), ['The certificate has expired'])
# Expired client cert
bundle = self.mkPEMBundle('henricus_cert.pem', 'henricus_key_w-pass.pem', 'password', 'chain_issuer4-EXPIRED-root2.pem')
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle), ['The root certificate of the certificate chain is self-signed, and untrusted', 'The certificate has expired'])
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, False), ['The issuer certificate of a locally looked up certificate could not be found', 'No certificates could be verified'])
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, True, True), ['The certificate has expired'])
# Untrusted root, positive test before untrust is applied
bundle = self.mkPEMBundle('nicholas_cert.pem', 'nicholas_key.pem', 'password', 'chain_issuer2-root2.pem')
# Test valid with intermediates and trusted root
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, True, True), [])
# Untrust this root
root2 = QgsAuthCertUtils.certFromFile(PKIDATA + '/' + 'root2_ca_cert.pem')
QgsApplication.authManager().storeCertAuthority(root2)
self.assertTrue(QgsApplication.authManager().storeCertTrustPolicy(root2, QgsAuthCertUtils.Untrusted))
QgsApplication.authManager().rebuildCaCertsCache()
# Test valid with intermediates and untrusted root
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(bundle, True, True), ['The issuer certificate of a locally looked up certificate could not be found'])
开发者ID:anitagraser,项目名称:QGIS,代码行数:60,代码来源:test_qgsauthsystem.py
示例18: testOwnership
def testOwnership(self):
"""
Test that registered color schemes do not require that a reference to them is kept.
They should be parented to the registry (on transfer) and even if there's no reference
to the registry around (see the `del` below) this childship should continue to exist.
"""
class TestColorScheme(QgsColorScheme):
def schemeName(self):
return "TestScheme"
def fetchColors(self, context, baseColors):
return None
def clone(self):
return TestColorScheme()
def flags(self):
return 1
reg = QgsApplication.instance().colorSchemeRegistry()
reg.addColorScheme(TestColorScheme())
del reg
reg = QgsApplication.instance().colorSchemeRegistry()
self.assertIn('TestScheme', [scheme.schemeName() for scheme in reg.schemes()])
开发者ID:pblottiere,项目名称:QGIS,代码行数:27,代码来源:test_qgscolorschemeregistry.py
示例19: getGroupIcon
def getGroupIcon(group):
if group == ProcessingConfig.tr('General'):
return QgsApplication.getThemeIcon("/processingAlgorithm.svg")
if group in ProcessingConfig.settingIcons:
return ProcessingConfig.settingIcons[group]
else:
return QgsApplication.getThemeIcon("/processingAlgorithm.svg")
开发者ID:mach0,项目名称:QGIS,代码行数:7,代码来源:ProcessingConfig.py
示例20: otbPath
def otbPath():
folder = ProcessingConfig.getSetting(OTBUtils.OTB_FOLDER)
if folder is None:
folder = ''
# Try to configure the path automatically
if isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()),
'bin')
if os.path.exists(os.path.join(testfolder, 'otbcli')):
folder = testfolder
else:
testfolder = '/usr/local/bin'
if os.path.exists(os.path.join(testfolder, 'otbcli')):
folder = testfolder
elif isWindows():
testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
testfolder = os.path.dirname(testfolder)
testfolder = os.path.join(testfolder, 'bin')
path = os.path.join(testfolder, 'otbcli.bat')
if os.path.exists(path):
folder = testfolder
else:
testfolder = '/usr/bin'
if os.path.exists(os.path.join(testfolder, 'otbcli')):
folder = testfolder
return folder
开发者ID:AnAvidDeveloper,项目名称:QGIS,代码行数:27,代码来源:OTBUtils.py
注:本文中的qgis.core.QgsApplication类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论