Skip to content

Commit

Permalink
Remove debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
havatv committed May 16, 2020
1 parent 75885f2 commit 69ecca1
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions resource_sharing/resource_handler/expression_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ def dir_name(self):
def install(self):
"""Add the expressions from this collection to QGIS settings.
"""
LOGGER.info("Installing expressions")
#return
# Skip installation if the directory does not exist
if not Path(self.resource_dir).exists():
return
Expand All @@ -65,27 +63,19 @@ def install(self):
settings.beginGroup(user_expressions_group())
for json_file in json_files:
namePrefix = json_file.stem + '_'
LOGGER.info("Installing expressions from " + str(json_file))

with open(json_file, 'rb') as expr_file:
expr_json = expr_file.read()
jsontext = json.loads(expr_json)

#QgsExpressionBuilderWidget loadExpressionsFromJson

expressions = jsontext['expressions']
for expr in expressions:
expr_name = namePrefix + expr['name']
LOGGER.info("Expr. name: " + expr_name)
expr_value =expr['expression']
LOGGER.info("Expr. expression: " + expr_value)
expr_help = expr['description']
LOGGER.info("Expr. description: " + expr_help)

settings.setValue(expr_name + '/expression', expr_value)
settings.setValue(expr_name + '/helpText', expr_help)
aftervalue = settings.value(expr_name + '/expression', '', type=unicode).strip()
LOGGER.info("after - expr: " + aftervalue)
valid += 1
settings.endGroup()
if valid >= 0:
Expand All @@ -94,9 +84,7 @@ def install(self):
def uninstall(self):
"""Remove the expressions in this collection from QGIS settings.
"""

# Remove from settings
LOGGER.info("Removing expressions")
# Skip removal if the directory does not exist
if not Path(self.resource_dir).exists():
return
Expand All @@ -113,16 +101,13 @@ def uninstall(self):
settings.beginGroup(user_expressions_group())
for json_file in json_files:
namePrefix = json_file.stem + '_'
LOGGER.info("Removing expressions from " + str(json_file))
with open(json_file, 'rb') as expr_file:
expr_json = expr_file.read()
jsontext = json.loads(expr_json)
expressions = jsontext['expressions']
for expr in expressions:
expr_name = namePrefix + expr['name']
LOGGER.info("Expr. name: " + expr_name)
if settings.contains(expr_name + '/expression'):
LOGGER.info("Exists - removing")
settings.remove(expr_name)
settings.endGroup()
# Remove files - nothing to remove
Expand Down

0 comments on commit 69ecca1

Please sign in to comment.