Skip to content

Commit

Permalink
GUI improvements, fix handling of QGIS directory updates and new butt…
Browse files Browse the repository at this point in the history
…on for reloading the QGIS directory (#149)

* Show the QGIS online directory repositories with an underline

* Testing

* Fix pep8 issues

* Redo some overwritten changes

* Some cleaning

* More cleaning up

* Remove pathlib comment

* metadata.txt update
  • Loading branch information
havatv authored Aug 3, 2020
1 parent c89727d commit 5bdf894
Show file tree
Hide file tree
Showing 19 changed files with 243 additions and 218 deletions.
2 changes: 2 additions & 0 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ deprecated=False
icon=resources/icon.png
changelog=
0.15.2 - GUI improvements (#138, #139, #140, #141)
- Add button for reloading the QGIS directory of approved resources (#145)
- Fix bug in the handling of QGIS directory updates (#146)
0.15.1 - Fix incorrect handling of searchPathsForSVG setting (#135)
- Handle XML parsing exceptions for QML files
0.15.0 - Support expressions (#130). Switch to Python pathlib.
Expand Down
85 changes: 42 additions & 43 deletions resource_sharing/collection_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# coding=utf-8
import hashlib
# Use pathlib instead of os.path
from pathlib import Path
import shutil
import logging
Expand Down Expand Up @@ -95,57 +94,57 @@ def get_html(self, collection_id):
html = ''
resource_types = 0
if 'svg' in config.COLLECTIONS[collection_id].keys():
html = html + str(config.COLLECTIONS[collection_id]['svg']) + ' SVG'
if config.COLLECTIONS[collection_id]['svg'] > 1:
html = html + 's'
resource_types = resource_types + 1
html = html + str(config.COLLECTIONS[collection_id]['svg']) + ' SVG'
if config.COLLECTIONS[collection_id]['svg'] > 1:
html = html + 's'
resource_types = resource_types + 1
if 'style' in config.COLLECTIONS[collection_id].keys():
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['style']) + ' Layer style (QML) file'
if config.COLLECTIONS[collection_id]['style'] > 1:
html = html + 's'
resource_types = resource_types + 1
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['style']) + ' Layer style (QML) file'
if config.COLLECTIONS[collection_id]['style'] > 1:
html = html + 's'
resource_types = resource_types + 1
if 'symbol' in config.COLLECTIONS[collection_id].keys():
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['symbol']) + ' Symbol (XML) file'
if config.COLLECTIONS[collection_id]['symbol'] > 1:
html = html + 's'
resource_types = resource_types + 1
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['symbol']) + ' Symbol (XML) file'
if config.COLLECTIONS[collection_id]['symbol'] > 1:
html = html + 's'
resource_types = resource_types + 1
if 'models' in config.COLLECTIONS[collection_id].keys():
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['models']) + ' Processing model'
if config.COLLECTIONS[collection_id]['models'] > 1:
html = html + 's'
resource_types = resource_types + 1
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['models']) + ' Processing model'
if config.COLLECTIONS[collection_id]['models'] > 1:
html = html + 's'
resource_types = resource_types + 1
if 'expressions' in config.COLLECTIONS[collection_id].keys():
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['expressions']) + ' Expression (JSON) file'
if config.COLLECTIONS[collection_id]['expressions'] > 1:
html = html + 's'
resource_types = resource_types + 1
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['expressions']) + ' Expression (JSON) file'
if config.COLLECTIONS[collection_id]['expressions'] > 1:
html = html + 's'
resource_types = resource_types + 1
if 'processing' in config.COLLECTIONS[collection_id].keys():
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['processing']) + ' Processing script'
if config.COLLECTIONS[collection_id]['processing'] > 1:
html = html + 's'
resource_types = resource_types + 1
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['processing']) + ' Processing script'
if config.COLLECTIONS[collection_id]['processing'] > 1:
html = html + 's'
resource_types = resource_types + 1
if 'rscripts' in config.COLLECTIONS[collection_id].keys():
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['rscripts']) + ' R script'
if config.COLLECTIONS[collection_id]['rscripts'] > 1:
html = html + 's'
resource_types = resource_types + 1
if resource_types > 0:
html = html + ', '
html = html + str(config.COLLECTIONS[collection_id]['rscripts']) + ' R script'
if config.COLLECTIONS[collection_id]['rscripts'] > 1:
html = html + 's'
resource_types = resource_types + 1
html = html + '.<br><i>Reinstall</i> to update'
if resource_types == 0:
html = '<i>No standard resources found</i>.'
html = '<i>No standard resources found</i>.'
if config.COLLECTIONS[collection_id]['status'] != COLLECTION_INSTALLED_STATUS:
html = '<i>Unknown before installation</i>'
html = '<i>Unknown before installation</i>'

config.COLLECTIONS[collection_id]['resources_html'] = html
context = {
Expand Down
Loading

0 comments on commit 5bdf894

Please sign in to comment.