indentation update

This commit is contained in:
Juergen E. Fischer 2013-09-03 21:59:14 +02:00
parent 2572d613c1
commit 668a44f81a
22 changed files with 608 additions and 505 deletions

View File

@ -138,7 +138,7 @@ class ShellOutputScintilla(QsciScintilla):
"## Type help(iface) for more info and list of methods.\n").format(sys.version,
socket.gethostname())
## some translation string for the console header ends without '\n'
## and the first command in console will be appended at the header text.
## and the first command in console will be appended at the header text.
## The following code add a '\n' at the end of the string if not present.
if txtInit.endswith('\n'):
initText = self.setText(txtInit)

View File

@ -151,7 +151,7 @@ class Dialog(QDialog, Ui_Dialog):
layer2 = ftools_utils.getVectorLayerByName(line2)
if layer1.id() == layer2.id():
if nearest > 0:
nearest = nearest + 1
nearest = nearest + 1
provider1 = layer1.dataProvider()
provider2 = layer2.dataProvider()
sindex = QgsSpatialIndex()

View File

@ -40,16 +40,16 @@ class CouldNotLoadResultsDialog(QtGui.QDialog):
self.setWindowTitle("Problem loading output layers")
layout = QVBoxLayout()
browser = QtGui.QTextBrowser()
browser.setOpenLinks(False)
browser.setOpenLinks(False)
browser.anchorClicked.connect(self.linkClicked)
html = self.alg.getPostProcessingErrorMessage(self.wrongLayers)
browser.setHtml(html)
browser.setHtml(html)
button = QPushButton()
button.setText("Close")
button.clicked.connect(self.closeButtonPressed)
button.clicked.connect(self.closeButtonPressed)
buttonBox = QtGui.QDialogButtonBox()
buttonBox.setOrientation(QtCore.Qt.Horizontal)
buttonBox.addButton(button, QDialogButtonBox.ActionRole)
buttonBox.setOrientation(QtCore.Qt.Horizontal)
buttonBox.addButton(button, QDialogButtonBox.ActionRole)
layout.addWidget(browser)
layout.addWidget(buttonBox)
self.setLayout(layout)

View File

@ -38,9 +38,9 @@ class HelpEditionDialog(QDialog, Ui_DlgHelpEdition):
def __init__(self, alg):
QDialog.__init__(self)
self.setupUi(self)
self.setupUi(self)
self.alg = alg
self.descriptions = {}
if self.alg.descriptionFile is not None:
@ -68,11 +68,11 @@ class HelpEditionDialog(QDialog, Ui_DlgHelpEdition):
pickle.dump(self.descriptions, f)
f.close()
except Exception, e:
QMessageBox.warning(self, "Error saving help file",
QMessageBox.warning(self, "Error saving help file",
"Help file could not be saved."
"\nCheck that you have permission to modify the help file.\n"
"You might not have permission if you are editing an example\n"
"model or script, since they are stored on the installation folder")
"model or script, since they are stored on the installation folder")
QDialog.accept(self)
def getHtml(self):

View File

@ -44,10 +44,10 @@ class MissingDependencyDialog(QtGui.QDialog):
browser.setHtml(self.msg)
button = QPushButton()
button.setText("Close")
button.clicked.connect(self.closeButtonPressed)
button.clicked.connect(self.closeButtonPressed)
buttonBox = QtGui.QDialogButtonBox()
buttonBox.setOrientation(QtCore.Qt.Horizontal)
buttonBox.addButton(button, QDialogButtonBox.ActionRole)
buttonBox.setOrientation(QtCore.Qt.Horizontal)
buttonBox.addButton(button, QDialogButtonBox.ActionRole)
layout.addWidget(browser)
layout.addWidget(buttonBox)
self.setLayout(layout)

View File

@ -100,7 +100,7 @@ class CalculatorModelerParametersDialog(QtGui.QDialog):
self.values = {}
self.outputs = {}
name = self.getSafeNameForHarcodedParameter(self.alg.getParameterFromName(self.alg.FORMULA))
name = self.getSafeNameForHarcodedParameter(self.alg.getParameterFromName(self.alg.FORMULA))
value = AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, name)
self.params[self.alg.FORMULA] = value
formula = str(self.formulaText.text())

View File

@ -283,9 +283,9 @@ class ModelerParametersDialog(QtGui.QDialog):
params = self.model.parameters
for param in params:
if isinstance(param, ParameterExtent):
extents.append(AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, param.name, "", param.description))
extents.append(AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, param.name, "", param.description))
if self.algIndex is None:
dependent = []
else:
@ -299,7 +299,7 @@ class ModelerParametersDialog(QtGui.QDialog):
if isinstance(out, OutputExtent):
extents.append(AlgorithmAndParameter(i, out.name, alg.name, out.description))
i+=1
return extents
def getNumbers(self):

View File

