Skip to content

Commit

Permalink
added clear history button
Browse files Browse the repository at this point in the history
fixed buf in outputs (missing open variable)
fixed bug when using table-like params dialog

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@176 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed May 9, 2012
1 parent 45f5618 commit 16708cd
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 34 deletions.
5 changes: 5 additions & 0 deletions src/sextante/core/SextanteLog.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ def getRecentAlgorithms():
return SextanteLog.recentAlgs


@staticmethod
def clearLog():
os.unlink(SextanteLog.logFilename())
SextanteLog.startLogging()



class LogEntry():
Expand Down
11 changes: 5 additions & 6 deletions src/sextante/grass/description/v.surf.bspline.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
v.surf.bspline
v.surf.bspline
Vector (v.*)
ParameterVector|input|input|-1|False
ParameterVector|sparse|sparse|-1|False
ParameterVector|input|input|0|False
ParameterNumber|sie|sie|None|None|4
ParameterNumber|sin|sin|None|None|4
ParameterNumber|layer|layer|None|None|1
ParameterSelection|method|method|bilinear;bicubic
ParameterNumber|lambda_i|lambda_i|None|None|1
ParameterNumber|lambda_i|lambda_i|None|None|0.01
ParameterTableField|column|column|input
ParameterBoolean|-c|-c|True
ParameterBoolean|-e|-e|True
OutputVector|output|output
ParameterBoolean|-c|-c|False
ParameterBoolean|-e|-e|False
OutputRaster|raster|raster
8 changes: 8 additions & 0 deletions src/sextante/gui/HistoryDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ def setupUi(self):
self.text.setReadOnly(True)
self.closeButton = QtGui.QPushButton()
self.closeButton.setText("Close")
self.clearButton = QtGui.QPushButton()
self.clearButton.setText("Clear history")
self.horizontalLayout= QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.addStretch(1000)
self.horizontalLayout.addWidget(self.clearButton)
self.horizontalLayout.addWidget(self.closeButton)
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow)
QObject.connect(self.clearButton, QtCore.SIGNAL("clicked()"), self.clearLog)
self.verticalLayout.addLayout(self.horizontalLayout)
self.setWindowTitle("History")
self.setLayout(self.verticalLayout)
Expand All @@ -47,8 +51,12 @@ def setupUi(self):
def closeWindow(self):
self.close()

def clearLog(self):
SextanteLog.clearLog()
self.fillTree()

def fillTree(self):
self.tree.clear()
elements = SextanteLog.getLogEntries()
for category in elements.keys():
groupItem = QtGui.QTreeWidgetItem()
Expand Down
3 changes: 2 additions & 1 deletion src/sextante/gui/ParametersDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def setParamValues(self):
if output.hidden:
continue
output.value = self.paramTable.valueItems[output.name].getValue()
output.open = self.paramTable.checkBoxes[output.name].isChecked()
if not SextanteConfig.getSetting(SextanteConfig.TABLE_LIKE_PARAM_PANEL):
output.open = self.paramTable.checkBoxes[output.name].isChecked()

return True

Expand Down
6 changes: 3 additions & 3 deletions src/sextante/outputs/Output.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

class Output(object):

def __init__(self, name="", description=""):
def __init__(self, name="", description="", hidden=False):
self.name = name
self.description = description
self.value = None
# a hidden output will not be shown to the user, who will not be able to select where to store it
# Use this to generate outputs that are modified version of inputs (like a selection in a vector layer)
# In the case of layers, hidden outputs are not loaded into QGIS after the algorithm is executed.
# Other outputs not representing layers or tables should always be hidden.
self.hidden = False
self.hidden = hidden
#this value indicates whether the output has to be opened after being produced by the algorithm or not
self.open = False
self.open = True

def __str__(self):
return self.name + " <" + self.__module__.split(".")[-1] +">"
Expand Down
6 changes: 0 additions & 6 deletions src/sextante/outputs/OutputRaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

class OutputRaster(Output):

def __init__(self, name="", description="", hidden=False):
self.name = name
self.description = description
self.value = None
self.hidden = hidden

def getFileFilter(self, alg):
exts = alg.provider.getSupportedOutputRasterLayerExtensions()
for i in range(len(exts)):
Expand Down
6 changes: 0 additions & 6 deletions src/sextante/outputs/OutputVector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

class OutputVector(Output):

def __init__(self, name="", description="", hidden=False):
self.name = name
self.description = description
self.value = None
self.hidden = hidden

def getFileFilter(self,alg):
exts = alg.provider.getSupportedOutputVectorLayerExtensions()
for i in range(len(exts)):
Expand Down
25 changes: 13 additions & 12 deletions src/sextante/r/RUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,19 @@ def createConsoleOutput():
RUtils.consoleResults = []
RUtils.allConsoleResults = []
add = False
lines = open(RUtils.getConsoleOutputFilename())
for line in lines:
line = line.strip("\n").strip(" ")
if line.startswith(">"):
line = line[1:].strip(" ")
if line in RUtils.verboseCommands:
add = True
else:
add = False
elif add:
RUtils.consoleResults.append("<p>" + line + "</p>\n");
RUtils.allConsoleResults.append(line);
if os.path.exists(RUtils.getConsoleOutputFilename()):
lines = open(RUtils.getConsoleOutputFilename())
for line in lines:
line = line.strip("\n").strip(" ")
if line.startswith(">"):
line = line[1:].strip(" ")
if line in RUtils.verboseCommands:
add = True
else:
add = False
elif add:
RUtils.consoleResults.append("<p>" + line + "</p>\n");
RUtils.allConsoleResults.append(line);


@staticmethod
Expand Down

0 comments on commit 16708cd

Please sign in to comment.