Skip to content

Commit 000ac97

Browse files
committedMar 2, 2019
backport processing help support (from 2f431bc)
(cherry picked from commit 263f54c)
1 parent b4cf2fd commit 000ac97

File tree

7 files changed

+22
-336
lines changed

7 files changed

+22
-336
lines changed
 

‎python/plugins/processing/algs/help/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import codecs
2828
import yaml
2929
from qgis.core import QgsSettings, Qgis
30-
from qgis.PyQt.QtCore import QLocale
30+
from qgis.PyQt.QtCore import QLocale, QCoreApplication
3131

3232

3333
def loadShortHelp():
@@ -37,7 +37,11 @@ def loadShortHelp():
3737
if f.endswith("yaml"):
3838
filename = os.path.join(path, f)
3939
with codecs.open(filename, encoding='utf-8') as stream:
40-
h.update(yaml.load(stream))
40+
for k, v in yaml.load(stream).items():
41+
if v is None:
42+
continue
43+
h[k] = QCoreApplication.translate("{}Algorithm".format(f[:-5].upper()), v)
44+
4145
version = ".".join(Qgis.QGIS_VERSION.split(".")[0:2])
4246
overrideLocale = QgsSettings().value('locale/overrideFlag', False, bool)
4347
if not overrideLocale:
@@ -51,7 +55,9 @@ def replace(s):
5155
return s.replace("{qgisdocs}", "https://docs.qgis.org/%s/%s/docs" % (version, locale))
5256
else:
5357
return None
58+
5459
h = {k: replace(v) for k, v in list(h.items())}
60+
5561
return h
5662

5763

‎python/plugins/processing/algs/help/qgis.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ qgis:pointsalonglines: >
304304

305305
An optional start and end offset can be specified, which controls how far from the start and end of the geometry the points should be created.
306306

307-
qgis:pointsdisplacement:
307+
qgis:pointsdisplacement: >
308308
Offsets nearby point features by moving nearby points by a preset amount to minimize overlapping features.
309309

310310
qgis:pointslayerfromtable: >
@@ -314,7 +314,7 @@ qgis:pointslayerfromtable: >
314314

315315
The attributes table of the resulting layer will be the input table.
316316

317-
qgis:pointstopath:
317+
qgis:pointstopath: >
318318
Converts a point layer to a line layer, by joining points in a defined order.
319319

320320
Points can be grouped by a field to output individual line features per group.

‎scripts/create_new_ts.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎scripts/integrate_function_help.pl

Lines changed: 0 additions & 148 deletions
This file was deleted.

‎scripts/processing2cpp.pl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
###########################################################################
1616

1717
use XML::Simple;
18+
use YAML::XS qw/LoadFile/;
1819
use Data::Dumper;
1920

2021
die "usage: $0 dest.cpp\n" unless @ARGV==1;
@@ -79,7 +80,16 @@
7980
$strings{"SAGAAlgorithm"}{$desc} = 1;
8081
}
8182

82-
for my $f ( ("python/plugins/processing/gui/algclasssification.txt", "python/plugins/processing/gui/algnames.txt") ) {
83+
for my $f (<python/plugins/processing/algs/help/*.yaml>) {
84+
my ($base) = $f =~ /.*\/(.*)\.yaml$/;
85+
$base = uc $base;
86+
my $yaml = LoadFile($f);
87+
for my $k (keys %$yaml) {
88+
$strings{"${base}Algorithm"}{$yaml->{$k}} = 1;
89+
}
90+
}
91+
92+
for my $f ( ("python/plugins/processing/gui/algnames.txt") ) {
8393
open I, $f;
8494
while(<I>) {
8595
chop;

‎scripts/update_ts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ echo "TR_EXCLUDE = $(qmake -query QT_INSTALL_HEADERS)/*" >>qgis_ts.pro
177177
echo Updating translations
178178
$LUPDATE -no-obsolete -locations absolute -verbose qgis_ts.pro
179179

180-
perl -i.bak -ne 'print unless /^\s+<location.*qgs(expression|contexthelp)_texts\.cpp.*$/;' i18n/qgis_*.ts
180+
perl -i.bak -ne 'print unless /^\s+<location.*(qgs(expression|contexthelp)_texts|.*-i18n)\.cpp.*$/;' i18n/qgis_*.ts
181181

182182
if [ $action = push ]; then
183183
cp i18n/qgis_en.ts /tmp/qgis_en.ts-uploading

‎scripts/update_ts_files.sh

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.