Skip to content

Instantly share code, notes, and snippets.

View NathanW2's full-sized avatar

Nathan Woodrow NathanW2

View GitHub Profile
@NathanW2
NathanW2 / gist:2987342
Created June 25, 2012 08:20
ini patch
commit 4da574283857472dccf5f614fada4c62bcefe580
Author: Nathan Woodrow <woodrow.nathan@gmail.com>
Date: Tue May 22 00:00:10 2012 +1000
Set the default format as INI when using custom settings path
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 3253a34..b202b46 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
if ( match.contains( "day", Qt::CaseInsensitive ) ||
match.contains( QObject::tr("day", "Note: Word is part matched in code"), Qt::CaseInsensitive )||
match.contains( QObject::tr("days", "Note: Word is part matched in code"), Qt::CaseInsensitive) )
seconds += value * QgsExpression::Interval::DAY;
if ( match.contains( "week", Qt::CaseInsensitive ) ||
match.contains( QObject::tr("week", "Note: Word is part matched in code"), Qt::CaseInsensitive ) ||
match.contains( QObject::tr("weeks", "Note: Word is part matched in code"), Qt::CaseInsensitive ) )
seconds += value * QgsExpression::Interval::WEEKS;
if ( match.contains( "month", Qt::CaseInsensitive ) ||
match.contains( QObject::tr("month", "Note: Word is part matched in code"), Qt::CaseInsensitive ) ||
@NathanW2
NathanW2 / gist:3150290
Created July 20, 2012 11:40
QGIS init function
def myFunction(dialog, layer, feature):
geom = feature.geometry()
wkt = geom.exportToWkt()
# use the WKT in your PostGIS function to find the closest road
@NathanW2
NathanW2 / gist:3198411
Created July 29, 2012 12:34
interpolate
commit cd56dd7408797189cb5c909618ad4e0d22610f35
Author: Nathan Woodrow <woodrow.nathan@gmail.com>
Date: Sun Jul 29 22:32:17 2012 +1000
Add interoplate to QgsGeometry
diff --git a/python/core/qgsgeometry.sip b/python/core/qgsgeometry.sip
index ae805d8..cbd08c2 100644
--- a/python/core/qgsgeometry.sip
+++ b/python/core/qgsgeometry.sip
<style>
table, td, th
{
border:5px solid green;
}
th
{
background-color:green;
color:white;
}
diff --git a/python/utils.py b/python/utils.py
index 4bf110f..97e6f13 100755
--- a/python/utils.py
+++ b/python/utils.py
@@ -55,7 +55,18 @@ def initInterface(pointer):
from sip import wrapinstance
global iface
iface = wrapinstance(pointer, QgisInterface)
+ iface.initializationCompleted.connect(runStartUpScripts)
diff --git a/python/utils.py b/python/utils.py
index 4bf110f..97e6f13 100755
--- a/python/utils.py
+++ b/python/utils.py
@@ -55,7 +55,18 @@ def initInterface(pointer):
from sip import wrapinstance
global iface
iface = wrapinstance(pointer, QgisInterface)
+ iface.initializationCompleted.connect(runStartUpScripts)
diff --git a/src/core/qgsexpression.cpp b/src/core/qgsexpression.cpp
index ea6e292..12b911c 100644
--- a/src/core/qgsexpression.cpp
+++ b/src/core/qgsexpression.cpp
@@ -792,6 +792,13 @@ static QVariant fcnScale( const QVariantList&, QgsFeature*, QgsExpression* paren
return QVariant( parent->scale() );
}
+static QVariant fcnFormatNumber( const QVariantList& values, QgsFeature*, QgsExpression* parent )
+{
<style>
h1 {color:red;}
p.question {color:blue;}
</style>
<h1> [% "NAME" %] </h1>
<br>
<img src="[% "image" %]" />
<br>
<p class="question">Is this place a country?</p>
<br>
import inspect
def func1(*args):
print "IN FUNC1"
for arg in args:
print arg
def func2(arg1, arg2):
print "IN FUNC2"
print arg1