当前位置: 首页>>代码示例>>Python>>正文


Python widget.WidgetConfig类代码示例

本文整理汇总了Python中pyasm.widget.WidgetConfig的典型用法代码示例。如果您正苦于以下问题:Python WidgetConfig类的具体用法?Python WidgetConfig怎么用?Python WidgetConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WidgetConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_config

    def get_config(my):
        config = None
        config_xml = my.kwargs.get("config_xml")
        if config_xml:
            config = WidgetConfig.get(xml=config_xml, view=my.view)
            return config

        # this is the new preferred way of defining CustomLayoutWdg
        search = Search("config/widget_config")
        if my.category:
            search.add_filter("category", my.category)
        else:
            search.add_filter("category", "CustomLayoutWdg")
        if my.search_type:
            search.add_filter("search_type", my.search_type)

        search.add_filter("view", my.view)

        config = search.get_sobject()
        if config:
            return config
        # if it is not defined in the database, look at a config file

        includes = my.kwargs.get("include")
        if includes:
            includes = includes.split("|")

            for include in includes:
                tmp_path = __file__
                dir_name = os.path.dirname(tmp_path)
                file_path = "%s/../config/%s" % (dir_name, include)
                config = WidgetConfig.get(file_path=file_path, view=my.view)
                if config and config.has_view(my.view):
                    return config

        # deprecated approach, assuming a "CustomLayoutWdg" as search_type,
        # is deprecated
        if not config:
            search = Search("config/widget_config")
            if my.category:
                search.add_filter("category", my.category)
            if my.search_type:
                search.add_filter("search_type", "CustomLayoutWdg")

            search.add_filter("view", my.view)

            config = search.get_sobject()

        # if not config and my.search_type and my.view:
        #    config = WidgetConfigView.get_by_search_type(my.search_type, my.view)
        # this is the new preferred way of defining CustomLayoutWdg
        # NOTE: this finds a definition where search type is not explicitly
        # given>
        if not config:
            search = Search("config/widget_config")
            search.add_filter("view", my.view)
            search.add_filter("search_type", None)
            config = search.get_sobject()

        return config
开发者ID:hellios78,项目名称:TACTIC,代码行数:60,代码来源:custom_layout_wdg.py

示例2: add_internal_config

    def add_internal_config(cls, configs, views):
        '''add an internal config based on project base type'''
        project = Project.get()
        project_type = project.get_base_type()
        # catch potential invalid xpath error
        try:
            if project_type:
                tmp_path = __file__
                dir_name = os.path.dirname(tmp_path)
                file_path="%s/../config/%s-conf.xml" % (dir_name, project_type)
                if os.path.exists(file_path):
                    for view in views:
                        config = WidgetConfig.get(file_path=file_path, view=view)
                        if config.get_view_node():
                            configs.append(config)

            # finally, just look at the DEFAULT config
            tmp_path = __file__
            dir_name = os.path.dirname(tmp_path)
            file_path="%s/../config/%s-conf.xml" % (dir_name, "DEFAULT")
                
            if os.path.exists(file_path):
                for view in views:
                    config = WidgetConfig.get(file_path=file_path, view=view)
                    if config.get_view_node():
                        configs.append(config)

        except XmlException, e:
            msg = "Error with view [%s]"% ' '.join(views)
            error_list = Container.get_seq(cls.ERR_MSG)
            if msg not in error_list:
                Container.append_seq(cls.ERR_MSG, msg)
                print e.__str__()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:33,代码来源:base_section_wdg.py

示例3: get_def_config

    def get_def_config(my, def_xml=None):
        def_confg = None

        my.def_view = my.kwargs.get('definition')
        if my.def_view:
            #raise TacticException("No definition view defined in custom layout with view [%s]" % my.view)

            my.search_type = "CustomLayoutWdg"
            search = Search("config/widget_config")
            search.add_filter("search_type", my.search_type)
            search.add_filter("view", my.def_view)
            def_db_config = search.get_sobject()
            if not def_db_config:
                raise TacticException("Definition config [%s] not defined" % my.def_view)
            def_xml = def_db_config.get_xml()
            def_config = WidgetConfig.get("definition", xml=def_xml)


        # also look inline to see if there are any definitions        
        if def_xml:
            # just use the passed in xml for a definition
            def_config = WidgetConfig.get(my.view, xml=def_xml)


        return def_config
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:25,代码来源:custom_layout_wdg.py

示例4: get_last_filter_config

    def get_last_filter_config(search_type):

        # get the last search
        view = "saved_search:%s" % search_type

        search = Search('config/widget_config')
        search.add_filter("view", view)
        search.add_filter("search_type", search_type)
        search.add_user_filter()
        config_sobj = search.get_sobject()
        config = None
        if config_sobj:
            config_xml = config_sobj.get_xml_value("config")
            config = WidgetConfig.get(xml=config_xml, view='filter')
        return config
