# HG changeset patch # User Thierry Florac # Date 1516979179 -3600 # Node ID 31ec78bbd5d665675621abeab66939d6a07e6977 # Parent 8eef3d17a06fd51df45ab73431a258fbd59ec5d9 Updated GPS widget diff -r 8eef3d17a06f -r 31ec78bbd5d6 src/pyams_gis/widget/area.py --- a/src/pyams_gis/widget/area.py Fri Jan 26 15:59:57 2018 +0100 +++ b/src/pyams_gis/widget/area.py Fri Jan 26 16:06:19 2018 +0100 @@ -57,20 +57,29 @@ def updateWidgets(self, setErrors=True): super(GeoAreaWidget, self).updateWidgets() widgets = self.subform.widgets - widgets['x1'].input_css_class = 'col-md-2' - widgets['y1'].input_css_class = 'col-md-2' - widgets['x2'].input_css_class = 'col-md-2' - widgets['y2'].input_css_class = 'col-md-2' - widgets['x1'].object_data = {'ams-change-handler': 'PyAMS_GIS.area.changedCoordinate'} - widgets['y1'].object_data = {'ams-change-handler': 'PyAMS_GIS.area.changedCoordinate'} - widgets['x2'].object_data = {'ams-change-handler': 'PyAMS_GIS.area.changedCoordinate'} - widgets['y2'].object_data = {'ams-change-handler': 'PyAMS_GIS.area.changedCoordinate'} - widgets['projection'].object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.area.changedProjection'}} - alsoProvides(widgets['x1'], IObjectData) - alsoProvides(widgets['y1'], IObjectData) - alsoProvides(widgets['x2'], IObjectData) - alsoProvides(widgets['y2'], IObjectData) - alsoProvides(widgets['projection'], IObjectData) + x1 = widgets['x1'] + x1.input_css_class = 'col-md-2' + x1.object_data = {'ams-change-handler': 'PyAMS_GIS.area.changedCoordinate'} + alsoProvides(x1, IObjectData) + x2 = widgets['x2'] + x2.input_css_class = 'col-md-2' + x2.object_data = {'ams-change-handler': 'PyAMS_GIS.area.changedCoordinate'} + alsoProvides(x2, IObjectData) + y1 = widgets['y1'] + y1.input_css_class = 'col-md-2' + y1.object_data = {'ams-change-handler': 'PyAMS_GIS.area.changedCoordinate'} + alsoProvides(y1, IObjectData) + y2 = widgets['y2'] + y2.input_css_class = 'col-md-2' + y2.object_data = {'ams-change-handler': 'PyAMS_GIS.area.changedCoordinate'} + alsoProvides(y2, IObjectData) + projection = widgets['projection'] + projection.object_data = { + 'ams-events-handlers': { + 'change.select2': 'PyAMS_GIS.area.changedProjection' + } + } + alsoProvides(projection, IObjectData) @property def wgs_coordinates(self): diff -r 8eef3d17a06f -r 31ec78bbd5d6 src/pyams_gis/widget/point.py --- a/src/pyams_gis/widget/point.py Fri Jan 26 15:59:57 2018 +0100 +++ b/src/pyams_gis/widget/point.py Fri Jan 26 16:06:19 2018 +0100 @@ -57,14 +57,21 @@ def updateWidgets(self, setErrors=True): super(GeoPointWidget, self).updateWidgets(setErrors) widgets = self.subform.widgets - widgets['longitude'].input_css_class = 'col-md-2' - widgets['latitude'].input_css_class = 'col-md-2' - widgets['longitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'} - widgets['latitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'} - widgets['projection'].object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.position.changedProjection'}} - alsoProvides(widgets['longitude'], IObjectData) - alsoProvides(widgets['latitude'], IObjectData) - alsoProvides(widgets['projection'], IObjectData) + longitude = widgets['longitude'] + longitude.label_css_class = 'control-label col-md-2' + longitude.input_css_class = 'col-md-2' + longitude.object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'} + alsoProvides(longitude, IObjectData) + latitude = widgets['latitude'] + latitude.label_css_class = 'control-label col-md-2' + latitude.input_css_class = 'col-md-2' + latitude.object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'} + alsoProvides(latitude, IObjectData) + projection = widgets['projection'] + projection.label_css_class = 'control-label col-md-2' + projection.input_css_class = 'col-md-10' + projection.object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.position.changedProjection'}} + alsoProvides(projection, IObjectData) @property def wgs_coordinates(self): @@ -107,15 +114,24 @@ def updateWidgets(self, setErrors=True): super(GeoPointZWidget, self).updateWidgets(setErrors) widgets = self.subform.widgets - widgets['longitude'].input_css_class = 'col-md-2' - widgets['latitude'].input_css_class = 'col-md-2' - widgets['altitude'].input_css_class = 'col-md-2' - widgets['longitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'} - widgets['latitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'} - widgets['projection'].object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.position.changedProjection'}} - alsoProvides(widgets['longitude'], IObjectData) - alsoProvides(widgets['latitude'], IObjectData) - alsoProvides(widgets['projection'], IObjectData) + longitude = widgets['longitude'] + longitude.label_css_class = 'control-label col-md-2' + longitude.input_css_class = 'col-md-2' + longitude.object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'} + alsoProvides(longitude, IObjectData) + latitude = widgets['latitude'] + latitude.label_css_class = 'control-label col-md-2' + latitude.input_css_class = 'col-md-2' + latitude.object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'} + alsoProvides(latitude, IObjectData) + projection = widgets['projection'] + projection.label_css_class = 'control-label col-md-2' + latitude.input_css_class = 'col-md-10' + projection.object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.position.changedProjection'}} + alsoProvides(projection, IObjectData) + altitude = widgets['altitude'] + altitude.label_css_class = 'control-label col-md-2' + altitude.input_css_class = 'col-md-2' @property def wgs_coordinates(self): diff -r 8eef3d17a06f -r 31ec78bbd5d6 src/pyams_gis/widget/templates/geoarea-input.pt --- a/src/pyams_gis/widget/templates/geoarea-input.pt Fri Jan 26 15:59:57 2018 +0100 +++ b/src/pyams_gis/widget/templates/geoarea-input.pt Fri Jan 26 16:06:19 2018 +0100 @@ -2,7 +2,8 @@
+