Skip to content

Commit

Permalink
backport processing help support (from 2f431bc)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Mar 1, 2019
1 parent b10a5ec commit 263f54c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 336 deletions.
10 changes: 8 additions & 2 deletions python/plugins/processing/algs/help/__init__.py
Expand Up @@ -27,7 +27,7 @@
import codecs
import yaml
from qgis.core import QgsSettings, Qgis
from qgis.PyQt.QtCore import QLocale
from qgis.PyQt.QtCore import QLocale, QCoreApplication


def loadShortHelp():
Expand All @@ -37,7 +37,11 @@ def loadShortHelp():
if f.endswith("yaml"):
filename = os.path.join(path, f)
with codecs.open(filename, encoding='utf-8') as stream:
h.update(yaml.load(stream))
for k, v in yaml.load(stream).items():
if v is None:
continue
h[k] = QCoreApplication.translate("{}Algorithm".format(f[:-5].upper()), v)

version = ".".join(Qgis.QGIS_VERSION.split(".")[0:2])
overrideLocale = QgsSettings().value('locale/overrideFlag', False, bool)
if not overrideLocale:
Expand All @@ -51,7 +55,9 @@ def replace(s):
return s.replace("{qgisdocs}", "https://docs.qgis.org/%s/%s/docs" % (version, locale))
else:
return None

h = {k: replace(v) for k, v in list(h.items())}

return h


Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/help/qgis.yaml
Expand Up @@ -299,7 +299,7 @@ qgis:pointsalonglines: >

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.

qgis:pointsdisplacement:
qgis:pointsdisplacement: >
Offsets nearby point features by moving nearby points by a preset amount to minimize overlapping features.

qgis:pointslayerfromtable: >
Expand All @@ -309,7 +309,7 @@ qgis:pointslayerfromtable: >

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

qgis:pointstopath:
qgis:pointstopath: >
Converts a point layer to a line layer, by joining points in a defined order.

Points can be grouped by a field to output individual line features per group.
Expand Down
27 changes: 0 additions & 27 deletions scripts/create_new_ts.sh

This file was deleted.

148 changes: 0 additions & 148 deletions scripts/integrate_function_help.pl

This file was deleted.

12 changes: 11 additions & 1 deletion scripts/processing2cpp.pl
Expand Up @@ -15,6 +15,7 @@
###########################################################################

use XML::Simple;
use YAML::XS qw/LoadFile/;
use Data::Dumper;

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

for my $f ( ("python/plugins/processing/gui/algclasssification.txt", "python/plugins/processing/gui/algnames.txt") ) {
for my $f (<python/plugins/processing/algs/help/*.yaml>) {
my ($base) = $f =~ /.*\/(.*)\.yaml$/;
$base = uc $base;
my $yaml = LoadFile($f);
for my $k (keys %$yaml) {
$strings{"${base}Algorithm"}{$yaml->{$k}} = 1;
}
}

for my $f ( ("python/plugins/processing/gui/algnames.txt") ) {
open I, $f;
while(<I>) {
chop;
Expand Down
2 changes: 1 addition & 1 deletion scripts/update_ts.sh
Expand Up @@ -178,7 +178,7 @@ echo "TR_EXCLUDE = $(qmake -query QT_INSTALL_HEADERS)/*" >>qgis_ts.pro
echo Updating translations
$LUPDATE -no-obsolete -locations absolute -verbose qgis_ts.pro

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

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

0 comments on commit 263f54c

Please sign in to comment.