Skip to content

Commit 16708cd

Browse files
author
volayaf
committed
added clear history button
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
1 parent 45f5618 commit 16708cd

File tree

8 files changed

+36
-34
lines changed

8 files changed

+36
-34
lines changed

src/sextante/core/SextanteLog.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ def getRecentAlgorithms():
8181
return SextanteLog.recentAlgs
8282

8383

84+
@staticmethod
85+
def clearLog():
86+
os.unlink(SextanteLog.logFilename())
87+
SextanteLog.startLogging()
88+
8489

8590

8691
class LogEntry():
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
v.surf.bspline
22
v.surf.bspline
33
Vector (v.*)
4-
ParameterVector|input|input|-1|False
5-
ParameterVector|sparse|sparse|-1|False
4+
ParameterVector|input|input|0|False
65
ParameterNumber|sie|sie|None|None|4
76
ParameterNumber|sin|sin|None|None|4
7+
ParameterNumber|layer|layer|None|None|1
88
ParameterSelection|method|method|bilinear;bicubic
9-
ParameterNumber|lambda_i|lambda_i|None|None|1
9+
ParameterNumber|lambda_i|lambda_i|None|None|0.01
1010
ParameterTableField|column|column|input
11-
ParameterBoolean|-c|-c|True
12-
ParameterBoolean|-e|-e|True
13-
OutputVector|output|output
11+
ParameterBoolean|-c|-c|False
12+
ParameterBoolean|-e|-e|False
1413
OutputRaster|raster|raster

src/sextante/gui/HistoryDialog.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ def setupUi(self):
3232
self.text.setReadOnly(True)
3333
self.closeButton = QtGui.QPushButton()
3434
self.closeButton.setText("Close")
35+
self.clearButton = QtGui.QPushButton()
36+
self.clearButton.setText("Clear history")
3537
self.horizontalLayout= QtGui.QHBoxLayout()
3638
self.horizontalLayout.setSpacing(2)
3739
self.horizontalLayout.setMargin(0)
3840
self.horizontalLayout.addStretch(1000)
41+
self.horizontalLayout.addWidget(self.clearButton)
3942
self.horizontalLayout.addWidget(self.closeButton)
4043
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow)
44+
QObject.connect(self.clearButton, QtCore.SIGNAL("clicked()"), self.clearLog)
4145
self.verticalLayout.addLayout(self.horizontalLayout)
4246
self.setWindowTitle("History")
4347
self.setLayout(self.verticalLayout)
@@ -47,8 +51,12 @@ def setupUi(self):
4751
def closeWindow(self):
4852
self.close()
4953

54+
def clearLog(self):
55+
SextanteLog.clearLog()
56+
self.fillTree()
5057

5158
def fillTree(self):
59+
self.tree.clear()
5260
elements = SextanteLog.getLogEntries()
5361
for category in elements.keys():
5462
groupItem = QtGui.QTreeWidgetItem()

src/sextante/gui/ParametersDialog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def setParamValues(self):
9595
if output.hidden:
9696
continue
9797
output.value = self.paramTable.valueItems[output.name].getValue()
98-
output.open = self.paramTable.checkBoxes[output.name].isChecked()
98+
if not SextanteConfig.getSetting(SextanteConfig.TABLE_LIKE_PARAM_PANEL):
99+
output.open = self.paramTable.checkBoxes[output.name].isChecked()
99100

100101
return True
101102

src/sextante/outputs/Output.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
class Output(object):
44

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

1717
def __str__(self):
1818
return self.name + " <" + self.__module__.split(".")[-1] +">"

src/sextante/outputs/OutputRaster.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
class OutputRaster(Output):
44

5-
def __init__(self, name="", description="", hidden=False):
6-
self.name = name
7-
self.description = description
8-
self.value = None
9-
self.hidden = hidden
10-
115
def getFileFilter(self, alg):
126
exts = alg.provider.getSupportedOutputRasterLayerExtensions()
137
for i in range(len(exts)):

src/sextante/outputs/OutputVector.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
class OutputVector(Output):
44

5-
def __init__(self, name="", description="", hidden=False):
6-
self.name = name
7-
self.description = description
8-
self.value = None
9-
self.hidden = hidden
10-
115
def getFileFilter(self,alg):
126
exts = alg.provider.getSupportedOutputVectorLayerExtensions()
137
for i in range(len(exts)):

src/sextante/r/RUtils.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,19 @@ def createConsoleOutput():
6969
RUtils.consoleResults = []
7070
RUtils.allConsoleResults = []
7171
add = False
72-
lines = open(RUtils.getConsoleOutputFilename())
73-
for line in lines:
74-
line = line.strip("\n").strip(" ")
75-
if line.startswith(">"):
76-
line = line[1:].strip(" ")
77-
if line in RUtils.verboseCommands:
78-
add = True
79-
else:
80-
add = False
81-
elif add:
82-
RUtils.consoleResults.append("<p>" + line + "</p>\n");
83-
RUtils.allConsoleResults.append(line);
72+
if os.path.exists(RUtils.getConsoleOutputFilename()):
73+
lines = open(RUtils.getConsoleOutputFilename())
74+
for line in lines:
75+
line = line.strip("\n").strip(" ")
76+
if line.startswith(">"):
77+
line = line[1:].strip(" ")
78+
if line in RUtils.verboseCommands:
79+
add = True
80+
else:
81+
add = False
82+
elif add:
83+
RUtils.consoleResults.append("<p>" + line + "</p>\n");
84+
RUtils.allConsoleResults.append(line);
8485

8586

8687
@staticmethod

0 commit comments

Comments
 (0)