开发者ID:hellios78,项目名称:TACTIC,代码行数:15,代码来源:search_wdg.py

示例5: get_async_element_wdg

    def get_async_element_wdg(my, xml, element_name, load):

        tmp_config = WidgetConfig.get("tmp", xml=xml)
        display_handler = tmp_config.get_display_handler(element_name)
        display_options = tmp_config.get_display_options(element_name)

        div = DivWdg()
        unique_id = div.set_unique_id()

        if load == "sequence":
            my.sequence_data.append({"class_name": display_handler, "kwargs": display_options, "unique_id": unique_id})
        else:
            div.add_behavior(
                {
                    "type": "load",
                    "class_name": display_handler,
                    "kwargs": display_options,
                    "cbjs_action": """
                spt.panel.async_load(bvr.src_el, bvr.class_name, bvr.kwargs);
                """,
                }
            )

        loading_div = DivWdg()
        loading_div.add_style("margin: auto auto")
        loading_div.add_style("width: 150px")
        loading_div.add_style("text-align: center")
        loading_div.add_style("padding: 20px")
        div.add(loading_div)
        loading_div.add("""<img src="/context/icons/common/indicator_snake.gif" border="0"/> <b>Loading ...</b>""")

        return div
开发者ID:hellios78,项目名称:TACTIC,代码行数:32,代码来源:custom_layout_wdg.py

示例6: get_async_element_wdg

    def get_async_element_wdg(my, xml, element_name, load):

        tmp_config = WidgetConfig.get('tmp', xml=xml)
        display_handler = tmp_config.get_display_handler(element_name)
        display_options = tmp_config.get_display_options(element_name)

        div = DivWdg()
        unique_id = div.set_unique_id()

        if load == "sequence":
            my.sequence_data.append( {
                'class_name': display_handler,
                'kwargs': display_options,
                'unique_id': unique_id
            } )
        else:
            div.add_behavior( {
                'type': 'load',
                'class_name': display_handler,
                'kwargs': display_options,
                'cbjs_action': '''
                spt.panel.async_load(bvr.src_el, bvr.class_name, bvr.kwargs);
                '''
            } )

        loading_div = DivWdg()
        loading_div.add_style("margin: auto auto")
        loading_div.add_style("width: 150px")
        loading_div.add_style("text-align: center")
        loading_div.add_style("padding: 20px")
        div.add(loading_div)
        loading_div.add('''<img src="/context/icons/common/indicator_snake.gif" border="0"/> <b>Loading ...</b>''')

        return div
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:34,代码来源:custom_layout_wdg.py

示例7: init

    def init(my):
        """initialize the widget_config, and from there retrieve the schema_config"""
        web = WebContainer.get_web()
        my.search_type = my.kwargs.get("search_type")

        element_name = my.kwargs.get("element_name")
        my.view = my.kwargs.get("view")

        # FIXME: comment out the assert for now to avoid error screen
        if not my.view:
            my.view = "table"
        # assert my.view

        my.config_xml = my.kwargs.get("config_xml")
        if not my.config_xml:
            my.config_xml = web.get_form_value("config_xml")

        my.default = my.kwargs.get("default") == "True"

        cbk = ManageSearchTypeDetailCbk(search_type=my.search_type, view=my.view, element_name=element_name)
        Command.execute_cmd(cbk)

        my.config_string = ""
        my.data_type_string = ""
        my.name_string = ""
        my.title_string = ""
        my.nullable_string = ""
        my.has_column = True

        if element_name:
            if my.config_xml:
                my.config_string = my.config_xml
                whole_config_string = "<config><%s>%s</%s></config>" % (my.view, my.config_xml, my.view)
                config = WidgetConfig.get(xml=whole_config_string, view=my.view)
                my.config = WidgetConfigView(my.search_type, my.view, [config])
            else:
                # don't pass in default here
                my.config = my.get_config(my.search_type, my.view)
                node = my.config.get_element_node(element_name)
                if node is not None:
                    config_xml = my.config.get_xml()

                    my.config_string = config_xml.to_string(node)
                    my.title_string = config_xml.get_attribute(node, "title")
            schema_config = SearchType.get_schema_config(my.search_type)

            attributes = schema_config.get_element_attributes(element_name)
            my.data_type_string = attributes.get("data_type")

            # double_precision is float
            if my.data_type_string == "double precision":
                my.data_type_string = "float"

            my.name_string = attributes.get("name")
            my.nullable_string = attributes.get("nullable")
            my.is_new_column = attributes.get("new") == "True"

            # a database columnless widget
            if not my.name_string:
                my.has_column = False
