Skip to content

Commit

Permalink
Corregido el error que daba por los cambios en el API del constructor…
Browse files Browse the repository at this point in the history
… de expresiones y añadidas cconvertiones de tipo explicitas para evitar errores (a boolean y a Expression).
  • Loading branch information
jjdelcerro committed Dec 3, 2022
1 parent ba73ff4 commit 3dc8bf9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
3 changes: 1 addition & 2 deletions package.info
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
#Sat Oct 05 18:25:01 CEST 2019
#Sat Oct 05 18:23:56 CEST 2019
owner=gvSIG Association
code=quickinfo
java-version=j1_7
Expand All @@ -17,6 +17,5 @@ categories=View
description=Show information over a vector data shape and it is updated when the mouse is moving between features.
owner-url=http\://www.gvsig.com/
buildNumber=12
download-url=https\://github.com/gvSIGAssociation/gvsig-desktop-scripting-quickinfo/releases/download/1.0.0-12/gvSIG-desktop-2.5.0-quickinfo-1.0.0-12-testing-all-all-j1_7.gvspkg
gvSIG-version=2.5.0
name=Tools\: Quick Info
6 changes: 4 additions & 2 deletions quickinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from gvsig import LOGGER_WARN,LOGGER_INFO,LOGGER_ERROR
from org.gvsig.expressionevaluator import ExpressionEvaluatorLocator
from org.gvsig.fmap.dal import DALLocator
from org.gvsig.tools.dataTypes import DataTypeUtils
from org.gvsig.expressionevaluator import ExpressionUtils

def trace(msg):
#print "###> ", msg
Expand All @@ -23,9 +25,9 @@ def __init__(self):
def getTooltipValue(self, point, projection):
try:
fieldName = self.__layer.getProperty("quickinfo.fieldname")
expression = self.__layer.getProperty("quickinfo.expression")
expression = ExpressionUtils.createExpression(self.__layer.getProperty("quickinfo.expression"))
mode = self.__layer.getProperty("quickinfo.mode")
activate = self.__layer.getProperty("quickinfo.active")
activate = DataTypeUtils.toBoolean(self.__layer.getProperty("quickinfo.active"))
if activate == False:
return
if mode == "useField":
Expand Down
13 changes: 8 additions & 5 deletions quickinfopanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
from gvsig import LOGGER_WARN,LOGGER_INFO,LOGGER_ERROR
from org.gvsig.tools.evaluator import EvaluatorException
from org.gvsig.expressionevaluator.swing import ExpressionEvaluatorSwingLocator
from org.gvsig.expressionevaluator import ExpressionUtils

from org.gvsig.fmap.dal.swing import DALSwingLocator
from org.gvsig.tools.dataTypes import DataTypeUtils
from org.gvsig.expressionevaluator import ExpressionUtils

class QuickinfoPanel(FormPanel):
def __init__(self, layer=None):
Expand All @@ -47,7 +50,7 @@ def __init__(self, layer=None):
self.store = layer.getFeatureStore()
self.expPicker = ExpressionEvaluatorSwingLocator.getManager().createExpressionPickerController(self.txtExp, self.btnExp)
self.expFilterStore = DALSwingLocator.getSwingManager().createFeatureStoreElement(self.store)
self.expPicker.addElement(self.expFilterStore)
self.expPicker.getConfig().addElement(self.expFilterStore)


self.rdoUseField.setSelected(True)
Expand All @@ -64,10 +67,10 @@ def setLayer(self, layer):
else:
featureType = self.__layer.getFeatureStore().getDefaultFeatureType()
self.fillCombo( self.cboFields, featureType )
s = self.__layer.getProperty("quickinfo.expression")
s = ExpressionUtils.createExpression(self.__layer.getProperty("quickinfo.expression"))
self.expPicker.set(s)
if self.__layer.getProperty("quickinfo.active") != None:
self.chbActivate.setSelected(self.__layer.getProperty("quickinfo.active"))
self.chbActivate.setSelected(DataTypeUtils.toBoolean(self.__layer.getProperty("quickinfo.active")))

if self.__layer.getProperty("quickinfo.mode") == "useField":
self.rdoUseField.setSelected(True)
Expand Down Expand Up @@ -124,7 +127,7 @@ def save(self):
)
self.__layer.setProperty(
"quickinfo.expression",
self.getExpression()
ExpressionUtils.getPhrase(self.getExpression())
)
self.__layer.setProperty(
"quickinfo.active",
Expand Down Expand Up @@ -162,7 +165,7 @@ def main(*args):
"Quickinfo information",
winmgr.BUTTONS_OK_CANCEL
)
dialog.show(winmgr.MODE.DIALOG)
dialog.show(winmgr.MODE.WINDOW)
if dialog.getAction()==winmgr.BUTTON_OK:
panel.save()
print "Ok"
Expand Down

0 comments on commit 3dc8bf9

Please sign in to comment.