Skip to content

Commit

Permalink
refixed 5949. fixed 5925
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@322 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Jul 31, 2012
1 parent cfdbc2f commit 9599c20
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/sextante/gui/ExtentSelectionPanel.py
Expand Up @@ -111,7 +111,6 @@ def useLayerExtent(self):
extentsDict[layer.name()] = layer.extent()
item, ok = QtGui.QInputDialog.getItem(self, "Select extent", "Use extent from", extents, False)
if ok:
item = str(item)
self.setValueFromRect(extentsDict[item])

def selectOnCanvas(self):
Expand Down
19 changes: 17 additions & 2 deletions src/sextante/modeler/ModelerAlgorithm.py
Expand Up @@ -20,6 +20,8 @@

class ModelerAlgorithm(GeoAlgorithm):

CANVAS_SIZE = 4000

def getCopy(self):
newone = ModelerAlgorithm()
newone.openModel(self.descriptionFile)
Expand Down Expand Up @@ -254,13 +256,26 @@ def getPositionForAlgorithmItem(self):
MARGIN = 20
BOX_WIDTH = 200
BOX_HEIGHT = 80
return QtCore.QPointF(MARGIN + BOX_WIDTH / 2 + len(self.algPos) * (BOX_WIDTH + MARGIN), BOX_HEIGHT + 2 * MARGIN + BOX_HEIGHT / 2 + len(self.algs) * (BOX_HEIGHT + MARGIN))
if len(self.algPos) != 0:
maxX = max([pos.x() for pos in self.algPos])
maxY = max([pos.y() for pos in self.algPos])
newX = min(MARGIN + BOX_WIDTH + maxX, self.CANVAS_SIZE - BOX_WIDTH)
newY = min(MARGIN + BOX_HEIGHT + maxY, self.CANVAS_SIZE - BOX_HEIGHT)
else:
newX = MARGIN + BOX_WIDTH / 2
newY = MARGIN * 2 + BOX_HEIGHT + BOX_HEIGHT / 2
return QtCore.QPointF(newX, newY)

def getPositionForParameterItem(self):
MARGIN = 20
BOX_WIDTH = 200
BOX_HEIGHT = 80
return QtCore.QPointF(MARGIN + BOX_WIDTH / 2 + len(self.paramPos) * (BOX_WIDTH + MARGIN), MARGIN + BOX_HEIGHT / 2)
if len(self.paramPos) != 0:
maxX = max([pos.x() for pos in self.paramPos])
newX = min(MARGIN + BOX_WIDTH + maxX, self.CANVAS_SIZE - BOX_WIDTH)
else:
newX = MARGIN + BOX_WIDTH / 2
return QtCore.QPointF(newX, MARGIN + BOX_HEIGHT / 2)

def serialize(self):
s="NAME:" + unicode(self.name) + "\n"
Expand Down
2 changes: 1 addition & 1 deletion src/sextante/modeler/ModelerDialog.py
Expand Up @@ -248,7 +248,7 @@ def openModel(self):

def repaintModel(self):
self.scene = ModelerScene()
self.scene.setSceneRect(QtCore.QRectF(0, 0, 4000, 4000))
self.scene.setSceneRect(QtCore.QRectF(0, 0, ModelerAlgorithm.CANVAS_SIZE, ModelerAlgorithm.CANVAS_SIZE))
self.scene.paintModel(self.alg)
self.view.setScene(self.scene)
#self.pythonText.setText(self.alg.getAsPythonCode())
Expand Down
1 change: 1 addition & 0 deletions src/sextante/modeler/ModelerGraphicItem.py
Expand Up @@ -62,6 +62,7 @@ def activateAlgorithm(self):
"The selected algorithm depends on other currently non-active algorithms.\nActivate them them before trying to activate it.")

def editElement(self):
self.model.setPositions(self.scene().getParameterPositions(), self.scene().getAlgorithmPositions())
if isinstance(self.element, Parameter):
dlg = ModelerParameterDefinitionDialog(self.model, param = self.element)
dlg.exec_()
Expand Down
3 changes: 2 additions & 1 deletion src/sextante/modeler/ModelerParameterDefinitionDialog.py
Expand Up @@ -203,7 +203,8 @@ def okPressed(self):
return
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_STRING or isinstance(self.param, ParameterString):
self.param = ParameterString(name, description, str(self.defaultTextBox.text()))

elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_EXTENT or isinstance(self.param, ParameterExtent):
self.param = ParameterExtent(name, description)
self.close()

def cancelPressed(self):
Expand Down
2 changes: 1 addition & 1 deletion src/sextante/modeler/ModelerParametersDialog.py
Expand Up @@ -166,6 +166,7 @@ def getExtents(self):
for param in params:
if isinstance(param, ParameterExtent):
extents.append(AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, param.name, "", param.description))
return extents

def getNumbers(self):
numbers = []
Expand Down Expand Up @@ -316,7 +317,6 @@ def getWidgetFromParameter(self, param):
files = self.getFiles()
for f in files:
item.addItem(f.name(), f)
item.setEditText(str(param.default))
else:
item = QtGui.QLineEdit()
try:
Expand Down
2 changes: 1 addition & 1 deletion src/sextante/parameters/ParameterTableField.py
Expand Up @@ -31,4 +31,4 @@ def deserialize(self, s):
return ParameterTableField(tokens[0], tokens[1], tokens[2])

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

0 comments on commit 9599c20

Please sign in to comment.