Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/QGIS into scale_lock_button
Browse files Browse the repository at this point in the history
  • Loading branch information
borysiasty committed Oct 25, 2018
2 parents 8bee898 + dc334ac commit 83065a4
Show file tree
Hide file tree
Showing 56 changed files with 1,081 additions and 192 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -52,6 +52,7 @@ qgis.kdev4
qgis.supp qgis.supp
qgis-test.ctest qgis-test.ctest
qtcreator-build/ qtcreator-build/
resources/themes/*/style.qss.auto
scripts/astyle.exe scripts/astyle.exe
scripts/Debug scripts/Debug
scripts/qgisstyle* scripts/qgisstyle*
Expand Down
4 changes: 3 additions & 1 deletion python/gui/auto_generated/qgsexpressionbuilderwidget.sip.in
Expand Up @@ -198,7 +198,8 @@ preview result and for populating the list of available functions and variables.
void registerItem( const QString &group, const QString &label, const QString &expressionText, void registerItem( const QString &group, const QString &label, const QString &expressionText,
const QString &helpText = QString(), const QString &helpText = QString(),
QgsExpressionItem::ItemType type = QgsExpressionItem::ExpressionNode, QgsExpressionItem::ItemType type = QgsExpressionItem::ExpressionNode,
bool highlightedItem = false, int sortOrder = 1 ); bool highlightedItem = false, int sortOrder = 1,
QIcon icon = QIcon() );
%Docstring %Docstring
Registers a node item for the expression builder. Registers a node item for the expression builder.


Expand All @@ -209,6 +210,7 @@ Registers a node item for the expression builder.
:param type: The type of the expression item. :param type: The type of the expression item.
:param highlightedItem: set to true to make the item highlighted, which inserts a bold copy of the item at the top level :param highlightedItem: set to true to make the item highlighted, which inserts a bold copy of the item at the top level
:param sortOrder: sort ranking for item :param sortOrder: sort ranking for item
:param icon: custom icon to show for item
%End %End


bool isExpressionValid(); bool isExpressionValid();
Expand Down
18 changes: 18 additions & 0 deletions python/gui/auto_generated/qgsgui.sip.in
Expand Up @@ -97,6 +97,21 @@ Sets the global window ``manager``. Ownership is transferred to the QgsGui insta


.. seealso:: :py:func:`windowManager` .. seealso:: :py:func:`windowManager`


.. versionadded:: 3.4
%End

enum HigFlag
{
HigMenuTextIsTitleCase,
HigDialogTitleIsTitleCase
};
typedef QFlags<QgsGui::HigFlag> HigFlags;


static QgsGui::HigFlags higFlags();
%Docstring
Returns HIG flags. Currently indicates whether titles should be title case depending on the current locale.

.. versionadded:: 3.4 .. versionadded:: 3.4
%End %End


Expand All @@ -106,6 +121,9 @@ Sets the global window ``manager``. Ownership is transferred to the QgsGui insta
QgsGui( const QgsGui &other ); QgsGui( const QgsGui &other );
}; };


QFlags<QgsGui::HigFlag> operator|(QgsGui::HigFlag f1, QFlags<QgsGui::HigFlag> f2);


/************************************************************************ /************************************************************************
* This file has been generated automatically from * * This file has been generated automatically from *
* * * *
Expand Down
11 changes: 11 additions & 0 deletions python/gui/auto_generated/qgsmessagebaritem.sip.in
Expand Up @@ -82,6 +82,17 @@ returns the duration in second of the message
QString getStyleSheet(); QString getStyleSheet();
%Docstring %Docstring
returns the styleSheet returns the styleSheet
%End

public slots:

void dismiss();
%Docstring
Dismisses the item, removing it from the message bar and deleting
it. Calling this on items which have not been added to a message bar
has no effect.

.. versionadded:: 3.4
%End %End


signals: signals:
Expand Down
5 changes: 2 additions & 3 deletions python/plugins/db_manager/dlg_sql_layer_window.py
Expand Up @@ -177,9 +177,8 @@ def __init__(self, iface, layer, parent=None):
item.setCheckState(Qt.Checked) item.setCheckState(Qt.Checked)
else: else:
keyColumn = uri.keyColumn() keyColumn = uri.keyColumn()
for item in self.uniqueModel.findItems("*", Qt.MatchWildcard): if self.uniqueModel.findItems(keyColumn):
if item.data() == keyColumn: self.uniqueCombo.setEditText(keyColumn)
self.uniqueCombo.setCurrentIndex(self.uniqueModel.indexFromItem(item).row())


# Finally layer name, filter and selectAtId # Finally layer name, filter and selectAtId
self.layerNameEdit.setText(layer.name()) self.layerNameEdit.setText(layer.name())
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ogr2ogr.py
Expand Up @@ -82,7 +82,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):


output, outputFormat = GdalUtils.ogrConnectionStringAndFormat(outFile, context) output, outputFormat = GdalUtils.ogrConnectionStringAndFormat(outFile, context)


if outputFormat == 'SQLite' and os.path.isfile(output): if outputFormat in ('SQLite', 'GPKG') and os.path.isfile(output):
raise QgsProcessingException(self.tr('Output file "{}" already exists.'.format(output))) raise QgsProcessingException(self.tr('Output file "{}" already exists.'.format(output)))


arguments = [] arguments = []
Expand Down
7 changes: 4 additions & 3 deletions python/plugins/processing/gui/menus.py
Expand Up @@ -33,6 +33,7 @@
from processing.gui.AlgorithmDialog import AlgorithmDialog from processing.gui.AlgorithmDialog import AlgorithmDialog
from qgis.utils import iface from qgis.utils import iface
from qgis.core import QgsApplication, QgsMessageLog, QgsStringUtils, QgsProcessingAlgorithm from qgis.core import QgsApplication, QgsMessageLog, QgsStringUtils, QgsProcessingAlgorithm
from qgis.gui import QgsGui
from processing.gui.MessageBarProgress import MessageBarProgress from processing.gui.MessageBarProgress import MessageBarProgress
from processing.gui.AlgorithmExecutor import execute from processing.gui.AlgorithmExecutor import execute
from processing.gui.Postprocessing import handleAlgorithmResults from processing.gui.Postprocessing import handleAlgorithmResults
Expand Down Expand Up @@ -183,10 +184,10 @@ def removeMenus():


def addAlgorithmEntry(alg, menuName, submenuName, actionText=None, icon=None, addButton=False): def addAlgorithmEntry(alg, menuName, submenuName, actionText=None, icon=None, addButton=False):
if actionText is None: if actionText is None:
if alg.flags() & QgsProcessingAlgorithm.FlagDisplayNameIsLiteral: if (QgsGui.higFlags() & QgsGui.HigMenuTextIsTitleCase) and not (alg.flags() & QgsProcessingAlgorithm.FlagDisplayNameIsLiteral):
alg_title = alg.displayName()
else:
alg_title = QgsStringUtils.capitalize(alg.displayName(), QgsStringUtils.TitleCase) alg_title = QgsStringUtils.capitalize(alg.displayName(), QgsStringUtils.TitleCase)
else:
alg_title = alg.displayName()
actionText = alg_title + QCoreApplication.translate('Processing', '…') actionText = alg_title + QCoreApplication.translate('Processing', '…')
action = QAction(icon or alg.icon(), actionText, iface.mainWindow()) action = QAction(icon or alg.icon(), actionText, iface.mainWindow())
alg_id = alg.id() alg_id = alg.id()
Expand Down
7 changes: 7 additions & 0 deletions python/plugins/processing/tests/GdalAlgorithmsTest.py
Expand Up @@ -1458,6 +1458,13 @@ def testOgr2Ogr(self):
'-f "LIBKML" "' + outdir + '/my out/check.kml" ' + '-f "LIBKML" "' + outdir + '/my out/check.kml" ' +
source + ' polys2']) source + ' polys2'])


self.assertEqual(
alg.getConsoleCommands({'INPUT': source,
'OUTPUT': outdir + '/check.gpkg'}, context, feedback),
['ogr2ogr',
'-f "GPKG" ' + outdir + '/check.gpkg ' +
source + ' polys2'])

def testOgr2PostGis(self): def testOgr2PostGis(self):
context = QgsProcessingContext() context = QgsProcessingContext()
feedback = QgsProcessingFeedback() feedback = QgsProcessingFeedback()
Expand Down
5 changes: 3 additions & 2 deletions python/utils.py
Expand Up @@ -328,7 +328,8 @@ def startPlugin(packageName):


errMsg = QCoreApplication.translate("Python", "Couldn't load plugin '{0}'").format(packageName) errMsg = QCoreApplication.translate("Python", "Couldn't load plugin '{0}'").format(packageName)


start = time.clock() start = time.process_time()

# create an instance of the plugin # create an instance of the plugin
try: try:
plugins[packageName] = package.classFactory(iface) plugins[packageName] = package.classFactory(iface)
Expand All @@ -350,7 +351,7 @@ def startPlugin(packageName):


# add to active plugins # add to active plugins
active_plugins.append(packageName) active_plugins.append(packageName)
end = time.clock() end = time.process_time()
plugin_times[packageName] = "{0:02f}s".format(end - start) plugin_times[packageName] = "{0:02f}s".format(end - start)


return True return True
Expand Down
12 changes: 7 additions & 5 deletions resources/function_help/json/make_circle
Expand Up @@ -4,11 +4,13 @@
"description": "Creates a circular polygon.", "description": "Creates a circular polygon.",
"variableLenArguments": true, "variableLenArguments": true,
"arguments": [ "arguments": [
{"arg":"center", "description": "center point of the circle"}, {"arg":"center", "description": "center point of the circle"},
{"arg":"radius", "description": "radius of the circle"}, {"arg":"radius", "description": "radius of the circle"},
{"arg":"segment", "description": "optional argument for polygon segmentation. By default this value is 36"}], {"arg":"segment", "optional": true, "default": "36", "description": "optional argument for polygon segmentation. By default this value is 36"}
"examples": [ { "expression":"geom_to_wkt(make_circle(make_point(10,10), 5, 4))", "returns":"'Polygon ((10 15, 15 10, 10 5, 5 10, 10 15))'"}, ],
"examples": [
{ "expression":"geom_to_wkt(make_circle(make_point(10,10), 5, 4))", "returns":"'Polygon ((10 15, 15 10, 10 5, 5 10, 10 15))'"},
{ "expression":"geom_to_wkt(make_circle(make_point(10,10,5), 5, 4))", "returns":"'PolygonZ ((10 15 5, 15 10 5, 10 5 5, 5 10 5, 10 15 5))'"}, { "expression":"geom_to_wkt(make_circle(make_point(10,10,5), 5, 4))", "returns":"'PolygonZ ((10 15 5, 15 10 5, 10 5 5, 5 10 5, 10 15 5))'"},
{ "expression":"geom_to_wkt(make_circle(make_point(10,10,5,30), 5, 4))", "returns":"'PolygonZM ((10 15 5 30, 15 10 5 30, 10 5 5 30, 5 10 5 30, 10 15 5 30))'"} { "expression":"geom_to_wkt(make_circle(make_point(10,10,5,30), 5, 4))", "returns":"'PolygonZM ((10 15 5 30, 15 10 5 30, 10 5 5 30, 5 10 5 30, 10 15 5 30))'"}
] ]
} }
16 changes: 9 additions & 7 deletions resources/function_help/json/make_ellipse
Expand Up @@ -4,13 +4,15 @@
"description": "Creates an elliptical polygon.", "description": "Creates an elliptical polygon.",
"variableLenArguments": true, "variableLenArguments": true,
"arguments": [ "arguments": [
{"arg":"center", "description": "center point of the ellipse"}, {"arg":"center", "description": "center point of the ellipse"},
{"arg":"semi_major_axis", "description": "semi-major axis of the ellipse"}, {"arg":"semi_major_axis", "description": "semi-major axis of the ellipse"},
{"arg":"semi_minor_axis", "description": "semi-minor axis of the ellipse"}, {"arg":"semi_minor_axis", "description": "semi-minor axis of the ellipse"},
{"arg":"azimuth", "description": "orientation of the ellipse"}, {"arg":"azimuth", "description": "orientation of the ellipse"},
{"arg":"segment", "description": "optional argument for polygon segmentation. By default this value is 36"}], {"arg":"segment", "optional": true, "default": "36", "description": "optional argument for polygon segmentation. By default this value is 36"}
"examples": [ { "expression":"geom_to_wkt(make_ellipse(make_point(10,10), 5, 2, 90, 4))", "returns":"'Polygon ((15 10, 10 8, 5 10, 10 12, 15 10))'"}, ],
"examples": [
{ "expression":"geom_to_wkt(make_ellipse(make_point(10,10), 5, 2, 90, 4))", "returns":"'Polygon ((15 10, 10 8, 5 10, 10 12, 15 10))'"},
{ "expression":"geom_to_wkt(make_ellipse(make_point(10,10,5), 5, 2, 90, 4))", "returns":"'PolygonZ ((15 10 5, 10 8 5, 5 10 5, 10 12 5, 15 10 5))'"}, { "expression":"geom_to_wkt(make_ellipse(make_point(10,10,5), 5, 2, 90, 4))", "returns":"'PolygonZ ((15 10 5, 10 8 5, 5 10 5, 10 12 5, 15 10 5))'"},
{ "expression":"geom_to_wkt(make_ellipse(make_point(10,10,5,30), 5, 2, 90, 4))", "returns":"'PolygonZM ((15 10 5 30, 10 8 5 30, 5 10 5 30, 10 12 5 30, 15 10 5 30))'"} { "expression":"geom_to_wkt(make_ellipse(make_point(10,10,5,30), 5, 2, 90, 4))", "returns":"'PolygonZM ((15 10 5 30, 10 8 5 30, 5 10 5 30, 10 12 5 30, 15 10 5 30))'"}
] ]
} }
14 changes: 8 additions & 6 deletions resources/function_help/json/make_point
Expand Up @@ -3,12 +3,14 @@
"type": "function", "type": "function",
"description": "Creates a point geometry from an x and y (and optional z and m) value.", "description": "Creates a point geometry from an x and y (and optional z and m) value.",
"arguments": [ "arguments": [
{"arg":"x","description":"x coordinate of point"}, {"arg":"x","description":"x coordinate of point"},
{"arg":"y","description":"y coordinate of point"}, {"arg":"y","description":"y coordinate of point"},
{"arg":"z","description":"optional z coordinate of point"}, {"arg":"z", "optional": true, "description":"optional z coordinate of point"},
{"arg":"m","description":"optional m value of point"} ], {"arg":"m", "optional": true, "description":"optional m value of point"}
"examples": [ { "expression":"geom_to_wkt(make_point(2,4))", "returns":"'Point (2 4)'"}, ],
"examples": [
{ "expression":"geom_to_wkt(make_point(2,4))", "returns":"'Point (2 4)'"},
{ "expression":"geom_to_wkt(make_point(2,4,6))", "returns":"'PointZ (2 4 6)'"}, { "expression":"geom_to_wkt(make_point(2,4,6))", "returns":"'PointZ (2 4 6)'"},
{ "expression":"geom_to_wkt(make_point(2,4,6,8))", "returns":"'PointZM (2 4 6 8)'"} { "expression":"geom_to_wkt(make_point(2,4,6,8))", "returns":"'PointZM (2 4 6 8)'"}
] ]
} }
14 changes: 8 additions & 6 deletions resources/function_help/json/make_regular_polygon
Expand Up @@ -4,11 +4,13 @@
"description": "Creates a regular polygon.", "description": "Creates a regular polygon.",
"variableLenArguments": true, "variableLenArguments": true,
"arguments": [ "arguments": [
{"arg":"center", "description": "center of the regular polygon"}, {"arg":"center", "description": "center of the regular polygon"},
{"arg":"radius", "description": "second point. The first if the regular polygon is inscribed. The midpoint of the first side if the regular polygon is circumscribed."}, {"arg":"radius", "description": "second point. The first if the regular polygon is inscribed. The midpoint of the first side if the regular polygon is circumscribed."},
{"arg":"number_sides", "description": "Number of sides/edges of the regular polygon"}, {"arg":"number_sides", "description": "Number of sides/edges of the regular polygon"},
{"arg":"circle", "description": "Optional argument to construct the regular polygon. By default this value is 0. Value can be 0 (inscribed) or 1 (circumscribed)"}], {"arg":"circle", "optional": true, "default": "0", "description": "Optional argument to construct the regular polygon. By default this value is 0. Value can be 0 (inscribed) or 1 (circumscribed)"}
"examples": [ { "expression":"geom_to_wkt(make_regular_polygon(make_point(0,0), make_point(0,5), 5))", "returns":"'Polygon ((0 5, 4.76 1.55, 2.94 -4.05, -2.94 -4.05, -4.76 1.55, 0 5))'"}, ],
"examples": [
{ "expression":"geom_to_wkt(make_regular_polygon(make_point(0,0), make_point(0,5), 5))", "returns":"'Polygon ((0 5, 4.76 1.55, 2.94 -4.05, -2.94 -4.05, -4.76 1.55, 0 5))'"},
{ "expression":"geom_to_wkt(make_regular_polygon(make_point(0,0), project(make_point(0,0), 4.0451, radians(36)), 5))", "returns":"'Polygon ((0 5, 4.76 1.55, 2.94 -4.05, -2.94 -4.05, -4.76 1.55, 0 5))'"} { "expression":"geom_to_wkt(make_regular_polygon(make_point(0,0), project(make_point(0,0), 4.0451, radians(36)), 5))", "returns":"'Polygon ((0 5, 4.76 1.55, 2.94 -4.05, -2.94 -4.05, -4.76 1.55, 0 5))'"}
] ]
} }
10 changes: 6 additions & 4 deletions resources/function_help/json/minimal_circle
Expand Up @@ -2,9 +2,11 @@
"name": "minimal_circle", "name": "minimal_circle",
"type": "function", "type": "function",
"description": "Returns the minimal enclosing circle of a geometry. It represents the minimum circle that encloses all geometries within the set.", "description": "Returns the minimal enclosing circle of a geometry. It represents the minimum circle that encloses all geometries within the set.",
"arguments": [ {"arg":"geometry","description":"a geometry"}, "arguments": [
{"arg":"segment", "description": "optional argument for polygon segmentation. By default this value is 36"}], {"arg":"geometry","description":"a geometry"},
"examples": [ { "expression":"geom_to_wkt( minimal_circle( geom_from_wkt( 'LINESTRING(0 5, 0 -5, 2 1)' ), 4 ) )", "returns":"Polygon ((0 5, 5 -0, -0 -5, -5 0, 0 5))"}, {"arg":"segment", "optional": true, "default": "36", "description": "optional argument for polygon segmentation. By default this value is 36"}],
{ "expression":"geom_to_wkt( minimal_circle( geom_from_wkt( 'MULTIPOINT(1 2, 3 4, 3 2)' ), 4 ) )", "returns":"Polygon ((3 4, 3 2, 1 2, 1 4, 3 4))"} "examples": [
{ "expression":"geom_to_wkt( minimal_circle( geom_from_wkt( 'LINESTRING(0 5, 0 -5, 2 1)' ), 4 ) )", "returns":"Polygon ((0 5, 5 -0, -0 -5, -5 0, 0 5))"},
{ "expression":"geom_to_wkt( minimal_circle( geom_from_wkt( 'MULTIPOINT(1 2, 3 4, 3 2)' ), 4 ) )", "returns":"Polygon ((3 4, 3 2, 1 2, 1 4, 3 4))"}
] ]
} }
12 changes: 8 additions & 4 deletions resources/function_help/json/nodes_to_points
Expand Up @@ -2,8 +2,12 @@
"name": "nodes_to_points", "name": "nodes_to_points",
"type": "function", "type": "function",
"description": "Returns a multipoint geometry consisting of every node in the input geometry.", "description": "Returns a multipoint geometry consisting of every node in the input geometry.",
"arguments": [ {"arg":"geometry","description":"geometry object"}, "arguments": [
{"arg":"ignore_closing_nodes","description":"optional argument specifying whether to include duplicate nodes which close lines or polygons rings. Defaults to false, set to true to avoid including these duplicate nodes in the output collection."} ], {"arg":"geometry","description":"geometry object"},
"examples": [ { "expression":"geom_to_wkt(nodes_to_points(geom_from_wkt('LINESTRING(0 0, 1 1, 2 2)')))", "returns":"'MultiPoint ((0 0),(1 1),(2 2))'"}, {"arg":"ignore_closing_nodes", "optional": true, "default": "false", "description":"optional argument specifying whether to include duplicate nodes which close lines or polygons rings. Defaults to false, set to true to avoid including these duplicate nodes in the output collection."}
{ "expression":"geom_to_wkt(nodes_to_points(geom_from_wkt('POLYGON((-1 -1, 4 0, 4 2, 0 2, -1 -1))'),true))", "returns":"'MultiPoint ((-1 -1),(4 0),(4 2),(0 2))'"}] ],
"examples": [
{ "expression":"geom_to_wkt(nodes_to_points(geom_from_wkt('LINESTRING(0 0, 1 1, 2 2)')))", "returns":"'MultiPoint ((0 0),(1 1),(2 2))'"},
{ "expression":"geom_to_wkt(nodes_to_points(geom_from_wkt('POLYGON((-1 -1, 4 0, 4 2, 0 2, -1 -1))'),true))", "returns":"'MultiPoint ((-1 -1),(4 0),(4 2),(0 2))'"}
]
} }
15 changes: 9 additions & 6 deletions resources/function_help/json/wordwrap
Expand Up @@ -2,10 +2,13 @@
"name": "wordwrap", "name": "wordwrap",
"type": "function", "type": "function",
"description": "Returns a string wrapped to a maximum/minimum number of characters.", "description": "Returns a string wrapped to a maximum/minimum number of characters.",
"arguments": [ {"arg":"string","description":"the string to be wrapped"}, "arguments": [
{"arg":"wrap_length","description":"an integer. If wrap_length is positive the number represents the ideal maximum number of characters to wrap; if negative, the number represents the minimum number of characters to wrap."}, {"arg":"string","description":"the string to be wrapped"},
{"arg":"delimiter_string","description":"the delimiter string to wrap to a new line (optional)."} {"arg":"wrap_length","description":"an integer. If wrap_length is positive the number represents the ideal maximum number of characters to wrap; if negative, the number represents the minimum number of characters to wrap."},
], {"arg":"delimiter_string","optional": true, "description":"Optional delimiter string to wrap to a new line."}
"examples": [ { "expression":"wordwrap('UNIVERSITY OF QGIS',13)", "returns":"'UNIVERSITY OF<br>QGIS'"}, ],
{ "expression":"wordwrap('UNIVERSITY OF QGIS',-3)", "returns":"'UNIVERSITY<br>OF QGIS'"} ] "examples": [
{ "expression":"wordwrap('UNIVERSITY OF QGIS',13)", "returns":"'UNIVERSITY OF<br>QGIS'"},
{ "expression":"wordwrap('UNIVERSITY OF QGIS',-3)", "returns":"'UNIVERSITY<br>OF QGIS'"}
]
} }

0 comments on commit 83065a4

Please sign in to comment.