From 3dc8bf9599a1fafa567f07f893cbbee1ca424ad9 Mon Sep 17 00:00:00 2001 From: jjdelcerro Date: Sat, 3 Dec 2022 22:52:43 +0100 Subject: [PATCH] =?UTF-8?q?Corregido=20el=20error=20que=20daba=20por=20los?= =?UTF-8?q?=20cambios=20en=20el=20API=20del=20constructor=20de=20expresion?= =?UTF-8?q?es=20y=20a=C3=B1adidas=20cconvertiones=20de=20tipo=20explicitas?= =?UTF-8?q?=20para=20evitar=20errores=20(a=20boolean=20y=20a=20Expression)?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.info | 3 +-- quickinfo.py | 6 ++++-- quickinfopanel.py | 13 ++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/package.info b/package.info index e3b5264..bf0f0b6 100644 --- a/package.info +++ b/package.info @@ -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 @@ -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 diff --git a/quickinfo.py b/quickinfo.py index 700d450..ae9ceb9 100644 --- a/quickinfo.py +++ b/quickinfo.py @@ -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 @@ -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": diff --git a/quickinfopanel.py b/quickinfopanel.py index c1e990a..a40ccc2 100644 --- a/quickinfopanel.py +++ b/quickinfopanel.py @@ -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): @@ -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) @@ -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) @@ -124,7 +127,7 @@ def save(self): ) self.__layer.setProperty( "quickinfo.expression", - self.getExpression() + ExpressionUtils.getPhrase(self.getExpression()) ) self.__layer.setProperty( "quickinfo.active", @@ -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"