开发者ID:pombredanne,项目名称:TACTIC,代码行数:60,代码来源:search_type_manager_wdg.py

示例8: _get_main_config

    def _get_main_config(self, view, process_names):
        '''get the main config for this table layout'''
        xml = Xml()
        xml.create_doc("config")
        root = xml.get_root_node()
        view_node = xml.create_element(view)
        #root.appendChild(view_node)
        xml.append_child(root, view_node)
        
        for idx, process_name in enumerate(process_names):
            element  = xml.create_element('element')
            Xml.set_attribute(element, 'name', process_name)
            #view_node.appendChild(element)
            xml.append_child(view_node, element)
            display =   xml.create_element('display')
            if self.element_class:
                Xml.set_attribute(display, 'class',self.element_class)
            else:
                Xml.set_attribute(display, 'class', "tactic.ui.app.NoteTableElementWdg")
            #element.appendChild(display)
            xml.append_child(element, display)

            op_element = xml.create_data_element('parent_key', self.search_key)
            xml.append_child(display, op_element)
            

        config_xml = xml.to_string()
        widget_config = WidgetConfig.get(view=view, xml = config_xml)
        widget_config_view = WidgetConfigView('sthpw/note', view, [widget_config])

        return widget_config_view
开发者ID:mincau,项目名称:TACTIC,代码行数:31,代码来源:note_wdg.py

示例9: _get_template_config

    def _get_template_config(self):

        base_dir = Environment.get_install_dir()
        file_path="%s/src/config2/search_type/search/DEFAULT-conf.xml" % base_dir
        if os.path.exists(file_path):
            widget_config = WidgetConfig.get(file_path=file_path, view='template')
        return widget_config
开发者ID:mincau,项目名称:TACTIC,代码行数:7,代码来源:search_type_manager_wdg.py

示例10: get_folder_wdg

    def get_folder_wdg(my, element_name, config, options, base_path, current_path, info, personal, use_same_config):
        li = HtmlElement.li()
        li.add_class("spt_side_bar_link")
        li.add_class("main_li")


        title = my._get_title(config, element_name)
        title_wdg = DivWdg()
        title_wdg.add_class("menu_header")
        li.add(title_wdg)
        title_wdg.add(title)


        ul = HtmlElement.ul()
        li.add(ul)
        ul.add_class("spt_side_bar_section")
        ul.add_class("sub_ul")

        # then get view name from options in order to read a new
        # config and recurse ...
        options_view_name = options.get('view')
        if options_view_name:
            if use_same_config:
                xml = config.get_xml()
                sub_config = WidgetConfig.get(xml=xml)
                sub_config.set_view(options_view_name)
            else:
                sub_config = my.get_config( my.config_search_type, options_view_name, default=my.default, personal=personal)

            info['level'] += 1
            my.generate_section( sub_config, ul, info, base_path=current_path, personal=personal, use_same_config=use_same_config )
            info['level'] -= 1

        return li
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:34,代码来源:simple_side_bar_wdg.py

示例11: get_config

    def get_config(my):
        # TEST
        config_xml = '''
        <config>
        <custom_filter>
          <element name='asset_library'>
            <display class='SelectWdg'>
                <query>prod/asset_library|code|code</query>
                <empty>true</empty>
            </display>
          </element>
          <element name='pipeline_code'>
            <display class='SelectWdg'>
                <query>sthpw/pipeline|code|code</query>
                <empty>true</empty>
            </display>
          </element>
        </custom_filter>
        </config>
        '''

        my.view = my.kwargs.get("search_view")
        if not my.view:
            my.view = 'custom_filter'
        #view = "custom_filter"
        project_code = Project.extract_project_code(my.search_type)
        search = Search("config/widget_config", project_code=project_code )
        search.add_filter("view", my.view)
        
       
        search.add_filter("search_type", my.base_search_type)
        config_sobj = search.get_sobject()
        if config_sobj:
            config_xml = config_sobj.get_value("config")
        
        else:
            config_xml = '''
            <config>
            <custom_filter>
            </custom_filter>
            </config>
            '''
            # use the one defined in the default config file
            file_configs = WidgetConfigView.get_configs_from_file(my.base_search_type, my.view)
            if file_configs:
                config = file_configs[0]
                xml_node = config.get_view_node()
                if xml_node is not None:
                    xml = Xml(config.get_xml().to_string())
                    config_xml = '<config>%s</config>' %xml.to_string(node=xml_node)

            


        from pyasm.widget import WidgetConfig
        config = WidgetConfig.get(view=my.view, xml=config_xml)

        return config