@ -56,6 +56,6 @@ class VectorLayerBoundsAlgorithm(GeoAlgorithm):
self.setOutputValue(self.XMAX, layer.extent().xMaximum())
self.setOutputValue(self.YMIN, layer.extent().yMinimum())
self.setOutputValue(self.YMAX, layer.extent().yMaximum())
self.setOutputValue(self.EXTENT,
self.setOutputValue(self.EXTENT,
(layer.extent().xMinimum(), layer.extent().xMaximum(), layer.extent().yMinimum(), layer.extent().yMaximum()))

View File

@ -32,7 +32,7 @@ class OutputExtent(Output):
self.description = description
self.value = None
self.hidden = True
def setValue(self, value):
try:
if value != None and isinstance(value, basestring):
@ -41,4 +41,4 @@ class OutputExtent(Output):
self.value = ",".join([str(v) for v in value])
return True
except:
return False
return False

View File

@ -52,7 +52,7 @@ class OutputTable(Output):
return self.value
else:
if self.compatible is None:
self.compatible = ProcessingUtils.getTempFilenameInTempFolder(self.name + "." + self.getDefaultFileExtension(alg))
self.compatible = ProcessingUtils.getTempFilenameInTempFolder(self.name + "." + self.getDefaultFileExtension(alg))
return self.compatible;
def getTableWriter(self, fields):

View File

@ -55,7 +55,7 @@ class OutputVector(Output):
return self.value
else:
if self.compatible is None:
self.compatible = ProcessingUtils.getTempFilenameInTempFolder(self.name + "." + self.getDefaultFileExtension(alg))
self.compatible = ProcessingUtils.getTempFilenameInTempFolder(self.name + "." + self.getDefaultFileExtension(alg))
return self.compatible;

View File

@ -53,7 +53,7 @@ class EditRScriptDialog(QtGui.QDialog):
Qt.WindowMinMaxButtonsHint)
self.setWindowTitle("Edit script")
layout = QVBoxLayout()
self.text = ScriptEditorWidget(self.alg.script if self.alg is not None else "")
self.text = ScriptEditorWidget(self.alg.script if self.alg is not None else "")
self.buttonBox = QtGui.QDialogButtonBox()
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
if self.alg != None:
@ -144,7 +144,7 @@ class EditRScriptDialog(QtGui.QDialog):
self.close()
from PyQt4.Qsci import QsciScintilla
class ScriptEditorWidget(QsciScintilla):
ARROW_MARKER_NUM = 8
@ -170,6 +170,6 @@ class ScriptEditorWidget(QsciScintilla):
self.setCaretLineBackgroundColor(QColor("#ffe4e4"))
self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
self.setText(text)

View File

@ -306,8 +306,8 @@ class SagaAlgorithm(GeoAlgorithm):
if isinstance(out, OutputRaster):
filename = out.getCompatibleFileName(self)
filename2 = ProcessingUtils.tempFolder() + os.sep + os.path.basename(filename) + ".sgrd"
formatIndex = 1 if saga208 else 4
if ProcessingUtils.isWindows() or ProcessingUtils.isMac() or not saga208:
formatIndex = 1 if saga208 else 4
if ProcessingUtils.isWindows() or ProcessingUtils.isMac() or not saga208:
commands.append("io_gdal 1 -GRIDS \"" + filename2 + "\" -FORMAT " + str(formatIndex) +" -TYPE 0 -FILE \"" + filename + "\"");
else:
commands.append("libio_gdal 1 -GRIDS \"" + filename2 + "\" -FORMAT 1 -TYPE 0 -FILE \"" + filename + "\"");
@ -378,12 +378,12 @@ class SagaAlgorithm(GeoAlgorithm):
return s
def exportRasterLayer(self, source):
def exportRasterLayer(self, source):
layer = QGisLayers.getObjectFromUri(source, False)
if layer:
filename = str(layer.name())
else:
filename = source.rstrip(".sgrd")
filename = source.rstrip(".sgrd")
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
filename = ''.join(c for c in filename if c in validChars)
if len(filename) == 0:
@ -395,8 +395,8 @@ class SagaAlgorithm(GeoAlgorithm):
return "io_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + source+"\""
else:
return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + source + "\""
def checkBeforeOpeningParametersDialog(self):

View File

@ -45,8 +45,8 @@ class SagaAlgorithmProvider(AlgorithmProvider):
def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
if ProcessingUtils.isWindows():
ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_FOLDER, "SAGA folder", SagaUtils.sagaPath()))
ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_208, "Enable SAGA 2.0.8 compatibility", False))
ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_FOLDER, "SAGA folder", SagaUtils.sagaPath()))
ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_208, "Enable SAGA 2.0.8 compatibility", False))
ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_AUTO_RESAMPLING, "Use min covering grid system for resampling", True))
ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_LOG_COMMANDS, "Log execution commands", True))
ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_LOG_CONSOLE, "Log console output", True))

View File

