Example #1
0
    def get_all_presets_from_server(self):

        server = tc.server_start()

        key = 'search_type:{0}'.format(self.stype.get_code())

        search_type = 'sthpw/wdg_settings'

        project_code = self.stype.get_project().get_code()

        filters = [('key', 'like', '{0}%'.format(key)),
                   ('project_code', project_code)]
        columns = ['data']

        presets = server.query(search_type, filters, columns)

        if not presets:
            self.presets_list = [{
                'pretty_preset_name': 'Default',
                'preset_name': 'default',
            }]
        else:

            new_presets_list = []
            for preset in presets:
                new_presets_list.append(gf.from_json(preset['data']))

            self.presets_list = new_presets_list
Example #2
0
 def revert_scripts_tree_state(self, state_raw):
     state = gf.from_json(state_raw, use_ast=True)
     gf.tree_state_revert(self.scripts_tree_widget,
                          state,
                          use_item_widgets=False)