g3w-admin-processing 1.2.1b1.dev1__py3-none-any.whl → 2.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/METADATA +10 -5
  2. {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/RECORD +32 -28
  3. {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/WHEEL +1 -1
  4. qprocessing/api/views/models.py +19 -6
  5. qprocessing/api/views/upload.py +23 -2
  6. qprocessing/configs.py +43 -0
  7. qprocessing/receivers.py +3 -0
  8. qprocessing/run_celery.sh +11 -0
  9. qprocessing/static/qprocessing/js/components/DrawInputVectorFeatures.js +87 -74
  10. qprocessing/static/qprocessing/js/components/InputFieldChooser.js +179 -152
  11. qprocessing/static/qprocessing/js/components/InputPrjRasterLayer.js +179 -92
  12. qprocessing/static/qprocessing/js/components/InputPrjVectorLayer.js +242 -214
  13. qprocessing/static/qprocessing/js/components/ModelInput.js +141 -0
  14. qprocessing/static/qprocessing/js/components/ModelPanel.js +419 -327
  15. qprocessing/static/qprocessing/js/components/ModelResults.js +31 -16
  16. qprocessing/static/qprocessing/js/components/OutputFile.js +31 -32
  17. qprocessing/static/qprocessing/js/components/OutputRasterLayer.js +38 -35
  18. qprocessing/static/qprocessing/js/components/OutputVectorLayer.js +136 -82
  19. qprocessing/static/qprocessing/js/i18n/en.js +15 -29
  20. qprocessing/static/qprocessing/js/i18n/fr.js +17 -0
  21. qprocessing/static/qprocessing/js/i18n/index.js +2 -0
  22. qprocessing/static/qprocessing/js/i18n/it.js +13 -29
  23. qprocessing/static/qprocessing/js/plugin.js +113 -42
  24. qprocessing/static/qprocessing/js/vendors/jszip.min.js +13 -0
  25. qprocessing/static/qprocessing/js/vendors/shp.min.js +9 -0
  26. qprocessing/tasks.py +22 -4
  27. qprocessing/tests/test_algorithm.py +2 -1
  28. qprocessing/tests/test_api.py +1 -1
  29. qprocessing/tests/test_api_models.py +23 -3
  30. qprocessing/utils/formtypes.py +21 -3
  31. qprocessing/static/qprocessing/js/components/UploadVectorFile.js +0 -53
  32. {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/licenses/LICENSE +0 -0
  33. {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: g3w-admin-processing
3
- Version: 1.2.1b1.dev1
4
- Summary: G3W-ADMIN plugin for use the processing features of QGIS application-
3
+ Version: 2.0.1
4
+ Summary: G3W-ADMIN plugin for use the processing features of QGIS application
5
5
  Author-email: Gis3w snc <info@gis3w.it>
6
6
  License: Mozilla Public License 2.0 (MPL 2.0)
7
7
  Project-URL: Homepage, https://github.com/g3w-suite/g3w-admin-processing
@@ -17,13 +17,18 @@ Classifier: Topic :: Software Development :: Libraries
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: cryptography==3.4.8
20
- Provides-Extra: dev
20
+ Requires-Dist: django-bleach==2.0.0
21
21
  Dynamic: license-file
22
22
 
23
- # G3W-ADMIN-QPROCESSING v1.3.0-beta.0
23
+ # G3W-ADMIN-QPROCESSING
24
+
25
+ [![PyPI version](https://img.shields.io/pypi/v/g3w-admin-processing)](https://pypi.org/project/g3w-admin-processing/)
26
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/g3w-suite/g3w-admin-processing)
24
27
 
25
28
  A dedicated [QGIS Processing](https://docs.qgis.org/3.28/en/docs/training_manual/processing/index.html) module for G3W-SUITE framework:
26
29
 
30
+ ![QProcessing schema](doc/images/qprocessing_schema.png)
31
+
27
32
  1. upload a [`.model3`](https://docs.qgis.org/3.28/en/docs/user_manual/processing/modeler.html) file into G3W-ADMIN.
28
33
  2. get QGIS Processing tools available within G3W-CLIENT.
29
34
 
@@ -66,7 +71,7 @@ pip3 install git+https://github.com/g3w-suite/g3w-admin-processing.git@v1.0.0
66
71
  # Install module from local folder (git development)
67
72
  # pip3 install -e /g3w-admin/plugins/qprocessing
68
73
 
69
- # Install module from PyPi (not yet available)
74
+ # Install module from PyPI
70
75
  # pip3 install g3w-admin-processing
71
76
  ```
72
77
 
@@ -1,14 +1,15 @@
1
- g3w_admin_processing-1.2.1b1.dev1.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
1
+ g3w_admin_processing-2.0.1.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
2
2
  qprocessing/__init__.py,sha256=sb-_tyZHk9zphmjPPA9__cr8KLT2U3ZlcvrIRaVVnpM,182
3
3
  qprocessing/admin.py,sha256=IL2aJMzKeqkmJgscNQODOtZW85dKYm2R_W9QzFjaR2s,501
4
4
  qprocessing/apiurls.py,sha256=LwGzN2FH3y2SlYg02XL85mchNMasH1bsqfKq87AYHjE,2093
5
5
  qprocessing/apps.py,sha256=H7jxw_nSOjw-Y5F9W0aLTFqqLc0iPkEkhPnUY7OEinY,1229
6
- qprocessing/configs.py,sha256=a5MwXHm0MdPegq90JmvQNs2eZUVT4e9vUyY3dQ9xSi4,2721
6
+ qprocessing/configs.py,sha256=kgJAXyLevnhYsXvwRSr0ykk5WAGbdthxCsEoHR2SoiY,3477
7
7
  qprocessing/forms.py,sha256=jLFNa6Jom5E-agdH0Q1A3KlwBZ-p-0LRnnk9L8zs6VA,4791
8
8
  qprocessing/models.py,sha256=Pm7yZUORuY4KvHCn_gQ35Y_DcukHQeNWZtIW-31IgY4,5415
9
- qprocessing/receivers.py,sha256=O-yFWf7bt0Y-oZ0ZQOc4HZGLZc9xI3LhRHibj-4YQiY,3879
9
+ qprocessing/receivers.py,sha256=LLmhwopIAqh-0ehwkNs2CthOg_pS6CsPBFnNuiTKiP0,4073
10
+ qprocessing/run_celery.sh,sha256=Y7_BnOKNCSuzGL9PTE2-m7RttFhj20fC_2BRHmAHcmM,271
10
11
  qprocessing/sitetrees.py,sha256=tvF8sGaVxFeU8X4QKYDcJf2IQvGe4GepSdwRB4igxjo,1526
11
- qprocessing/tasks.py,sha256=vMaHHMrtvD7ACJkeliLtq4G5NltKthLyPRh5OLRYEQA,3836
12
+ qprocessing/tasks.py,sha256=OU0F8Q5-MBnQvUTe6eSlrzEgTRyl-A96N0CSMdvpyGo,4338
12
13
  qprocessing/urls.py,sha256=OipyViCs4r1x42Q2DR8GFw2ewUbl0DWaixFHvYVxjK0,1218
13
14
  qprocessing/views.py,sha256=AhbexXzZhBi6E_uY-XEl2hvTV8Cgtf7z9DskJpXp_0Q,3338
14
15
  qprocessing/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -16,35 +17,38 @@ qprocessing/api/permissions.py,sha256=6xNsPcs4HB1sb6AAMsFBM635IHfZZPQ_PVGyfL6eRh
16
17
  qprocessing/api/views/__init__.py,sha256=-u2DXLQCBMunag8NZ74-lJnEO2qvwFAKm78353kc36k,88
17
18
  qprocessing/api/views/actions.py,sha256=qfm8H98xDmIKjLzBBORrKppqT4WGZ9_QJVJ7zpY0IqY,2726
18
19
  qprocessing/api/views/admin.py,sha256=eLECD0KfDXSHApqDAaL2fGsTMnvLyvTdlC3BlaugZBo,2672
19
- qprocessing/api/views/models.py,sha256=RBrjo0fsKyftHVG1CkDs5f_16CN9b6EcoZj2kf_d7jA,6859
20
- qprocessing/api/views/upload.py,sha256=_0BuT5AZakRgqQCxB768KcVxrrHQO4T2QoKiqKVOfZ4,5933
20
+ qprocessing/api/views/models.py,sha256=mZaSKDrAIoLTIHx3Q9mOLU6gVQXhdRH4vPEuh78E2O0,7394
21
+ qprocessing/api/views/upload.py,sha256=d5Y-48D5GZoX_0QcGNgvtJwVUW1Vt4SzL1CUyxH-A6Q,6640
21
22
  qprocessing/migrations/0001_initial.py,sha256=-sNbeLlJH6e8Zc4vPD2DXKPZTZc1rVVHcOxuj6tzqgQ,777
22
23
  qprocessing/migrations/0002_auto_20230615_1609.py,sha256=9sgx4s4XObhhqmadghVpe2u9zctcYOzHsayZS8COi5A,712
23
24
  qprocessing/migrations/0003_qprocessinginputupload.py,sha256=5TwNTN7ozzcnRqrtDptpc2N6qajpwApZQ28XpvvnQow,1213
24
25
  qprocessing/migrations/0004_auto_20230809_0920.py,sha256=t5iJs5htmO6uDpgFidYm5p5rb6kFQ1lwFl-SS6XtUkI,751
25
26
  qprocessing/migrations/0005_alter_qprocessinginputupload_user.py,sha256=cGn1sPJkvxqm7Twi5Fhvbdg79VBdV0KoMRjBgYVUzis,621
26
27
  qprocessing/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- qprocessing/static/qprocessing/js/plugin.js,sha256=tsRXqKDz2kkkKNvzNjuDKTdyBvAutbhuRC2zz3lhgtQ,3985
28
- qprocessing/static/qprocessing/js/components/DrawInputVectorFeatures.js,sha256=EOkXmGgMkt1ZmAs-zXCTh6jpDncE2s9pEMrXH6wF9pc,5795
29
- qprocessing/static/qprocessing/js/components/InputFieldChooser.js,sha256=EfFHBJysq4tYhCEaTICvvflawqio9ecgeOXcqZvsfvg,7012
30
- qprocessing/static/qprocessing/js/components/InputPrjRasterLayer.js,sha256=IZ4muSNubS54Md6lJ61jrqNvqgxzPeiEyct7Ygy5V7U,3233
31
- qprocessing/static/qprocessing/js/components/InputPrjVectorLayer.js,sha256=JP4nSkh_mSwO7oqWPwmdnJJ9jDrVHgNukgRPqgIlTDk,12994
32
- qprocessing/static/qprocessing/js/components/ModelPanel.js,sha256=2lNoydPUyAQe079Tc9AfWwGGKKDO9tzlC13m3kb3XOk,15282
33
- qprocessing/static/qprocessing/js/components/ModelResults.js,sha256=bBkGHOuGNmExhW19UIolHCuqwDQafLfSE1RDyjI9wNA,2257
34
- qprocessing/static/qprocessing/js/components/OutputFile.js,sha256=nmGSaaRB5pZ9hZH9Yjwmf4moYu9xGA1S1fEGhiKmHPo,1324
35
- qprocessing/static/qprocessing/js/components/OutputRasterLayer.js,sha256=vurChQj9NaA3qsmRU4-mAk8snurtBEk1wMAHHtKx-2k,1345
36
- qprocessing/static/qprocessing/js/components/OutputVectorLayer.js,sha256=b7ahUzHpCjLYXAZMjMlAeFL2J-IAIz0BvDJ5NdZ4fW8,3095
37
- qprocessing/static/qprocessing/js/components/UploadVectorFile.js,sha256=tK2YcxnuBcOqPNMGEtXxZyYxZDa3g-kzBSrbv-01egI,1501
38
- qprocessing/static/qprocessing/js/i18n/en.js,sha256=SgB7mS84wvyY9JjNA3wSOENInS8MYskICCb-QFjcufg,672
39
- qprocessing/static/qprocessing/js/i18n/index.js,sha256=umhf-nW4jqylvzghv-ZiYEL36vmr01xUXUN-V51Paz4,77
40
- qprocessing/static/qprocessing/js/i18n/it.js,sha256=7O-gWQDjB7vDdo_S6ZBMdCpw5dEU8v5QVIr8PRli5Cg,687
28
+ qprocessing/static/qprocessing/js/plugin.js,sha256=WJEg3UuK8rNjFA92eOGqHO2keK8qTLkwjglJKAu1LpM,6198
29
+ qprocessing/static/qprocessing/js/components/DrawInputVectorFeatures.js,sha256=tSuasSXSI-6AsqsSJJYTXxgexSP0qZPmWgLfYB6ZnU8,6293
30
+ qprocessing/static/qprocessing/js/components/InputFieldChooser.js,sha256=_MIxzCH0Daj1x6Ov4Ggmw-D9j8am59fc4ow8HFjmxAE,8451
31
+ qprocessing/static/qprocessing/js/components/InputPrjRasterLayer.js,sha256=K-CWs9Tntx8oI81xHjAogBqmnSvlrgi193WzGRuFWmo,6715
32
+ qprocessing/static/qprocessing/js/components/InputPrjVectorLayer.js,sha256=MLsfQymeAthw6dDzedK24YLSdrITPqiltOZaoeo9JsY,15331
33
+ qprocessing/static/qprocessing/js/components/ModelInput.js,sha256=Zzd3Xss_X-DFRPb4LMt4odoe3svfumAdvavHPsd9Wek,5320
34
+ qprocessing/static/qprocessing/js/components/ModelPanel.js,sha256=MVKEyYjOYjnDNQRg9hr9HhVFUyxoBqHop9QlehPMmIY,20694
35
+ qprocessing/static/qprocessing/js/components/ModelResults.js,sha256=7I4gBxu3attC-337wE7eKR8NJOGCUgsQpjdph_ePZvc,2799
36
+ qprocessing/static/qprocessing/js/components/OutputFile.js,sha256=JZbfnk2UH-d9wz4jV1geyxCb3YqJkin_khU-bXzIKuM,1407
37
+ qprocessing/static/qprocessing/js/components/OutputRasterLayer.js,sha256=C97puibaBpfQ480a8BMlFUKFplXbpWuplb1M7uc1zYs,1509
38
+ qprocessing/static/qprocessing/js/components/OutputVectorLayer.js,sha256=PZZ38NzPh8fKvA24AXnrO_aaFhjX8FJ11KhhenI426E,5046
39
+ qprocessing/static/qprocessing/js/i18n/en.js,sha256=3KUy-FAKFgHaq-dJ6GCVYBOgB5PpOdqS5eBe2kmYVoY,889
40
+ qprocessing/static/qprocessing/js/i18n/fr.js,sha256=R1Nxq3LzsPpJvSnMO1DVadoutOqbwxGiB660_F6iaN0,948
41
+ qprocessing/static/qprocessing/js/i18n/index.js,sha256=ILge7seUc2pv0qea18ghigtJ9YjU7I-VnSZW9gyxhTM,106
42
+ qprocessing/static/qprocessing/js/i18n/it.js,sha256=Rszi9CVYSnb29zmLZn-P_19Nf4jWinSs7jeCHQXOWiw,858
43
+ qprocessing/static/qprocessing/js/vendors/jszip.min.js,sha256=rMfkFFWoB2W1_Zx-4bgHim0WC7vKRVrq6FTeZclH1Z4,97630
44
+ qprocessing/static/qprocessing/js/vendors/shp.min.js,sha256=EC9OX5m1239XUKKNiKnm9j4vhxTO5S3xuLoVhU5wQWw,99925
41
45
  qprocessing/templates/qprocessing/project_form.html,sha256=nDMuqZzfcike8jDBdW2Gk7O8PgKLhPOHqOacLizZk3o,2227
42
46
  qprocessing/templates/qprocessing/projects_list.html,sha256=U20zIE1sE3KwKsYmo035PY_gCVQu7XuBPgq8jovcBx0,3406
43
47
  qprocessing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
48
  qprocessing/tests/base.py,sha256=fiwScwjamvnfX0yCDEN6Y6wfMGSLxVqUyepC0Ya5jEw,3524
45
- qprocessing/tests/test_algorithm.py,sha256=zkVRIKvJdqusI1-DccL6c5gifE0qKDKJjhU1t5gyyOk,2351
46
- qprocessing/tests/test_api.py,sha256=MMkuPdhSUn8k3lZrs87UAjJcrVO6vwCieAQ0BIhdNoE,7292
47
- qprocessing/tests/test_api_models.py,sha256=Blq5rAxXolItM7xZXILIOaOGa-52OlP6qgCLtRWyevE,16625
49
+ qprocessing/tests/test_algorithm.py,sha256=9QmyHjNizgO3LhDWJ2ZBmiQGXARTYTfGoFsaf-PN-yg,1945
50
+ qprocessing/tests/test_api.py,sha256=yX_6571Lttav1pW8zGe-SOdEHP1qB2Gr5w1tsymv2jA,7324
51
+ qprocessing/tests/test_api_models.py,sha256=u75sSoSsQzRl6N4PvnIQCE34rcHHxVljToTTSYRqhDo,17769
48
52
  qprocessing/tests/data/qprocessing_qprocessing.qgs,sha256=dv2evRB0bJ_5Lesx2CglaejCfqXF6fD6rtCmV_m4xZc,170889
49
53
  qprocessing/tests/data/qprocessing_qprocessing_attachments.zip,sha256=f4T60II8183Zu1LUB5v-vWUC2WhpnP3hzYV0NyXFvpA,1992
50
54
  qprocessing/tests/data/test_qgis_328.qgs,sha256=ZI_vXOyz-ZoN6PPiHAtmp9QCq1DdsTdTrkwtl96woKo,57056
@@ -73,8 +77,8 @@ qprocessing/tests/data/upload/shp_to_upload.zip,sha256=3j15VV21bKdae_87xAYPSL173
73
77
  qprocessing/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
78
  qprocessing/utils/data.py,sha256=d6-hVV205DEwCvuWD8WGRn1VS4qc7xZPYUgyJtlKMew,9263
75
79
  qprocessing/utils/exceptions.py,sha256=9IU5AP2Mcg2X7jeev2XxUI1Ls-OVdE6rxDcdRUSqdCQ,502
76
- qprocessing/utils/formtypes.py,sha256=sFOm4bVaB7_Plf8yUnYJUoKiV3vTvAnLiS8SBQV6m6s,17709
77
- g3w_admin_processing-1.2.1b1.dev1.dist-info/METADATA,sha256=lv3A-kFxLPepLcTdGaYoik365xwHgS44futMgsCCy0s,7804
78
- g3w_admin_processing-1.2.1b1.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
- g3w_admin_processing-1.2.1b1.dev1.dist-info/top_level.txt,sha256=Rsb41PTErHYxTtq0eKrzQOgGXleCvAM4U6MrOkRfrXk,12
80
- g3w_admin_processing-1.2.1b1.dev1.dist-info/RECORD,,
80
+ qprocessing/utils/formtypes.py,sha256=ETmiOs3QkccyossRw3k8w4EqYfF_aH4kZXn9wpo7XsI,18371
81
+ g3w_admin_processing-2.0.1.dist-info/METADATA,sha256=3shokml3FuldUneKvJ3p62bR3cJSQ8jzo9GPuOBfPrQ,8058
82
+ g3w_admin_processing-2.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
83
+ g3w_admin_processing-2.0.1.dist-info/top_level.txt,sha256=Rsb41PTErHYxTtq0eKrzQOgGXleCvAM4U6MrOkRfrXk,12
84
+ g3w_admin_processing-2.0.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (84.2.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -105,13 +105,18 @@ class QProcessingRunInfoTaskView(G3WAPIView):
105
105
  ret_status = 500
106
106
 
107
107
  task_model = TaskModel.objects.get(task_id=task_id)
108
- progress_info = task_model.progress_info
108
+ if hasattr(task_model, 'progress_count'):
109
+ progress_count = task_model.progress_count
110
+ else:
111
+ progress_count = task_model.progress_info[0]
109
112
 
110
- try:
111
- progress_percentage = int(
112
- 100 * progress_info[0] / task_model.total)
113
- except:
114
- progress_percentage = 0
113
+ progress_percentage = (
114
+ int(100 * progress_count / task_model.total)
115
+ if progress_count is not None and task_model.total else 0
116
+ )
117
+
118
+ if task_model.state.signal_name == 'complete':
119
+ progress_percentage = 100
115
120
 
116
121
  try:
117
122
  return JsonResponse({
@@ -209,6 +214,14 @@ class QProcessingDownLoadOutputView(G3WAPIView):
209
214
  content_type = 'application/geopackage+sqlite3'
210
215
  elif ext == 'sqlite':
211
216
  content_type = 'application / vnd.sqlite3'
217
+ elif ext in ['tiff', 'tif']:
218
+ content_type = 'image/tiff'
219
+ elif ext == 'png':
220
+ content_type = 'image/png'
221
+ elif ext in ['jpeg', 'jpg']:
222
+ content_type = 'image/jpeg'
223
+ elif ext == 'vrt':
224
+ content_type = 'application/xml'
212
225
  else:
213
226
  content_type = 'application/octet-stream'
214
227
 
@@ -21,7 +21,13 @@ from core.api.views import G3WAPIView
21
21
  from core.api.authentication import CsrfExemptSessionAuthentication
22
22
  from qprocessing.api.permissions import RunModelPermission
23
23
  from qprocessing.models import QProcessingInputUpload, QProcessingProject
24
- from qprocessing.utils.formtypes import MAPPING_QPROCESSINGTYPE_FORMTYPE, QProcessingFormTypeException
24
+ from qprocessing.utils.formtypes import (
25
+ MAPPING_QPROCESSINGTYPE_FORMTYPE,
26
+ QProcessingFormTypeException,
27
+ QgsProcessingParameterFeatureSource,
28
+ QgsProcessingParameterVectorLayer,
29
+ QgsProcessingParameterRasterLayer
30
+ )
25
31
 
26
32
  from zipfile import ZipFile
27
33
  import os
@@ -100,7 +106,22 @@ class QProcessingInputUploadView(G3WAPIView):
100
106
  # Validate by ext
101
107
  # -------------------------------------------------
102
108
  ext = os.path.splitext(f.name)[-1][1:].lower()
103
- formats = [frm['value'] for frm in settings.QPROCESSING_INPUT_UPLOAD_VECTOR_FORMATS]
109
+
110
+ # Get formats to check by input type
111
+ if self.qpm.inputs[kwargs['input_name']]['qprocessing_type'] in [
112
+ QgsProcessingParameterVectorLayer('').type(),
113
+ QgsProcessingParameterFeatureSource('').type()
114
+ ]:
115
+ formats = [frm['value'] for frm in settings.QPROCESSING_INPUT_UPLOAD_VECTOR_FORMATS]
116
+
117
+ elif self.qpm.inputs[kwargs['input_name']]['qprocessing_type'] in [
118
+ QgsProcessingParameterRasterLayer('').type()
119
+ ]:
120
+ formats = [frm['value'] for frm in settings.QPROCESSING_INPUT_UPLOAD_RASTER_FORMATS]
121
+
122
+ else:
123
+ formats = []
124
+
104
125
  if ext not in formats:
105
126
  raise QProcessingInputUploadValidationException(
106
127
  f"File type not allowed: {ext}. "
qprocessing/configs.py CHANGED
@@ -37,6 +37,16 @@ QPROCESSING_OUTPUT_HTML_FORMAT_DEFAULT = 'html'
37
37
  QPROCESSING_INPUT_SHP_EXTS = ['shp', 'shx', 'prj', 'dbf', 'shx']
38
38
 
39
39
  # Formats available for input upload
40
+ # ----------------------------------
41
+
42
+ # Max file size for upload input files (in bytes),
43
+ # if None no limit
44
+ QPROCESSING_INPUT_UPLOAD_MAX_FILE_SIZE = None
45
+
46
+ # I.e.:
47
+ #QPROCESSING_INPUT_UPLOAD_MAX_FILE_SIZE = 20 * 1024 * 1024 # 20 MB
48
+
49
+ # Vector formats
40
50
  QPROCESSING_INPUT_UPLOAD_VECTOR_FORMATS = [
41
51
  {
42
52
  'value': 'zip',
@@ -61,6 +71,35 @@ QPROCESSING_INPUT_UPLOAD_VECTOR_FORMATS = [
61
71
 
62
72
  ]
63
73
 
74
+ # Raster formats
75
+ QPROCESSING_INPUT_UPLOAD_RASTER_FORMATS = [
76
+ {
77
+ 'value': 'vrt',
78
+ 'key': 'VRT'
79
+ },
80
+ {
81
+ 'value': 'tiff',
82
+ 'key': 'TIFF'
83
+ },
84
+ {
85
+ 'value': 'tif',
86
+ 'key': 'TIF'
87
+ },
88
+ {
89
+ 'value': 'png',
90
+ 'key': 'PNG'
91
+ },
92
+ {
93
+ 'value': 'jpeg',
94
+ 'key': 'JPEG'
95
+ },
96
+ {
97
+ 'value': 'jpg',
98
+ 'key': 'JPG'
99
+ },
100
+
101
+ ]
102
+
64
103
 
65
104
  # For Processing form type: input/output
66
105
  QPROCESSING_OUTPUT_VECTOR_FORMATS = [
@@ -129,3 +168,7 @@ QPROCESSING_OUTPUT_RASTER_FORMATS = [
129
168
  QPROCESSING_CRYPTO_KEY = b'aAf72grwGaZYH9R7ZaGHgSSbtQVXPplXB4wpiMsKtJM='
130
169
 
131
170
 
171
+ # Time interval (in seconds) for check task info
172
+ QPROCESSING_TASK_INFO_INTERVAL = 5
173
+
174
+
qprocessing/receivers.py CHANGED
@@ -42,6 +42,8 @@ def set_initconfig_value(sender, **kwargs):
42
42
  'version': get_version('qprocessing'),
43
43
  'gid': f"{kwargs['projectType']}:{kwargs['project']}",
44
44
  'async': settings.QPROCESSING_ASYNC_RUN,
45
+ 'max_upload_file_size': settings.QPROCESSING_INPUT_UPLOAD_MAX_FILE_SIZE,
46
+ 'task_info_interval': settings.QPROCESSING_TASK_INFO_INTERVAL,
45
47
  'urls': {
46
48
  'run': f'/qprocessing{__BASE_RUN_MODEL_URL}',
47
49
  'taskinfo': f'/qprocessing{__BASE_TASK_INFO_URL}',
@@ -51,6 +53,7 @@ def set_initconfig_value(sender, **kwargs):
51
53
  'models': [{
52
54
  **QProcessingModel(str(qpp.model.file)).render2dict(),
53
55
  'id': qpp.pk,
56
+ 'note': qpp.note,
54
57
  'results': [],
55
58
  # TODO: move the following into render2dict? (converts [admin] model inputs into [client] form inputs)
56
59
  'inputs': [{
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+ # Run Celery worker for Qprocessing module
3
+
4
+ set -x
5
+
6
+ # run rabbimq/redis
7
+ # docker run -d --hostname my-rabbit -p 5672:5672 --name some-rabbit rabbitmq
8
+ # docker run --name some-redis -p 6379:6379 -d redis
9
+
10
+ # run celery
11
+ celery -A base worker -l info #-n wrk1@%h
@@ -1,65 +1,71 @@
1
- const { GUI } = g3wsdk.gui;
2
- const { tPlugin } = g3wsdk.core.i18n;
3
-
1
+ const GUI = g3w.app;
2
+ const _ = g3w.gettext;
4
3
  export default ({
5
4
 
6
5
  // language=html
7
6
  template: /* html */ `
8
7
  <div
9
- class = "qprocessing-draw-vector-features"
10
- style = "font-size: 1.3em;"
8
+ class = "qprocessing-draw-vector-features"
9
+ style = "font-size: 1.3em;"
10
+
11
11
  >
12
12
  <button
13
13
  class = "btn skin-background-color"
14
14
  style = "height: 100%; margin-right: 0 !important;"
15
15
  @click.stop.prevent = "toggled = !toggled"
16
+ v-t-tooltip:top.create = "'plugins.qprocessing.inputs.drawfeatures'"
16
17
  >
17
- <i :class="[g3wtemplate.getFontClass('pencil')]"></i>
18
+ <i class = "fas fa-pencil-alt"></i>
18
19
  </button>
19
20
  </div>
20
21
  `,
21
22
 
22
23
  name: "DrawInputVectorFeatures",
24
+
23
25
  props: {
24
- datatypes: {
25
- type: Array, //array of datatypes from input
26
- default: []
27
- },
28
- upload:{
29
- type: Boolean, //Boolean when file is upload ot not
30
- }
26
+ datatypes: { type: Array, default: [] }, // array of datatypes from input
27
+ upload: { type: Boolean } // Boolean when file is upload ot not
31
28
  },
29
+
32
30
  data() {
31
+ // Initialize drawing and upload state.
33
32
  return {
34
33
  toggled: false, //draw button toggled
35
34
  drawTool: {
36
- loading: this.upload,
35
+ loading: this.upload,
37
36
  disabled: true
38
37
  }
39
38
  }
40
39
  },
40
+
41
41
  methods: {
42
+
42
43
  /**
43
- * handle draw interaction flow
44
+ * Configure and activate the map drawing interaction.
44
45
  */
45
- setDrawInteraction(type=this.drawGeometryTypes[0]){
46
- GUI.getService('map').disableClickMapControls(true); // avoid click conflicts
46
+ setDrawInteraction(type = this.drawGeometryTypes[0]){
47
+ GUI.disableClickMapControls(true); // avoid click conflicts
47
48
  this.drawLayer.getSource().clear(); // clear previous features
48
- GUI.getService('map').getMap().removeInteraction(this.drawInteraction); // remove previous draw interaction
49
+ GUI.removeInteraction(this.drawInteraction); // remove previous draw interaction
49
50
  this.drawInteraction = new ol.interaction.Draw({ type, source: this.drawLayer.getSource() }); // create draw interaction
50
51
  this.drawInteraction.on('drawend', () => this.drawTool.disabled = false); // enable upload button on drawend
51
- GUI.getService('map').getMap().addInteraction(this.drawInteraction); // add interaction to Map
52
+ GUI.addInteraction(this.drawInteraction); // add interaction to Map
52
53
  },
54
+
55
+ // Clear drawn features and release the active map interaction.
53
56
  clear() {
54
57
  this.drawLayer.getSource().clear();
55
- GUI.getService('map').disableClickMapControls(false);
56
- GUI.getService('map').getMap().removeInteraction(this.drawInteraction);
58
+ GUI.disableClickMapControls(false);
59
+ GUI.removeInteraction(this.drawInteraction);
57
60
  GUI.closeUserMessage();
58
61
  },
62
+
59
63
  },
64
+
60
65
  watch: {
61
- //listen toggled button
62
- toggled(bool){
66
+
67
+ // Start or stop the drawing tool and its user prompt.
68
+ toggled(bool) {
63
69
  if (!bool) {
64
70
  this.clear();
65
71
  this.$emit('toggled-tool', !bool);
@@ -69,44 +75,44 @@ export default ({
69
75
  this.setDrawInteraction();
70
76
  //whow tool component
71
77
  GUI.showUserMessage({
72
- title: '', //@TODO add translation title
73
- type: 'tool',
74
- size: 'small',
78
+ title: 'plugins.qprocessing.inputs.drawfeatures', //@TODO add translation title
79
+ type: 'tool',
80
+ size: 'small',
75
81
  closable: false,
76
82
  hooks: {
77
83
  body: {
78
84
  template: /* html */`
79
- <div style="width: 100%; padding: 5px;" v-disabled="state.loading">
80
- <!-- NB: it makes use of built-in g3w-client directive: "v-select2" -->
81
- <select
82
- v-select2 = "'type'"
83
- :search = "false"
84
- ref = "select"
85
- style = "width: 100%">
86
- <option
87
- v-for = "type in types"
88
- :key = "type"
89
- :value = "type"
90
- v-t-plugin = "'qprocessing.draw_types.'+type"
91
- ></option>
92
- </select>
93
-
94
- <bar-loader :loading="state.loading"/>
95
-
96
- <button
97
- v-disabled="state.disabled"
98
- class="btn skin-background-color"
99
- @click.stop.prevent="uploadLayer(type)"
100
- style="margin: 3px; width: 100%">
101
- <i :class="[g3wtemplate.getFontClass('cloud-upload')]"></i>
102
- </button>
85
+ <div style = "width: 100%; padding: 5px;" v-disabled = "state.loading">
86
+ <x-select
87
+ :value = "type"
88
+ ref = "select"
89
+ @change = "type = $event.target.value"
90
+ style = "width: 100%">
91
+ <x-option
92
+ v-for = "type in types"
93
+ :key = "type"
94
+ :value = "type"
95
+ v-t-plugin = "'qprocessing.draw_types.'+type"
96
+ ></x-option>
97
+ </x-select>
98
+
99
+ <div v-if = "state.loading" class = "bar-loader"></div>
100
+
101
+ <button
102
+ v-disabled = "state.disabled"
103
+ class = "btn skin-background-color"
104
+ @click.stop.prevent = "uploadLayer(type)"
105
+ style = "margin: 3px; width: 100%"
106
+ >
107
+ <i class = "fas fa-cloud-upload-alt"></i>
108
+ </button>
103
109
 
104
110
  </div>`,
105
111
  data: () => {
106
112
  return {
107
113
  state: this.drawTool,
108
114
  types: this.drawGeometryTypes,
109
- type: this.drawGeometryTypes[0]
115
+ type: this.drawGeometryTypes[0]
110
116
  };
111
117
  },
112
118
  watch: {
@@ -115,21 +121,20 @@ export default ({
115
121
  * @listens type change of drawed geometry
116
122
  * @fires change-draw-type
117
123
  */
118
- 'type': (type) => {
119
- this.setDrawInteraction(type);
120
- },
124
+ 'type': type => this.setDrawInteraction(type),
121
125
 
122
126
  },
123
127
  methods: {
128
+ // Emit the drawn features as an uploadable layer.
124
129
  uploadLayer: async (type) => {
125
- const qprocessing = g3wsdk.core.plugin.PluginsRegistry.getPlugin('qprocessing');
126
- const features = this.drawLayer.getSource().getFeatures();
130
+ const qprocessing = GUI.getPlugin('qprocessing');
131
+ const features = this.drawLayer.getSource().getFeatures();
127
132
  await this.$nextTick();
128
133
  //emit event
129
134
  this.$emit('add-layer', {
130
135
  file: qprocessing.createGeoJSONFile({
131
136
  features,
132
- name: `${tPlugin('qprocessing.draw_filename')}(${tPlugin('qprocessing.draw_types.'+type)})`
137
+ name: `${_('plugins.qprocessing.draw_filename')}(${_('plugins.qprocessing.draw_types.' + type)})`
133
138
  }),
134
139
  features,
135
140
  type: 'draw'
@@ -141,40 +146,48 @@ export default ({
141
146
  });
142
147
  this.$emit('toggled-tool', !bool);
143
148
  },
144
- upload(bool){
145
- //listen upload status. Boolean
146
- this.drawTool.loading = bool;
149
+
150
+ // Prepare supported geometries and add the temporary layer to the map.
151
+ // Keep drawing controls synchronized with the upload state.
152
+ upload(bool) {
153
+ this.drawTool.loading = bool;
147
154
  this.drawTool.disabled = !bool;
148
155
  if (!bool) {
149
156
  this.clear();
150
157
  this.toggled = bool;
151
158
  }
152
- }
159
+ },
160
+
153
161
  },
154
- created() {
155
162
 
163
+ created() {
164
+ // Prepare supported geometries and add the temporary layer to the map.
156
165
  //set geometries type
157
166
  this.drawGeometryTypes = Object.entries({
158
- point: 'Point',
159
- line: 'LineString',
167
+ point: 'Point',
168
+ line: 'LineString',
160
169
  polygon: 'Polygon'
161
- }).reduce((accumulator, [type, olGeometry]) => {
162
- if (this.datatypes.find(datatype => datatype === 'anygeometry')){
163
- accumulator.push(olGeometry);
170
+ }).reduce((a, [ type, olGeometry ]) => {
171
+ // Remove the temporary layer and release drawing resources.
172
+ if (this.datatypes.find(dt => 'anygeometry' === dt)){
173
+ a.push(olGeometry);
164
174
  } else {
165
- this.datatypes.find(datatype => datatype === type) && accumulator.push(olGeometry)
175
+ this.datatypes.find(dt => type === dt) && a.push(olGeometry)
166
176
  }
167
- return accumulator;
177
+ return a;
168
178
  }, []);
169
179
 
170
180
  this.drawInteraction = null;
171
- this.drawLayer = new ol.layer.Vector({ source: new ol.source.Vector() });
172
- GUI.getService('map').getMap().addLayer(this.drawLayer);
181
+ this.drawLayer = new ol.layer.Vector({ source: new ol.source.Vector() });
182
+ GUI.getMap().addLayer(this.drawLayer);
173
183
  },
184
+
174
185
  beforeDestroy() {
186
+ // Remove the temporary layer and release drawing resources.
175
187
  this.clear();
176
- GUI.getService('map').getMap().removeLayer(this.drawLayer);
177
- this.drawLayer = null;
188
+ GUI.getMap().removeLayer(this.drawLayer);
189
+ this.drawLayer = null;
178
190
  this.drawInteraction = null;
179
- }
191
+ },
192
+
180
193
  });