2016-01-08 21:31:41 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
***************************************************************************
|
|
|
|
__init__.py
|
|
|
|
---------------------
|
|
|
|
Date : May 2014
|
|
|
|
Copyright : (C) 2014 by Nathan Woodrow
|
|
|
|
Email : woodrow dot nathan at gmail dot com
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************
|
|
|
|
"""
|
2016-09-21 18:24:26 +02:00
|
|
|
from builtins import str
|
|
|
|
from builtins import object
|
2016-01-08 21:31:41 +01:00
|
|
|
|
|
|
|
__author__ = 'Nathan Woodrow'
|
|
|
|
__date__ = 'May 2014'
|
|
|
|
__copyright__ = '(C) 2014, Nathan Woodrow'
|
|
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
|
|
|
__revision__ = '$Format:%H$'
|
|
|
|
|
2016-05-11 21:18:54 +02:00
|
|
|
from qgis.PyQt.QtCore import QCoreApplication, NULL
|
2015-11-27 23:26:11 +01:00
|
|
|
|
2015-01-22 09:21:04 +10:00
|
|
|
import inspect
|
2014-11-29 18:37:23 +10:00
|
|
|
import string
|
2016-11-28 18:32:15 +10:00
|
|
|
import types
|
|
|
|
import functools
|
2014-05-19 21:40:26 +10:00
|
|
|
from qgis._core import *
|
2014-11-29 18:37:23 +10:00
|
|
|
|
2017-06-12 07:28:36 +10:00
|
|
|
|
2016-08-02 08:39:58 +10:00
|
|
|
# Boolean evaluation of QgsGeometry
|
|
|
|
|
|
|
|
|
|
|
|
def _geometryNonZero(self):
|
|
|
|
return not self.isEmpty()
|
2017-03-04 19:41:23 +01:00
|
|
|
|
|
|
|
|
2017-09-26 13:35:44 +02:00
|
|
|
def _isValid(self):
|
|
|
|
return self.isValid()
|
|
|
|
|
2017-09-28 11:50:30 +02:00
|
|
|
|
2016-08-02 08:39:58 +10:00
|
|
|
QgsGeometry.__nonzero__ = _geometryNonZero
|
|
|
|
QgsGeometry.__bool__ = _geometryNonZero
|
|
|
|
|
2017-09-26 13:35:44 +02:00
|
|
|
QgsDefaultValue.__bool__ = _isValid
|
|
|
|
|
2015-08-22 14:29:41 +02:00
|
|
|
|
2017-06-12 07:28:36 +10:00
|
|
|
def register_function(function, arg_count, group, usesgeometry=False,
|
|
|
|
referenced_columns=[QgsFeatureRequest.ALL_ATTRIBUTES], **kwargs):
|
2014-11-29 18:37:23 +10:00
|
|
|
"""
|
|
|
|
Register a Python function to be used as a expression function.
|
|
|
|
|
|
|
|
Functions should take (values, feature, parent) as args:
|
|
|
|
|
|
|
|
Example:
|
|
|
|
def myfunc(values, feature, parent):
|
|
|
|
pass
|
|
|
|
|
|
|
|
They can also shortcut naming feature and parent args by using *args
|
|
|
|
if they are not needed in the function.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
def myfunc(values, *args):
|
|
|
|
pass
|
|
|
|
|
|
|
|
Functions should return a value compatible with QVariant
|
|
|
|
|
|
|
|
Eval errors can be raised using parent.setEvalErrorString("Error message")
|
|
|
|
|
|
|
|
:param function:
|
|
|
|
:param arg_count:
|
|
|
|
:param group:
|
|
|
|
:param usesgeometry:
|
|
|
|
:return:
|
|
|
|
"""
|
2017-06-12 07:28:36 +10:00
|
|
|
|
2017-05-16 08:02:59 +02:00
|
|
|
class QgsPyExpressionFunction(QgsExpressionFunction):
|
2015-08-22 14:29:41 +02:00
|
|
|
|
2017-06-12 07:28:36 +10:00
|
|
|
def __init__(self, func, name, args, group, helptext='', usesGeometry=True,
|
|
|
|
referencedColumns=QgsFeatureRequest.ALL_ATTRIBUTES, expandargs=False):
|
2017-05-16 08:02:59 +02:00
|
|
|
QgsExpressionFunction.__init__(self, name, args, group, helptext)
|
2014-11-29 18:37:23 +10:00
|
|
|
self.function = func
|
2015-01-22 09:21:04 +10:00
|
|
|
self.expandargs = expandargs
|
2016-10-27 11:33:42 +02:00
|
|
|
self.uses_geometry = usesGeometry
|
|
|
|
self.referenced_columns = referencedColumns
|
2014-11-29 18:37:23 +10:00
|
|
|
|
2017-09-29 13:59:07 +02:00
|
|
|
def func(self, values, context, parent, node):
|
2016-08-06 20:47:55 +10:00
|
|
|
feature = None
|
|
|
|
if context:
|
|
|
|
feature = context.feature()
|
2017-05-05 15:00:50 +02:00
|
|
|
|
2014-11-29 18:37:23 +10:00
|
|
|
try:
|
2015-01-22 09:21:04 +10:00
|
|
|
if self.expandargs:
|
|
|
|
values.append(feature)
|
|
|
|
values.append(parent)
|
2017-05-05 15:00:50 +02:00
|
|
|
if inspect.getargspec(self.function).args[-1] == 'context':
|
|
|
|
values.append(context)
|
2015-01-22 09:21:04 +10:00
|
|
|
return self.function(*values)
|
|
|
|
else:
|
2017-05-05 15:00:50 +02:00
|
|
|
if inspect.getargspec(self.function).args[-1] == 'context':
|
|
|
|
self.function(values, feature, parent, context)
|
2015-01-22 09:21:04 +10:00
|
|
|
return self.function(values, feature, parent)
|
2014-11-29 18:37:23 +10:00
|
|
|
except Exception as ex:
|
2015-01-22 09:21:04 +10:00
|
|
|
parent.setEvalErrorString(str(ex))
|
|
|
|
return None
|
2014-11-29 18:37:23 +10:00
|
|
|
|
2016-10-27 11:33:42 +02:00
|
|
|
def usesGeometry(self, node):
|
|
|
|
return self.uses_geometry
|
|
|
|
|
|
|
|
def referencedColumns(self, node):
|
|
|
|
return self.referenced_columns
|
|
|
|
|
2014-11-29 18:37:23 +10:00
|
|
|
helptemplate = string.Template("""<h3>$name function</h3><br>$doc""")
|
|
|
|
name = kwargs.get('name', function.__name__)
|
2017-08-22 19:15:15 +02:00
|
|
|
helptext = kwargs.get('helpText') or function.__doc__ or ''
|
2014-11-29 18:37:23 +10:00
|
|
|
helptext = helptext.strip()
|
2015-01-22 09:21:04 +10:00
|
|
|
expandargs = False
|
2015-01-22 20:53:45 +01:00
|
|
|
|
2015-01-22 09:21:04 +10:00
|
|
|
if arg_count == "auto":
|
|
|
|
# Work out the number of args we need.
|
|
|
|
# Number of function args - 2. The last two args are always feature, parent.
|
|
|
|
args = inspect.getargspec(function).args
|
|
|
|
number = len(args)
|
|
|
|
arg_count = number - 2
|
2017-05-05 15:00:50 +02:00
|
|
|
if args[-1] == 'context':
|
|
|
|
arg_count -= 1
|
2015-01-22 09:21:04 +10:00
|
|
|
expandargs = True
|
2014-11-29 18:37:23 +10:00
|
|
|
|
2014-11-30 00:40:22 +10:00
|
|
|
register = kwargs.get('register', True)
|
|
|
|
if register and QgsExpression.isFunctionName(name):
|
2014-11-29 18:37:23 +10:00
|
|
|
if not QgsExpression.unregisterFunction(name):
|
2015-10-18 00:20:07 +02:00
|
|
|
msgtitle = QCoreApplication.translate("UserExpressions", "User expressions")
|
2017-06-12 07:28:36 +10:00
|
|
|
msg = QCoreApplication.translate("UserExpressions",
|
|
|
|
"The user expression {0} already exists and could not be unregistered.").format(
|
|
|
|
name)
|
2015-10-18 00:20:07 +02:00
|
|
|
QgsMessageLog.logMessage(msg + "\n", msgtitle, QgsMessageLog.WARNING)
|
|
|
|
return None
|
2014-11-29 18:37:23 +10:00
|
|
|
|
|
|
|
function.__name__ = name
|
|
|
|
helptext = helptemplate.safe_substitute(name=name, doc=helptext)
|
2017-06-12 07:28:36 +10:00
|
|
|
f = QgsPyExpressionFunction(function, name, arg_count, group, helptext, usesgeometry, referenced_columns,
|
|
|
|
expandargs)
|
2014-11-29 18:37:23 +10:00
|
|
|
|
|
|
|
# This doesn't really make any sense here but does when used from a decorator context
|
|
|
|
# so it can stay.
|
|
|
|
if register:
|
|
|
|
QgsExpression.registerFunction(f)
|
|
|
|
return f
|
|
|
|
|
|
|
|
|
2015-05-27 22:37:50 +10:00
|
|
|
def qgsfunction(args='auto', group='custom', **kwargs):
|
2014-11-29 18:37:23 +10:00
|
|
|
"""
|
|
|
|
Decorator function used to define a user expression function.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
@qgsfunction(2, 'test'):
|
|
|
|
def add(values, feature, parent):
|
|
|
|
pass
|
|
|
|
|
|
|
|
Will create and register a function in QgsExpression called 'add' in the
|
|
|
|
'test' group that takes two arguments.
|
|
|
|
|
|
|
|
or not using feature and parent:
|
|
|
|
|
|
|
|
Example:
|
|
|
|
@qgsfunction(2, 'test'):
|
|
|
|
def add(values, *args):
|
|
|
|
pass
|
|
|
|
"""
|
|
|
|
|
|
|
|
def wrapper(func):
|
2015-01-10 10:43:12 +10:00
|
|
|
return register_function(func, args, group, **kwargs)
|
2017-06-12 07:28:36 +10:00
|
|
|
|
2014-11-29 18:37:23 +10:00
|
|
|
return wrapper
|
2015-08-12 13:50:06 +02:00
|
|
|
|
2015-08-22 14:29:41 +02:00
|
|
|
|
2015-08-12 14:55:36 +02:00
|
|
|
class QgsEditError(Exception):
|
2015-08-22 14:29:41 +02:00
|
|
|
|
2015-08-12 14:55:36 +02:00
|
|
|
def __init__(self, value):
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return repr(self.value)
|
|
|
|
|
2017-06-12 07:28:36 +10:00
|
|
|
|
2015-08-12 13:50:06 +02:00
|
|
|
# Define a `with edit(layer)` statement
|
|
|
|
|
2015-08-22 14:29:41 +02:00
|
|
|
|
2016-09-21 18:24:26 +02:00
|
|
|
class edit(object):
|
2015-08-22 14:29:41 +02:00
|
|
|
|
|
|
|
def __init__(self, layer):
|
2015-08-12 13:50:06 +02:00
|
|
|
self.layer = layer
|
|
|
|
|
|
|
|
def __enter__(self):
|
|
|
|
assert self.layer.startEditing()
|
|
|
|
return self.layer
|
|
|
|
|
|
|
|
def __exit__(self, ex_type, ex_value, traceback):
|
|
|
|
if ex_type is None:
|
2015-08-12 14:55:36 +02:00
|
|
|
if not self.layer.commitChanges():
|
|
|
|
raise QgsEditError(self.layer.commitErrors())
|
2015-08-12 13:50:06 +02:00
|
|
|
return True
|
|
|
|
else:
|
|
|
|
self.layer.rollBack()
|
|
|
|
return False
|
2016-04-19 22:25:16 +10:00
|
|
|
|
|
|
|
|
|
|
|
class QgsTaskWrapper(QgsTask):
|
|
|
|
|
2016-11-29 15:02:05 +10:00
|
|
|
def __init__(self, description, flags, function, on_finished, *args, **kwargs):
|
|
|
|
QgsTask.__init__(self, description, flags)
|
2016-04-29 11:17:26 +10:00
|
|
|
self.args = args
|
|
|
|
self.kwargs = kwargs
|
2016-12-05 16:46:10 +10:00
|
|
|
self.function = function
|
|
|
|
self.on_finished = on_finished
|
Allow QgsTask subclasses to defined a finished function, which is
called when the task has completed (successfully or otherwise).
This allows for simpler task design when the signal/slot
based approach is not required. Just implement run() with your
heavy lifting, and finished() to do whatever follow up stuff
should happen after the task is complete. finished is always
called from the main thread, so it's safe to do GUI operations
here.
Python based tasks using the simplified QgsTask.fromFunction
approach can now set a on_finished argument to a function
to call when the task is complete.
eg:
def calculate(task):
# pretend this is some complex maths and stuff we want
# to run in the background
return 5*6
def calculation_finished(result, value=None):
if result == QgsTask.ResultSuccess:
iface.messageBar().pushMessage(
'the magic number is {}'.format(value))
elif result == QgsTask.ResultFail:
iface.messageBar().pushMessage(
'couldn\'t work it out, sorry')
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
Multiple values can also be returned, eg:
def calculate(task):
return (4, 8, 15)
def calculation_finished(result, count=None, max=None, sum=None):
# here:
# count = 4
# max = 8
# sum = 15
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
2016-11-09 10:10:57 +10:00
|
|
|
self.returned_values = None
|
2016-04-21 15:12:05 +10:00
|
|
|
self.exception = None
|
2016-04-19 22:25:16 +10:00
|
|
|
|
2016-12-05 12:20:06 +10:00
|
|
|
def run(self):
|
2016-04-19 22:25:16 +10:00
|
|
|
try:
|
Allow QgsTask subclasses to defined a finished function, which is
called when the task has completed (successfully or otherwise).
This allows for simpler task design when the signal/slot
based approach is not required. Just implement run() with your
heavy lifting, and finished() to do whatever follow up stuff
should happen after the task is complete. finished is always
called from the main thread, so it's safe to do GUI operations
here.
Python based tasks using the simplified QgsTask.fromFunction
approach can now set a on_finished argument to a function
to call when the task is complete.
eg:
def calculate(task):
# pretend this is some complex maths and stuff we want
# to run in the background
return 5*6
def calculation_finished(result, value=None):
if result == QgsTask.ResultSuccess:
iface.messageBar().pushMessage(
'the magic number is {}'.format(value))
elif result == QgsTask.ResultFail:
iface.messageBar().pushMessage(
'couldn\'t work it out, sorry')
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
Multiple values can also be returned, eg:
def calculate(task):
return (4, 8, 15)
def calculation_finished(result, count=None, max=None, sum=None):
# here:
# count = 4
# max = 8
# sum = 15
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
2016-11-09 10:10:57 +10:00
|
|
|
self.returned_values = self.function(self, *self.args, **self.kwargs)
|
2016-04-21 15:12:05 +10:00
|
|
|
except Exception as ex:
|
|
|
|
# report error
|
|
|
|
self.exception = ex
|
2016-12-05 13:48:54 +10:00
|
|
|
return False
|
2016-04-19 22:25:16 +10:00
|
|
|
|
2016-12-05 13:48:54 +10:00
|
|
|
return True
|
2016-04-19 22:25:16 +10:00
|
|
|
|
Allow QgsTask subclasses to defined a finished function, which is
called when the task has completed (successfully or otherwise).
This allows for simpler task design when the signal/slot
based approach is not required. Just implement run() with your
heavy lifting, and finished() to do whatever follow up stuff
should happen after the task is complete. finished is always
called from the main thread, so it's safe to do GUI operations
here.
Python based tasks using the simplified QgsTask.fromFunction
approach can now set a on_finished argument to a function
to call when the task is complete.
eg:
def calculate(task):
# pretend this is some complex maths and stuff we want
# to run in the background
return 5*6
def calculation_finished(result, value=None):
if result == QgsTask.ResultSuccess:
iface.messageBar().pushMessage(
'the magic number is {}'.format(value))
elif result == QgsTask.ResultFail:
iface.messageBar().pushMessage(
'couldn\'t work it out, sorry')
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
Multiple values can also be returned, eg:
def calculate(task):
return (4, 8, 15)
def calculation_finished(result, count=None, max=None, sum=None):
# here:
# count = 4
# max = 8
# sum = 15
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
2016-11-09 10:10:57 +10:00
|
|
|
def finished(self, result):
|
|
|
|
if not self.on_finished:
|
|
|
|
return
|
2016-04-19 22:25:16 +10:00
|
|
|
|
2016-12-05 13:48:54 +10:00
|
|
|
if not result and self.exception is None:
|
2017-01-16 22:27:14 +01:00
|
|
|
self.exception = Exception('Task canceled')
|
2016-12-05 11:45:11 +10:00
|
|
|
|
Allow QgsTask subclasses to defined a finished function, which is
called when the task has completed (successfully or otherwise).
This allows for simpler task design when the signal/slot
based approach is not required. Just implement run() with your
heavy lifting, and finished() to do whatever follow up stuff
should happen after the task is complete. finished is always
called from the main thread, so it's safe to do GUI operations
here.
Python based tasks using the simplified QgsTask.fromFunction
approach can now set a on_finished argument to a function
to call when the task is complete.
eg:
def calculate(task):
# pretend this is some complex maths and stuff we want
# to run in the background
return 5*6
def calculation_finished(result, value=None):
if result == QgsTask.ResultSuccess:
iface.messageBar().pushMessage(
'the magic number is {}'.format(value))
elif result == QgsTask.ResultFail:
iface.messageBar().pushMessage(
'couldn\'t work it out, sorry')
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
Multiple values can also be returned, eg:
def calculate(task):
return (4, 8, 15)
def calculation_finished(result, count=None, max=None, sum=None):
# here:
# count = 4
# max = 8
# sum = 15
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
2016-11-09 10:10:57 +10:00
|
|
|
try:
|
|
|
|
if self.returned_values:
|
2016-12-05 11:45:11 +10:00
|
|
|
self.on_finished(self.exception, self.returned_values)
|
Allow QgsTask subclasses to defined a finished function, which is
called when the task has completed (successfully or otherwise).
This allows for simpler task design when the signal/slot
based approach is not required. Just implement run() with your
heavy lifting, and finished() to do whatever follow up stuff
should happen after the task is complete. finished is always
called from the main thread, so it's safe to do GUI operations
here.
Python based tasks using the simplified QgsTask.fromFunction
approach can now set a on_finished argument to a function
to call when the task is complete.
eg:
def calculate(task):
# pretend this is some complex maths and stuff we want
# to run in the background
return 5*6
def calculation_finished(result, value=None):
if result == QgsTask.ResultSuccess:
iface.messageBar().pushMessage(
'the magic number is {}'.format(value))
elif result == QgsTask.ResultFail:
iface.messageBar().pushMessage(
'couldn\'t work it out, sorry')
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
Multiple values can also be returned, eg:
def calculate(task):
return (4, 8, 15)
def calculation_finished(result, count=None, max=None, sum=None):
# here:
# count = 4
# max = 8
# sum = 15
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
2016-11-09 10:10:57 +10:00
|
|
|
else:
|
2016-12-05 11:45:11 +10:00
|
|
|
self.on_finished(self.exception)
|
Allow QgsTask subclasses to defined a finished function, which is
called when the task has completed (successfully or otherwise).
This allows for simpler task design when the signal/slot
based approach is not required. Just implement run() with your
heavy lifting, and finished() to do whatever follow up stuff
should happen after the task is complete. finished is always
called from the main thread, so it's safe to do GUI operations
here.
Python based tasks using the simplified QgsTask.fromFunction
approach can now set a on_finished argument to a function
to call when the task is complete.
eg:
def calculate(task):
# pretend this is some complex maths and stuff we want
# to run in the background
return 5*6
def calculation_finished(result, value=None):
if result == QgsTask.ResultSuccess:
iface.messageBar().pushMessage(
'the magic number is {}'.format(value))
elif result == QgsTask.ResultFail:
iface.messageBar().pushMessage(
'couldn\'t work it out, sorry')
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
Multiple values can also be returned, eg:
def calculate(task):
return (4, 8, 15)
def calculation_finished(result, count=None, max=None, sum=None):
# here:
# count = 4
# max = 8
# sum = 15
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
2016-11-09 10:10:57 +10:00
|
|
|
except Exception as ex:
|
|
|
|
self.exception = ex
|
|
|
|
|
|
|
|
|
2016-12-05 11:49:11 +10:00
|
|
|
@staticmethod
|
|
|
|
def fromFunction(description, function, *args, on_finished=None, flags=QgsTask.AllFlags, **kwargs):
|
2016-12-05 14:07:45 +10:00
|
|
|
"""
|
|
|
|
Creates a new QgsTask task from a python function.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
def calculate(task):
|
|
|
|
# pretend this is some complex maths and stuff we want
|
|
|
|
# to run in the background
|
|
|
|
return 5*6
|
|
|
|
|
|
|
|
def calculation_finished(exception, value=None):
|
|
|
|
if not exception:
|
|
|
|
iface.messageBar().pushMessage(
|
|
|
|
'the magic number is {}'.format(value))
|
|
|
|
else:
|
|
|
|
iface.messageBar().pushMessage(
|
|
|
|
str(exception))
|
|
|
|
|
|
|
|
task = QgsTask.fromFunction('my task', calculate,
|
|
|
|
on_finished=calculation_finished)
|
2016-12-28 16:09:05 +10:00
|
|
|
QgsApplication.taskManager().addTask(task)
|
2016-12-05 14:07:45 +10:00
|
|
|
|
|
|
|
"""
|
|
|
|
|
2016-11-29 15:02:05 +10:00
|
|
|
assert function
|
|
|
|
return QgsTaskWrapper(description, flags, function, on_finished, *args, **kwargs)
|
2016-04-19 22:25:16 +10:00
|
|
|
|
2017-03-04 19:41:23 +01:00
|
|
|
|
2016-12-05 11:49:11 +10:00
|
|
|
QgsTask.fromFunction = fromFunction
|
2017-06-11 19:35:43 +10:00
|
|
|
|
|
|
|
|
|
|
|
# add some __repr__ methods to processing classes
|
|
|
|
def processing_source_repr(self):
|
2017-06-12 07:28:36 +10:00
|
|
|
return "<QgsProcessingFeatureSourceDefinition {{'source':{}, 'selectedFeaturesOnly': {}}}>".format(
|
|
|
|
self.source.staticValue(), self.selectedFeaturesOnly)
|
|
|
|
|
|
|
|
|
2017-06-11 19:35:43 +10:00
|
|
|
QgsProcessingFeatureSourceDefinition.__repr__ = processing_source_repr
|
|
|
|
|
|
|
|
|
|
|
|
def processing_output_layer_repr(self):
|
2017-06-12 07:28:36 +10:00
|
|
|
return "<QgsProcessingOutputLayerDefinition {{'sink':{}, 'createOptions': {}}}>".format(self.sink.staticValue(),
|
|
|
|
self.createOptions)
|
|
|
|
|
|
|
|
|
2017-06-11 19:35:43 +10:00
|
|
|
QgsProcessingOutputLayerDefinition.__repr__ = processing_output_layer_repr
|