Skip to content
Permalink
Browse files

indentation update

  • Loading branch information
jef-n committed Sep 3, 2013
1 parent 2572d61 commit 668a44f81a7bd8508f0e4cdea23a9e5dd3c257f1
@@ -138,7 +138,7 @@ def insertInitText(self):
"## 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)
@@ -151,7 +151,7 @@ def compute(self, line1, line2, field1, field2, outPath, matType, nearest, progr
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()
@@ -40,16 +40,16 @@ def setupUi(self):
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)
@@ -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 @@ def accept(self):
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):
@@ -44,10 +44,10 @@ def setupUi(self):
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)
@@ -100,7 +100,7 @@ def setParamValues(self):
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())
@@ -283,9 +283,9 @@ def getExtents(self):
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 @@ def getExtents(self):
if isinstance(out, OutputExtent):
extents.append(AlgorithmAndParameter(i, out.name, alg.name, out.description))
i+=1

return extents

def getNumbers(self):
@@ -56,6 +56,6 @@ def processAlgorithm(self, progress):
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()))

@@ -32,7 +32,7 @@ def __init__(self, name="", description=""):
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 @@ def setValue(self, value):
self.value = ",".join([str(v) for v in value])
return True
except:
return False
return False
@@ -52,7 +52,7 @@ def getCompatibleFileName(self, alg):
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):
@@ -55,7 +55,7 @@ def getCompatibleFileName(self, alg):
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;


@@ -53,7 +53,7 @@ def setupUi(self):
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 @@ def cancelPressed(self):
self.close()

from PyQt4.Qsci import QsciScintilla

class ScriptEditorWidget(QsciScintilla):
ARROW_MARKER_NUM = 8

@@ -170,6 +170,6 @@ def __init__(self, text, parent=None):
self.setCaretLineBackgroundColor(QColor("#ffe4e4"))

self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')

self.setText(text)

@@ -306,8 +306,8 @@ def processAlgorithm(self, progress):
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 @@ def resampleRasterLayer(self,layer):
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 @@ def exportRasterLayer(self, source):
return "io_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + source+"\""
else:
return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + source + "\""




def checkBeforeOpeningParametersDialog(self):
@@ -45,8 +45,8 @@ def __init__(self):
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))
@@ -52,7 +52,7 @@ def setupUi(self):
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 @@ def saveAlgorithm(self):
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 @@ def __init__(self, text, parent=None):
lexer.setDefaultFont(font)
self.setLexer(lexer)
self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')

self.setText(text)

@@ -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 ) )
@@ -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)
@@ -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;
}

@@ -717,7 +717,7 @@ def _forwardRequest(self, pkt):
if self._timeout:
old_alarm = signal.signal(signal.SIGALRM, self.timeout_handler)
signal.alarm(self._timeout)

# Run Request.
req.run()

@@ -69,7 +69,7 @@ def run(self, sock, timeout=1.0):

# Set close-on-exec
setCloseOnExec(sock)

# Main loop.
while self._keepGoing:
try:
@@ -88,7 +88,7 @@ def run(self, sock, timeout=1.0):
raise

setCloseOnExec(clientSock)

if not self._isClientAllowed(addr):
clientSock.close()
continue
@@ -110,7 +110,7 @@ def run(self, sock, timeout=1.0):

# 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()
@@ -53,14 +53,14 @@ def __init__(self, minSpare=1, maxSpare=5, maxThreads=sys.maxint):
# 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 @@ def _worker(self):
while True:
while not self._workQueue and not self._stop:
self._lock.wait()

if self._stop:
return

0 comments on commit 668a44f

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