Skip to content
Permalink
Browse files

Fix - Fix loading expression template for first item and space vs tabs

Fix tab vs spaces in Python editor widget. Use spaces
  • Loading branch information
NathanW2 committed Oct 15, 2018
1 parent bd8d61a commit 8dd0f008772bf7f178c169b5626018e954b621d1
Showing with 5 additions and 3 deletions.
  1. +3 −2 python/user.py
  2. +1 −0 src/gui/qgscodeeditorpython.cpp
  3. +1 −1 src/gui/qgsexpressionbuilderwidget.cpp
@@ -65,8 +65,7 @@ def load_user_expressions(path):
if not os.path.exists(initfile):
open(initfile, "w").close()

template = """\"\"\"
from qgis.core import *
template = """from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
@@ -82,6 +81,8 @@ def my_sum(value1, value2, feature, parent):
return value1 + value2
"""

default_expression_template = template


try:
import expressions
@@ -99,6 +99,7 @@ void QgsCodeEditorPython::setSciLexerPython()

setMarginVisible( true );
setFoldingVisible( true );
setIndentationsUseTabs( false );
}


@@ -310,7 +310,7 @@ void QgsExpressionBuilderWidget::newFunctionFile( const QString &fileName )
cmbFileNames->setCurrentRow( 0 );

QString templatetxt;
QgsPythonRunner::eval( QStringLiteral( "qgis.user.expressions.template" ), templatetxt );
QgsPythonRunner::eval( QStringLiteral( "qgis.user.default_expression_template" ), templatetxt );
txtPython->setText( templatetxt );
saveFunctionFile( fileName );
}

0 comments on commit 8dd0f00

Please sign in to comment.
You can’t perform that action at this time.