开发者ID:funic,项目名称:TACTIC,代码行数:58,代码来源:simple_search_wdg.py

示例12: get_config

    def get_config(self):


        self.view = self.kwargs.get("search_view")
        config = self.kwargs.get("search_config")

        if not self.view:
            self.view = 'custom_filter'
        #view = "custom_filter"

        project_code = Project.extract_project_code(self.search_type)

        search = Search("config/widget_config", project_code=project_code )
        search.add_filter("view", self.view)
        search.add_filter("search_type", self.base_search_type)
        config_sobjs = search.get_sobjects()

        from pyasm.search import WidgetDbConfig
        config_sobj = WidgetDbConfig.merge_configs(config_sobjs)

        if config_sobj:
            #config_xml = config_sobj.get("config")
            config_xml = config_sobj.get_xml().to_string()
            config_xml = config_xml.replace("&lt;", "<")
            config_xml = config_xml.replace("&gt;", ">")
            config_xml = Common.run_mako(config_xml)

        elif config:
            config_xml = '''
            <config>
            <custom_filter>%s
            </custom_filter>
            </config>
            ''' % config
        else:
            config_xml = '''
            <config>
            <custom_filter>
            </custom_filter>
            </config>
            '''
            # use the one defined in the default config file
            file_configs = WidgetConfigView.get_configs_from_file(self.base_search_type, self.view)
            if file_configs:
                config = file_configs[0]
                xml_node = config.get_view_node()
                if xml_node is not None:
                    xml = Xml(config.get_xml().to_string())
                    config_xml = '<config>%s</config>' %xml.to_string(node=xml_node)

            
        from pyasm.widget import WidgetConfig
        config = WidgetConfig.get(view=self.view, xml=config_xml)

        return config
开发者ID:mincau,项目名称:TACTIC,代码行数:55,代码来源:simple_search_wdg.py

示例13: get_config

    def get_config(my):

        my.view = my.kwargs.get("view")

        search = Search("config/widget_config")
        search.add_filter("category", "TabWdg")
        config_sobj = search.get_sobject()
        config_xml = config_sobj.get_value("config")
        config = WidgetConfig.get(view=my.view, xml=config_xml)

        return config
开发者ID:0-T-0,项目名称:TACTIC,代码行数:11,代码来源:tab_edit_wdg.py

示例14: get_default_filter_config

 def get_default_filter_config(my):
     custom_filter_view = my.kwargs.get('custom_filter_view')
     config = '''
     <config>
     <filter>
       <element name='Filter'>
         <display class='tactic.ui.filter.GeneralFilterWdg'>
           <prefix>%(prefix_namespace)s_main_body</prefix>
           <search_type>%(search_type)s</search_type>
           <mode>sobject</mode>
         </display>
       </element>
     </filter>
     </config>
     ''' % {'search_type': my.searchable_search_type, 'prefix_namespace': my.prefix_namespace  }
     config_xml = Xml()
     config_xml.read_string(config)
     config = WidgetConfig.get(xml=config_xml, view='filter')
     return config
开发者ID:hellios78,项目名称:TACTIC,代码行数:19,代码来源:search_wdg.py

示例15: get_folder_wdg

    def get_folder_wdg(self, element_name, config, options, base_path, current_path, info, personal, use_same_config):

        attributes = config.get_element_attributes(element_name)
        if attributes.get("is_visible") == "false":
            return


        li = HtmlElement.li()
        li.add_class("spt_side_bar_link")
        li.add_class("main_li unselectable")


        title = self._get_title(config, element_name)
        title_wdg = DivWdg()
        title_wdg.add_class("menu_header")
        li.add(title_wdg)
        title_wdg.add(title)


        ul = HtmlElement.ul()
        li.add(ul)
        ul.add_class("spt_side_bar_section")
        ul.add_class("sub_ul unselectable")
        ul.add_style('cursor','pointer')

        # then get view name from options in order to read a new
        # config and recurse ...
        options_view_name = options.get('view')
        if options_view_name:
            if use_same_config:
                xml = config.get_xml()
                sub_config = WidgetConfig.get(xml=xml)
                sub_config.set_view(options_view_name)
            else:
                sub_config = self.get_config( self.config_search_type, options_view_name, default=self.default, personal=personal)

            info['level'] += 1
            self.generate_section( sub_config, ul, info, base_path=current_path, personal=personal, use_same_config=use_same_config )
            info['level'] -= 1

        return li
开发者ID:mincau,项目名称:TACTIC,代码行数:41,代码来源:simple_side_bar_wdg.py


注:本文中的pyasm.widget.WidgetConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。