mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[processing] remove unused files
This commit is contained in:
parent
0059b2b692
commit
ee8435a789
@ -1,118 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
help.py
|
||||
---------------------
|
||||
Date : March 2013
|
||||
Copyright : (C) 2013 by Victor Olaya
|
||||
Email : volayaf at gmail dot com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'March 2013'
|
||||
__copyright__ = '(C) 2013, Victor Olaya'
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
import codecs
|
||||
|
||||
from qgis.core import (QgsApplication,
|
||||
QgsProcessingParameterDefinition)
|
||||
from processing.core.parameters import ParameterMultipleInput, ParameterTableField, ParameterVector, ParameterSelection
|
||||
from processing.tools.system import mkdir
|
||||
|
||||
|
||||
def baseHelpForAlgorithm(alg, folder):
|
||||
baseDir = os.path.join(folder, alg.provider().id().lower())
|
||||
mkdir(baseDir)
|
||||
|
||||
groupName = alg.group().lower()
|
||||
groupName = groupName.replace('[', '').replace(']', '').replace(' - ', '_')
|
||||
groupName = groupName.replace(' ', '_')
|
||||
cmdLineName = alg.id()
|
||||
algName = cmdLineName[cmdLineName.find(':') + 1:].lower()
|
||||
validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
|
||||
safeGroupName = ''.join(c for c in groupName if c in validChars)
|
||||
safeAlgName = ''.join(c for c in algName if c in validChars)
|
||||
|
||||
dirName = os.path.join(baseDir, safeGroupName)
|
||||
mkdir(dirName)
|
||||
filePath = os.path.join(dirName, safeAlgName + '.rst')
|
||||
|
||||
with codecs.open(filePath, 'w', encoding='utf-8') as f:
|
||||
f.write('{}\n'.format(alg.name()))
|
||||
f.write('{}\n\n'.format('=' * len(alg.name())))
|
||||
f.write('Description\n')
|
||||
f.write('-----------\n\n<put algorithm description here>\n\n')
|
||||
|
||||
# Algorithm parameters
|
||||
f.write('Parameters\n')
|
||||
f.write('----------\n\n')
|
||||
for p in alg.parameterDefinitions():
|
||||
if isinstance(p, (ParameterMultipleInput, ParameterTableField, ParameterVector)):
|
||||
f.write('``{}`` [{}: {}]\n'.format(p.description(), p.type(), p.dataType()))
|
||||
else:
|
||||
f.write('``{}`` [{}]\n'.format(p.description(), p.type()))
|
||||
|
||||
if hasattr(p, 'optional'):
|
||||
if p.flags() & QgsProcessingParameterDefinition.FlagOptional:
|
||||
f.write(' Optional.\n\n')
|
||||
|
||||
f.write(' <put parameter description here>\n\n')
|
||||
|
||||
if isinstance(p, ParameterSelection):
|
||||
f.write(' Options:\n\n')
|
||||
for count, opt in enumerate(p.options):
|
||||
f.write(' * {} --- {}\n'.format(count, opt))
|
||||
f.write('\n')
|
||||
|
||||
if hasattr(p, 'defaultValue'):
|
||||
f.write(' Default: *{}*\n\n'.format(p.defaultValue() if p.defaultValue() else '(not set)'))
|
||||
|
||||
# Algorithm outputs
|
||||
f.write('Outputs\n')
|
||||
f.write('-------\n\n')
|
||||
for o in alg.outputs:
|
||||
f.write('``{}`` [{}]\n'.format(o.description(), o.type()))
|
||||
f.write(' <put output description here>\n\n')
|
||||
|
||||
# Console usage
|
||||
f.write('Console usage\n')
|
||||
f.write('-------------\n')
|
||||
f.write('\n::\n\n')
|
||||
cmd = " processing.run('{}', ".format(alg.id())
|
||||
for p in alg.parameterDefinitions():
|
||||
cmd += '{}, '.format(p.name().lower().strip())
|
||||
|
||||
for o in alg.outputs:
|
||||
if not o.flags() & QgsProcessingParameterDefinition.FlagHidden:
|
||||
cmd += '{}, '.format(o.name().lower().strip())
|
||||
cmd = cmd[:-2] + ')\n\n'
|
||||
f.write(cmd)
|
||||
|
||||
f.write('See also\n')
|
||||
f.write('--------\n\n')
|
||||
|
||||
|
||||
def createBaseHelpFiles(folder):
|
||||
for provider in QgsApplication.processingRegistry().providers():
|
||||
if 'grass' in provider.id():
|
||||
continue
|
||||
|
||||
for alg in provider.algorithms():
|
||||
baseHelpForAlgorithm(alg, folder)
|
||||
|
||||
|
||||
def createAlgorithmHelp(algName, folder):
|
||||
alg = QgsApplication.processingRegistry().createAlgorithmById(algName)
|
||||
baseHelpForAlgorithm(alg, folder)
|
@ -1,83 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
classification.py
|
||||
---------------------
|
||||
Date : July 2015
|
||||
Copyright : (C) 2015 by Arnaud Morvan
|
||||
Email : arnaud dot morvan at camptocamp dot com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Arnaud Morvan'
|
||||
__date__ = 'July 2015'
|
||||
__copyright__ = '(C) 2015, Arnaud Morvan'
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
from qgis.core import QgsApplication
|
||||
from processing.core.Processing import Processing
|
||||
from processing.gui.AlgorithmClassification import (
|
||||
loadClassification, getClassificationEn)
|
||||
|
||||
|
||||
def updateTranslations():
|
||||
"""Update processing.algs.translations module.
|
||||
|
||||
Need QGIS python API on python path, can be run from QGIS console. Example:
|
||||
|
||||
from processing.tools.translation import updateTranslations
|
||||
updateTranslations()
|
||||
"""
|
||||
|
||||
loadClassification()
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), '../algs/translations.py'), 'w') as f:
|
||||
f.write('''# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Don't edit this file manually.
|
||||
Update it from QGIS console:
|
||||
|
||||
from processing.tools.translation import updateTranslations
|
||||
updateTranslations()
|
||||
"""
|
||||
|
||||
from qgis.PyQt.QtCore import QCoreApplication
|
||||
|
||||
def translationShadow():
|
||||
''')
|
||||
groups = {}
|
||||
for provider in QgsApplication.processingRegsitry().providers():
|
||||
f.write('''
|
||||
"""{}"""
|
||||
'''.format(provider.__class__.__name__))
|
||||
for alg in provider.algorithms():
|
||||
display_name = alg.name()
|
||||
f.write(" QCoreApplication.translate(\"{}\", \"{}\")\n"
|
||||
.format(alg.__class__.__name__,
|
||||
display_name.replace('"', '\\"')))
|
||||
if alg.group() not in groups:
|
||||
groups[alg.group()] = 'AlgorithmClassification'
|
||||
group, subgroup = getClassificationEn(alg)
|
||||
if group is not None and group not in groups:
|
||||
groups[group] = 'AlgorithmClassification'
|
||||
if subgroup is not None and subgroup not in groups:
|
||||
groups[subgroup] = 'AlgorithmClassification'
|
||||
|
||||
f.write('''
|
||||
"""Groups and subgroups"""
|
||||
''')
|
||||
for group, context in list(groups.items()):
|
||||
f.write(" QCoreApplication.translate(\"{}\", \"{}\")\n"
|
||||
.format(context,
|
||||
group.replace('"', '\\"')))
|
Loading…
x
Reference in New Issue
Block a user