Beispiel #1
0
 def map_viewlet_position(self):
     styles = queryAdapter(self.context, IGeoCustomFeatureStyle)
     if styles and styles.use_custom_styles:
         return styles.map_viewlet_position
     else:
         styles = utils.geo_styles()
         return styles.map_viewlet_position
def run(context, logger=None):

    if logger is None:
        logger = logging.getLogger('collective.geo.settings')

    # Fix/Set marker_image
    registry = getUtility(IRegistry)
    registry_key_marker_image = 'collective.geo.settings.interfaces.IGeoFeatureStyle.marker_image'
    registry._records._fields[registry_key_marker_image].default = DEFAULT_MARKER_LOCATION

    styles_settings = geo_styles()
    marker_image = styles_settings.marker_image
    if marker_image == OLD_DEFAULT_MARKER_LOCATION or not marker_image:
        styles_settings.marker_image = DEFAULT_MARKER_LOCATION


    # Fix set imgpath
    registry_key_location_images = 'collective.geo.settings.interfaces.IGeoFeatureStyle.marker_image'
    registry._records._fields[registry_key_location_images].default = DEFAULT_IMAGE_LOCATION

    general_settings = geo_settings()
    img_path = general_settings.imgpath
    if img_path == OLD_DEFAULT_IMAGE_LOCATION or not img_path:
        general_settings.imgpath = DEFAULT_IMAGE_LOCATION

    logger.info('New default value for registry field "marker_image" and '
                '"imgpath" has been set')
 def geo_feature_style(self):
     fields = [i for i in getFields(IGeoFeatureStyle)]
     manager = IGeoFeatureStyle(self.context, None)
     use_custom_styles = getattr(manager, 'use_custom_styles', False)
     if not use_custom_styles:
         manager = utils.geo_styles(self.context)
     styles = {'use_custom_styles': use_custom_styles}
     for name in fields:
         styles[name] = getattr(manager, name, None)
     styles['marker_image'] = get_marker_image(self.context,
                                               styles['marker_image'])
     return styles
Beispiel #4
0
 def geo_feature_style(self):
     fields = [i for i in getFields(IGeoFeatureStyle)]
     manager = IGeoFeatureStyle(self.context, None)
     use_custom_styles = getattr(manager, 'use_custom_styles', False)
     if not use_custom_styles:
         manager = utils.geo_styles(self.context)
     styles = {
         'use_custom_styles': use_custom_styles
     }
     for name in fields:
         styles[name] = getattr(manager, name, None)
     styles['marker_image'] = get_marker_image(self.context,
                                               styles['marker_image'])
     return styles