File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import click
55from qgis .analysis import QgsNativeAlgorithms
66from qgis .core import QgsApplication
7- from xsdata .formats .dataclass .serializers import JsonSerializer , XmlSerializer
7+ from xsdata .formats .dataclass .serializers import (
8+ DictEncoder ,
9+ JsonSerializer ,
10+ XmlSerializer ,
11+ )
812from xsdata .formats .dataclass .serializers .config import SerializerConfig
913
1014from qgis_server_light .exporter .common import create_full_pg_service_conf
@@ -98,8 +102,8 @@ def export(
98102
99103@cli .command ("export-processes" )
100104def export_processes ():
101- serializer_config = SerializerConfig (indent = " " )
102105 registry = qgs .processingRegistry ()
106+ qgs .setTranslation ("en" )
103107 registry .addProvider (QgsNativeAlgorithms ())
104108 process = Process (
105109 algorithms = [
@@ -116,7 +120,7 @@ def export_processes():
116120 ]
117121 ]
118122 )
119- click .echo (JsonSerializer ( config = serializer_config ). render (process ))
123+ click .echo (DictEncoder (). encode (process ))
120124
121125
122126if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -985,10 +985,12 @@ def collect(acc, pair):
985985 )
986986 acc .append ((our_scope_name , list_as_text ))
987987 else :
988- acc .append ((
989- our_scope_name ,
990- project .readEntry (qgis_scope_name , key )[0 ],
991- ))
988+ acc .append (
989+ (
990+ our_scope_name ,
991+ project .readEntry (qgis_scope_name , key )[0 ],
992+ )
993+ )
992994
993995 return acc
994996
@@ -1136,7 +1138,8 @@ def algorithm_from_qgs_definition(alg: QgsProcessingAlgorithm) -> Algorithm:
11361138 id = alg .id (),
11371139 name = alg .name (),
11381140 display_name = alg .displayName (),
1139- help_string = alg .helpString (),
1141+ short_help_string = alg .shortHelpString (),
1142+ short_description = alg .shortDescription (),
11401143 )
11411144 for param in alg .parameterDefinitions ():
11421145 algorithm .parameters .append (parameter_from_qgs_definition (param ))
Original file line number Diff line number Diff line change @@ -789,7 +789,8 @@ class Algorithm:
789789 id : str = field (metadata = {"type" : "Element" })
790790 name : str = field (metadata = {"type" : "Element" })
791791 display_name : str = field (metadata = {"type" : "Element" })
792- help_string : str | None = field (default = None , metadata = {"type" : "Element" })
792+ short_help_string : str = field (metadata = {"type" : "Element" })
793+ short_description : str = field (metadata = {"type" : "Element" })
793794 parameters : list [Parameter ] = field (
794795 default_factory = list , metadata = {"type" : "Element" }
795796 )
@@ -802,3 +803,11 @@ class Process:
802803 algorithms : list [Algorithm ] = field (
803804 default_factory = list , metadata = {"type" : "Element" }
804805 )
806+
807+ def algorithm_by_id (self , algorithm_id : str ):
808+ for algorithm in self .algorithms :
809+ if algorithm .id == algorithm_id :
810+ return algorithm
811+ raise LookupError (
812+ f"Algorithm with { algorithm_id } was not found in { self .algorithms } "
813+ )
You can’t perform that action at this time.
0 commit comments