Skip to content
Permalink
Browse files

identation update

  • Loading branch information
jef-n committed Apr 19, 2014
1 parent 3978bff commit f355ea6d7c2e7306c0015f9b0f53391306be9385
@@ -94,7 +94,7 @@ def grassPath():
for subfolder in os.listdir(testfolder):
if subfolder.startswith('grass'):
folder = os.path.join(testfolder, subfolder)
break
break
else:
folder = os.path.join(QgsApplication.prefixPath(), 'grass')
if not os.path.isdir(folder):
@@ -89,7 +89,7 @@ def adapt_list_to_string(self, c_list):
if c_list[0] == "ParameterType_InputImageList":
a_list[3] = 3
elif c_list[0] == "ParameterType_InputFilenameList":
a_list[3] = 4
a_list[3] = 4
else:
a_list[3] = -1

@@ -505,7 +505,7 @@ def checkParameterValuesBeforeExecuting(self):
def help(self):
name = self.cmdname.lower()
validChars = 'abcdefghijklmnopqrstuvwxyz'
name = ''.join(c for c in name if c in validChars)
name = ''.join(c for c in name if c in validChars)
html = getHtmlFromRstFile(os.path.join(os.path.dirname(__file__), 'help',
name + '.rst'))
imgpath = os.path.join(os.path.dirname(__file__),os.pardir, os.pardir, 'images', 'saga100x100.jpg')
@@ -89,6 +89,6 @@ class SagaGroupNameDecorator:
groups['vigra'] = 'Vigra'

@staticmethod
def getDecoratedName(groupName):
def getDecoratedName(groupName):
return SagaGroupNameDecorator.groups.get(groupName, groupName)

@@ -146,7 +146,7 @@ def initialize():
Processing.addProvider(OTBAlgorithmProvider())
Processing.addProvider(RAlgorithmProvider())
Processing.addProvider(SagaAlgorithmProvider())
Processing.addProvider(GrassAlgorithmProvider())
Processing.addProvider(GrassAlgorithmProvider())
Processing.addProvider(Grass7AlgorithmProvider())
Processing.addProvider(ScriptAlgorithmProvider())
Processing.addProvider(TauDEMAlgorithmProvider())
@@ -188,7 +188,7 @@ class Setting:
STRING = 0
FILE = 1
FOLDER = 2

def __init__(self, group, name, description, default, hidden=False, valuetype = None):
self.group = group
self.name = name
@@ -108,21 +108,21 @@ def __init__(self, alg, mainWidget):
url = None
try:
isText, help = self.alg.help()
if help is not None:
if help is not None:
if isText:
html = help;
else:
url = QtCore.QUrl(help)
url = QtCore.QUrl(help)
else:
html = '<h2>Sorry, no help is available for this \
algorithm.</h2>'
except WrongHelpFileException, e:
html = e.args[0]
html = e.args[0]
try:
if html:
self.webView.setHtml(html)
elif url:
print url
elif url:
print url
self.webView.load(url)
except:
self.webView.setHtml('<h2>Could not open help file :-( </h2>')
@@ -199,11 +199,11 @@ def setParamValue(self, param, widget):
elif isinstance(param, ParameterMultipleInput):
if param.datatype == ParameterMultipleInput.TYPE_FILE:
return param.setValue(widget.selectedoptions)
else:
else:
if param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
options = dataobjects.getVectorLayers()
options = dataobjects.getVectorLayers()
else:
options = dataobjects.getRasterLayers()
options = dataobjects.getRasterLayers()
return param.setValue([options[i] for i in widget.selectedoptions])
elif isinstance(param, (ParameterNumber, ParameterFile, ParameterCrs,
ParameterExtent)):
@@ -54,13 +54,13 @@ def __init__(self, param, row, col, batchDialog, parent=None):
self.horizontalLayout.addWidget(self.text)
self.pushButton = QtGui.QPushButton()
self.pushButton.setText('...')
self.pushButton.clicked.connect(self.showPopupMenu)
self.pushButton.clicked.connect(self.showPopupMenu)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)

def showPopupMenu(self):
popupmenu = QtGui.QMenu()
if not (isinstance(self.param, ParameterMultipleInput)
if not (isinstance(self.param, ParameterMultipleInput)
and self.param.datatype == ParameterMultipleInput.TYPE_FILE):
selectLayerAction = QtGui.QAction('Select from open layers',
self.pushButton)
@@ -70,28 +70,28 @@ def showPopupMenu(self):
self.pushButton)
selectFileAction.triggered.connect(self.showFileSelectionDialog)
popupmenu.addAction(selectFileAction)
popupmenu.exec_(QtGui.QCursor.pos())
popupmenu.exec_(QtGui.QCursor.pos())

