Exemple #1
0
def __handle_get_edit_instance():
    # get widget instances of default group:
    instances = widget.get_widget_instances()
    all_settings = widget.get_all_instances_settings()
    import logging
    for s in all_settings:
        logging.warning('Load all settings: ' + s.setting_name + '=' + s.setting_value)
    widget.bind_instance_model(instances, all_settings)
    for instance in instances:
        wclass = widget.get_installed_widget(instance.widget_id)
        logging.warning('\n\n\n$$\n\n' + str(wclass))
        def_setting_dict = widget.get_widget_settings(wclass)
        logging.warning('\n\n\n###\n\n\n' + str(def_setting_dict))
        ins_settings = store.get_instance_settings(instance)
        # attach ins_settings to def_settings:
        for key in def_setting_dict:
            for ins_setting in ins_settings:
                if key==ins_setting.setting_name:
                    def_setting_dict[key].value = ins_setting.setting_value
        instance.settings = def_setting_dict

    return {
            'template' : 'widget_edit.html',
            'setting_to_html' : widget_setting_to_html,
            'instances' : instances,
            'installed_widgets' : get_installed_widgets_details()
    }
Exemple #2
0
def __handle_get_edit_instance():
    # get widget instances of default group:
    instances = widget.get_widget_instances()
    all_settings = widget.get_all_instances_settings()
    import logging
    for s in all_settings:
        logging.warning('Load all settings: ' + s.setting_name + '=' +
                        s.setting_value)
    widget.bind_instance_model(instances, all_settings)
    for instance in instances:
        wclass = widget.get_installed_widget(instance.widget_id)
        logging.warning('\n\n\n$$\n\n' + str(wclass))
        def_setting_dict = widget.get_widget_settings(wclass)
        logging.warning('\n\n\n###\n\n\n' + str(def_setting_dict))
        ins_settings = store.get_instance_settings(instance)
        # attach ins_settings to def_settings:
        for key in def_setting_dict:
            for ins_setting in ins_settings:
                if key == ins_setting.setting_name:
                    def_setting_dict[key].value = ins_setting.setting_value
        instance.settings = def_setting_dict

    return {
        'template': 'widget_edit.html',
        'setting_to_html': widget_setting_to_html,
        'instances': instances,
        'installed_widgets': get_installed_widgets_details()
    }
Exemple #3
0
def update_model(rootpath, appname, model):

    # set current theme = 'simple':
    theme = shared.get_setting('theme', 'selected', '')
    if not theme:
        themes = manage.get_themes()
        theme = themes[0]
        shared.save_setting('theme', 'selected', theme)
    model['theme'] = theme
    # add widgets:
    instances = widget.get_widget_instances()
    all_settings = widget.get_all_instances_settings()
    widget.bind_instance_model(instances, all_settings)
    import logging
    model['widgets'] = instances
    model['show_widget__raw__'] = show_widget
    logging.warning('loaded ' + str(instances))
Exemple #4
0
def update_model(rootpath, appname, model):

    # set current theme = 'simple':
    theme = shared.get_setting('theme', 'selected', '')
    if not theme:
        themes = manage.get_themes()
        theme = themes[0]
        shared.save_setting('theme', 'selected', theme)
    model['theme'] = theme
    # add widgets:
    instances = widget.get_widget_instances()
    all_settings = widget.get_all_instances_settings()
    widget.bind_instance_model(instances, all_settings)
    import logging
    model['widgets'] = instances
    model['show_widget__raw__'] = show_widget
    logging.warning('loaded ' + str(instances))