@ -52,7 +52,7 @@ class EditScriptDialog(QtGui.QDialog):
Qt.WindowMinMaxButtonsHint)
self.setWindowTitle("Edit script")
layout = QVBoxLayout()
self.text = ScriptEditorWidget(self.alg.script if self.alg is not None else "")
self.text = ScriptEditorWidget(self.alg.script if self.alg is not None else "")
self.buttonBox = QtGui.QDialogButtonBox()
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.editHelpButton = QtGui.QPushButton()
@ -120,9 +120,9 @@ class EditScriptDialog(QtGui.QDialog):
def cancelPressed(self):
#self.update = False
self.close()
from PyQt4.Qsci import QsciScintilla, QsciLexerPython
class ScriptEditorWidget(QsciScintilla):
ARROW_MARKER_NUM = 8
@ -151,6 +151,6 @@ class ScriptEditorWidget(QsciScintilla):
lexer.setDefaultFont(font)
self.setLexer(lexer)
self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
self.setText(text)

View File

@ -222,7 +222,7 @@ void QgsMeasureDialog::updateUi()
toolTip += "<br> * " + tr( "Project CRS transformation is turned off." ) + " ";
toolTip += tr( "Canvas units setting is taken from project properties setting (%1)." ).arg( QGis::tr( mCanvasUnits ) );
toolTip += "<br> * " + tr( "Ellipsoidal calculation is not possible, as project CRS is undefined." );
setWindowTitle( tr("Measure (OTF off)"));
setWindowTitle( tr( "Measure (OTF off)" ) );
}
else
{
@ -236,7 +236,7 @@ void QgsMeasureDialog::updateUi()
toolTip += "<br> * " + tr( "Project CRS transformation is turned on but ellipsoidal calculation is not selected." );
toolTip += "<br> * " + tr( "The canvas units setting is taken from the project CRS (%1)." ).arg( QGis::tr( mCanvasUnits ) );
}
setWindowTitle( tr("Measure (OTF on)"));
setWindowTitle( tr( "Measure (OTF on)" ) );
}
if (( mCanvasUnits == QGis::Meters && mDisplayUnits == QGis::Feet ) || ( mCanvasUnits == QGis::Feet && mDisplayUnits == QGis::Meters ) )

View File

@ -163,7 +163,8 @@ class CORE_EXPORT QgsFields
{
public:
enum FieldOrigin {
enum FieldOrigin
{
OriginUnknown, //!< it has not been specified where the field comes from
OriginProvider, //!< field comes from the underlying data provider of the vector layer (originIndex = index in provider's fields)
OriginJoin, //!< field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index within the join)

View File

@ -195,7 +195,7 @@ QString QgsRasterRenderer::minMaxOriginLabel( int theOrigin )
QString est_exact;
QString values;
QString extent;
if ( theOrigin & MinMaxEstimated )
{
est_exact = tr( "Estimated" );
@ -227,11 +227,11 @@ QString QgsRasterRenderer::minMaxOriginLabel( int theOrigin )
extent = tr( "sub extent" );
}
label = QCoreApplication::translate ( "QgsRasterRenderer", "%1 %2 of %3.",
"min/max origin label in raster properties, where %1 - estimated/exact, %2 - values (min/max, stddev, etc.), %3 - extent" )
.arg(est_exact)
.arg(values)
.arg(extent);
label = QCoreApplication::translate( "QgsRasterRenderer", "%1 %2 of %3.",
"min/max origin label in raster properties, where %1 - estimated/exact, %2 - values (min/max, stddev, etc.), %3 - extent" )
.arg( est_exact )
.arg( values )
.arg( extent );
return label;
}

View File

@ -717,7 +717,7 @@ class Connection(object):
if self._timeout:
old_alarm = signal.signal(signal.SIGALRM, self.timeout_handler)
signal.alarm(self._timeout)
# Run Request.
req.run()

View File

@ -69,7 +69,7 @@ class ThreadedServer(object):
# Set close-on-exec
setCloseOnExec(sock)
# Main loop.
while self._keepGoing:
try:
@ -88,7 +88,7 @@ class ThreadedServer(object):
raise
setCloseOnExec(clientSock)
if not self._isClientAllowed(addr):
clientSock.close()
continue
@ -110,7 +110,7 @@ class ThreadedServer(object):
# Return bool based on whether or not SIGHUP was received.
return self._hupReceived
def shutdown(self):
"""Wait for running threads to finish."""
self._threadPool.shutdown()

View File

@ -53,14 +53,14 @@ class ThreadPool(object):
# Start the minimum number of worker threads.
for i in range(maxSpare):
self._start_new_thread()
def _start_new_thread(self):
t = threading.Thread(target=self._worker)
self._threads.append(t)
t.setDaemon(True)
t.start()
return t
def shutdown(self):
"""shutdown all workers."""
self._lock.acquire()
@ -116,7 +116,7 @@ class ThreadPool(object):
while True:
while not self._workQueue and not self._stop:
self._lock.wait()
if self._stop:
return