src/pyams_gis/widget/point.py
changeset 19 31ec78bbd5d6
parent 12 77e093529691
child 28 b9111ddc0ab7
equal deleted inserted replaced
18:8eef3d17a06f 19:31ec78bbd5d6
    55     """GeoPoint widget"""
    55     """GeoPoint widget"""
    56 
    56 
    57     def updateWidgets(self, setErrors=True):
    57     def updateWidgets(self, setErrors=True):
    58         super(GeoPointWidget, self).updateWidgets(setErrors)
    58         super(GeoPointWidget, self).updateWidgets(setErrors)
    59         widgets = self.subform.widgets
    59         widgets = self.subform.widgets
    60         widgets['longitude'].input_css_class = 'col-md-2'
    60         longitude = widgets['longitude']
    61         widgets['latitude'].input_css_class = 'col-md-2'
    61         longitude.label_css_class = 'control-label col-md-2'
    62         widgets['longitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
    62         longitude.input_css_class = 'col-md-2'
    63         widgets['latitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
    63         longitude.object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
    64         widgets['projection'].object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.position.changedProjection'}}
    64         alsoProvides(longitude, IObjectData)
    65         alsoProvides(widgets['longitude'], IObjectData)
    65         latitude = widgets['latitude']
    66         alsoProvides(widgets['latitude'], IObjectData)
    66         latitude.label_css_class = 'control-label col-md-2'
    67         alsoProvides(widgets['projection'], IObjectData)
    67         latitude.input_css_class = 'col-md-2'
       
    68         latitude.object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
       
    69         alsoProvides(latitude, IObjectData)
       
    70         projection = widgets['projection']
       
    71         projection.label_css_class = 'control-label col-md-2'
       
    72         projection.input_css_class = 'col-md-10'
       
    73         projection.object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.position.changedProjection'}}
       
    74         alsoProvides(projection, IObjectData)
    68 
    75 
    69     @property
    76     @property
    70     def wgs_coordinates(self):
    77     def wgs_coordinates(self):
    71         value = self.field.get(self.field.interface(self.context))
    78         value = self.field.get(self.field.interface(self.context))
    72         if not value:
    79         if not value:
   105     """GeoPointZ widget"""
   112     """GeoPointZ widget"""
   106 
   113 
   107     def updateWidgets(self, setErrors=True):
   114     def updateWidgets(self, setErrors=True):
   108         super(GeoPointZWidget, self).updateWidgets(setErrors)
   115         super(GeoPointZWidget, self).updateWidgets(setErrors)
   109         widgets = self.subform.widgets
   116         widgets = self.subform.widgets
   110         widgets['longitude'].input_css_class = 'col-md-2'
   117         longitude = widgets['longitude']
   111         widgets['latitude'].input_css_class = 'col-md-2'
   118         longitude.label_css_class = 'control-label col-md-2'
   112         widgets['altitude'].input_css_class = 'col-md-2'
   119         longitude.input_css_class = 'col-md-2'
   113         widgets['longitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
   120         longitude.object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
   114         widgets['latitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
   121         alsoProvides(longitude, IObjectData)
   115         widgets['projection'].object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.position.changedProjection'}}
   122         latitude = widgets['latitude']
   116         alsoProvides(widgets['longitude'], IObjectData)
   123         latitude.label_css_class = 'control-label col-md-2'
   117         alsoProvides(widgets['latitude'], IObjectData)
   124         latitude.input_css_class = 'col-md-2'
   118         alsoProvides(widgets['projection'], IObjectData)
   125         latitude.object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
       
   126         alsoProvides(latitude, IObjectData)
       
   127         projection = widgets['projection']
       
   128         projection.label_css_class = 'control-label col-md-2'
       
   129         latitude.input_css_class = 'col-md-10'
       
   130         projection.object_data = {'ams-events-handlers': {'change.select2': 'PyAMS_GIS.position.changedProjection'}}
       
   131         alsoProvides(projection, IObjectData)
       
   132         altitude = widgets['altitude']
       
   133         altitude.label_css_class = 'control-label col-md-2'
       
   134         altitude.input_css_class = 'col-md-2'
   119 
   135 
   120     @property
   136     @property
   121     def wgs_coordinates(self):
   137     def wgs_coordinates(self):
   122         value = self.field.get(self.field.interface(self.context))
   138         value = self.field.get(self.field.interface(self.context))
   123         if not value:
   139         if not value: