Skip to content

Commit

Permalink
Fix - Fix loading expression template for first item and space vs tabs
Browse files Browse the repository at this point in the history
Fix tab vs spaces in Python editor widget. Use spaces
  • Loading branch information
NathanW2 committed Oct 15, 2018
1 parent bd8d61a commit 8dd0f00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions python/user.py
Expand Up @@ -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')
Expand All @@ -82,6 +81,8 @@ def my_sum(value1, value2, feature, parent):
return value1 + value2
"""

default_expression_template = template


try:
import expressions
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgscodeeditorpython.cpp
Expand Up @@ -99,6 +99,7 @@ void QgsCodeEditorPython::setSciLexerPython()

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


Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsexpressionbuilderwidget.cpp
Expand Up @@ -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 );
}
Expand Down

0 comments on commit 8dd0f00

Please sign in to comment.