Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
indentation update
  • Loading branch information
jef-n committed Nov 29, 2015
1 parent 6aabb85 commit 079029e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
Expand Up @@ -34,7 +34,6 @@
from FusionUtils import FusionUtils



class TinSurfaceCreate(FusionAlgorithm):

INPUT = 'INPUT'
Expand Down Expand Up @@ -64,7 +63,7 @@ def defineCharacteristics(self):
class_var.isAdvanced = True
self.addParameter(class_var)
return_sel = ParameterString(self.RETURN,
self.tr('Select specific return'), '', False, True)
self.tr('Select specific return'), '', False, True)
return_sel.isAdvanced = True
self.addParameter(return_sel)

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/ExtentSelectionPanel.py
Expand Up @@ -166,7 +166,7 @@ def useLayerExtent(self):
self.setValueFromRect(extentsDict[item]["extent"])
if extentsDict[item]["authid"] != iface.mapCanvas().mapRenderer().destinationCrs().authid():
iface.messageBar().pushMessage(self.tr("Warning"),
self.tr("The projection of the chosen layer is not the same as canvas projection! The selected extent might not be what was intended."),
self.tr("The projection of the chosen layer is not the same as canvas projection! The selected extent might not be what was intended."),
QgsMessageBar.WARNING, 8)

def selectOnCanvas(self):
Expand Down
10 changes: 6 additions & 4 deletions src/core/qgsproject.cpp
Expand Up @@ -68,17 +68,19 @@ QStringList makeKeyTokens_( QString const &scope, QString const &key )
keyTokens.push_front( "properties" );

//check validy of keys since an unvalid xml name will will be dropped upon saving the xml file. If not valid, we print a message to the console.
for (int i = 0; i < keyTokens.size(); ++i){
QString keyToken = keyTokens.at(i);
for ( int i = 0; i < keyTokens.size(); ++i )
{
QString keyToken = keyTokens.at( i );

//invalid chars in XML are found at http://www.w3.org/TR/REC-xml/#NT-NameChar
//note : it seems \x10000-\xEFFFF is valid, but it when added to the regexp, a lot of unwanted characters remain
QString nameCharRegexp = QString( "[^:A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\x2FF\\x370-\\x37D\\x37F-\\x1FFF\\x200C-\\x200D\\x2070-\\x218F\\x2C00-\\x2FEF\\x3001-\\xD7FF\\xF900-\\xFDCF\\xFDF0-\\xFFFD\\-\\.0-9\\xB7\\x0300-\\x036F\\x203F-\\x2040]" );
QString nameStartCharRegexp = QString( "^[^:A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\x2FF\\x370-\\x37D\\x37F-\\x1FFF\\x200C-\\x200D\\x2070-\\x218F\\x2C00-\\x2FEF\\x3001-\\xD7FF\\xF900-\\xFDCF\\xFDF0-\\xFFFD]" );

if( keyToken.contains( QRegExp(nameCharRegexp) ) || keyToken.contains( QRegExp(nameStartCharRegexp) ) ){
if ( keyToken.contains( QRegExp( nameCharRegexp ) ) || keyToken.contains( QRegExp( nameStartCharRegexp ) ) )
{

QString errorString = QObject::tr("Entry token invalid : '%1'. The token will not be saved to file.").arg(keyToken);
QString errorString = QObject::tr( "Entry token invalid : '%1'. The token will not be saved to file." ).arg( keyToken );
QgsMessageLog::logMessage( errorString, QString::null, QgsMessageLog::CRITICAL );

}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayereditpassthrough.cpp
Expand Up @@ -22,7 +22,7 @@ bool QgsVectorLayerEditPassthrough::addFeature( QgsFeature& f )

QgsFeatureList fl;
fl << f;
if ( L->dataProvider()->addFeatures( fl) )
if ( L->dataProvider()->addFeatures( fl ) )
{
f.setFeatureId( fl.first().id() );
emit featureAdded( f.id() );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp
Expand Up @@ -351,7 +351,7 @@ QString QgsEditorWidgetRegistry::findSuitableWrapper( QWidget* editor, const QSt
QMap<const char*, QPair<int, QString> >::ConstIterator it;

QString widgetid;

// Editor can be null
if ( editor )
{
Expand Down
14 changes: 7 additions & 7 deletions tests/src/python/test_qgsproject.py
Expand Up @@ -35,14 +35,14 @@ def test_makeKeyTokens_(self):
validTokens = []

# all test tokens will be generated by prepending or inserting characters to this token
validBase = u"valid";
validBase = u"valid"

# some invalid characters, not allowed anywhere in a token
# note that '/' must not be added here because it is taken as a separator by makeKeyTokens_()
invalidChars = u"+*,;<>|!$%()=?#\x01";
invalidChars = u"+*,;<>|!$%()=?#\x01"

# generate the characters that are allowed at the start of a token (and at every other position)
validStartChars = u":_";
validStartChars = u":_"
charRanges = [
(ord(u'a'), ord(u'z')),
(ord(u'A'), ord(u'Z')),
Expand All @@ -56,18 +56,18 @@ def test_makeKeyTokens_(self):
(0xF900, 0xFDCF),
(0xFDF0, 0xFFFD),
#(0x10000, 0xEFFFF), while actually valid, these are not yet accepted by makeKeyTokens_()
]
]
for r in charRanges:
for c in range(r[0], r[1]):
validStartChars += unichr(c)

# generate the characters that are only allowed inside a token, not at the start
validInlineChars = u"-.\xB7";
validInlineChars = u"-.\xB7"
charRanges = [
(ord(u'0'), ord(u'9')),
(0x0300, 0x036F),
(0x203F, 0x2040),
]
]
for r in charRanges:
for c in range(r[0], r[1]):
validInlineChars += unichr(c)
Expand All @@ -86,7 +86,7 @@ def test_makeKeyTokens_(self):

# test each allowed inline character
for c in validInlineChars:
validTokens.append(validBase[:4] + c + validBase[4:]);
validTokens.append(validBase[:4] + c + validBase[4:])

logger = QgsMessageLog.instance()
logger.messageReceived.connect(self.catchMessage)
Expand Down

0 comments on commit 079029e

Please sign in to comment.