def showLayerSelectionDialog(self):
if (isinstance(self.param, ParameterRaster)
or (isinstance(self.param, ParameterMultipleInput)
or (isinstance(self.param, ParameterMultipleInput)
and self.param.datatype == ParameterMultipleInput.TYPE_RASTER)):
layers = dataobjects.getRasterLayers()
layers = dataobjects.getRasterLayers()
elif isinstance(self.param, ParameterTable):
layers = dataobjects.getTables()
layers = dataobjects.getTables()
else:
if isinstance(self.param, ParameterVector):
datatype = self.param.shapetype
else:
datatype = [self.param.datatype]
layers = dataobjects.getVectorLayers(datatype)
layers = dataobjects.getVectorLayers(datatype)
dlg = MultipleInputDialog([layer.name() for layer in layers])
dlg.exec_()
if dlg.selectedoptions is not None:
selected = dlg.selectedoptions
if dlg.selectedoptions is not None:
selected = dlg.selectedoptions
if len(selected) == 1:
self.text.setText(layers[selected[0]])
else:
else:
if isinstance(self.param, ParameterMultipleInput):
self.text.setText(';'.join(layers[idx].name() for idx in selected))
else:
@@ -101,7 +101,7 @@ def showLayerSelectionDialog(self):
for i, layeridx in enumerate(selected):
self.table.cellWidget(i + self.row,
self.col).setText(layers[layeridx].name())

def showFileSelectionDialog(self):
settings = QtCore.QSettings()
text = unicode(self.text.text())
@@ -55,4 +55,4 @@ def execute(self):
self.toolbox.updateProvider('script')
elif self.scriptType == ScriptEditorDialog.SCRIPT_R:
self.toolbox.updateProvider('r')

@@ -36,7 +36,7 @@
ALG_HELP_CREATOR = 'ALG_HELP_CREATOR'

exps = [(r"\*(.*?)\*", r"<i>\1</i>"),
("``(.*?)``", r'<FONT FACE="courier">\1</FONT>'),
("``(.*?)``", r'<FONT FACE="courier">\1</FONT>'),
("(.*?)\n==+\n+?", r'<h2>\1</h2>'),
("(.*?)\n--+\n+?", r'<h3>\1</h3>'),
(r"::(\s*\n(\s*\n)*((\s+).*?\n)(((\4).*?\n)|(\s*\n))*)",r"<pre>\1</pre>"),
@@ -45,14 +45,14 @@

def getHtmlFromRstFile(rst):
with open(rst) as f:
lines = f.readlines()
lines = f.readlines()
s = "".join(lines)
for exp, replace in exps:
p = re.compile(exp)
s = p.sub(replace, s)
print s
return s

def getHtmlFromHelpFile(alg, helpFile):
if not os.path.exists(helpFile):
return None
@@ -31,7 +31,7 @@
import os

class MultipleFileInputDialog(QtGui.QDialog):

def __init__(self, selectedoptions):
self.selectedoptions = selectedoptions
self.options=selectedoptions
@@ -283,7 +283,7 @@ def getWidgetFromParameter(self, param):
item = MultipleFileInputPanel()
else:
if param.datatype == ParameterMultipleInput.TYPE_RASTER:
options = dataobjects.getRasterLayers()
options = dataobjects.getRasterLayers()
elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
options = dataobjects.getVectorLayers()
else:
@@ -164,25 +164,25 @@ def setupUi(self):
self.scrollArea.setWidgetResizable(True)
self.tabWidget.addTab(self.scrollArea, 'Parameters')
self.webView = QtWebKit.QWebView()

html = None
url = None
try:
isText, help = self.alg.help()
if help is not None:
if help is not None:
if isText:
html = help;
else:
url = QtCore.QUrl(help)
url = QtCore.QUrl(help)
else:
html = '<h2>Sorry, no help is available for this \
algorithm.</h2>'
except WrongHelpFileException, e:
html = e.args[0]
html = e.args[0]
try:
if html:
self.webView.setHtml(html)
elif url:
elif url:
self.webView.load(url)
except:
self.webView.setHtml('<h2>Could not open help file :-( </h2>')
@@ -9119,8 +9119,8 @@ void QgisApp::oldProjectVersionWarning( QString oldVersion )
if ( settings.value( "/qgis/warnOldProjectVersion", QVariant( true ) ).toBool() )
{
QString smalltext = tr( "This project file was saved by an older version of QGIS."
" When saving this project file, QGIS will update it to the latest version, "
"possibly rendering it useless for older versions of QGIS.");
" When saving this project file, QGIS will update it to the latest version, "
"possibly rendering it useless for older versions of QGIS." );

QString text = tr( "<p>This project file was saved by an older version of QGIS."
" When saving this project file, QGIS will update it to the latest version, "
@@ -9154,7 +9154,7 @@ void QgisApp::oldProjectVersionWarning( QString oldVersion )
);
box.exec();
#else
messageBar()->pushMessage( title, smalltext);
messageBar()->pushMessage( title, smalltext );
#endif
}
return;
@@ -473,10 +473,10 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
void QgsIdentifyResultsDialog::mapLayerActionDestroyed()
{
QTreeWidgetItemIterator it( lstResults );
while( *it )
while ( *it )
{
if( (*it)->data( 0, Qt::UserRole ) == "map_layer_action" &&
(*it)->data( 0, Qt::UserRole + 1 ).value< QObject *>() == sender() )
if (( *it )->data( 0, Qt::UserRole ) == "map_layer_action" &&
( *it )->data( 0, Qt::UserRole + 1 ).value< QObject *>() == sender() )
delete *it;
else
++it;
@@ -99,7 +99,7 @@ int QgsSnapper::snapPoint( const QPoint& startPoint, QList<QgsSnappingResult>& s
QgsSnappingResult returnResult = evalIt.value();
for ( evalIt = snappingResultList.begin(); evalIt != snappingResultList.end(); ++evalIt )
{
if( evalIt.value().snappedVertexNr != -1 )
if ( evalIt.value().snappedVertexNr != -1 )
{
returnResult = evalIt.value();
snappingResultList.erase( evalIt );
@@ -344,7 +344,7 @@ void QgsHighlight::paint( QPainter* p )
else if ( mFeature.geometry() )
{
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer*>( mLayer );
if( !layer )
if ( !layer )
return;
QgsMapSettings mapSettings = mMapCanvas->mapSettings();
QgsRenderContext context = QgsRenderContext::fromMapSettings( mapSettings );

0 comments on commit f355ea6

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