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


Python WidgetConfig.get_by_search_type方法代码示例

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


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

示例1: check

# 需要导入模块: from pyasm.widget import WidgetConfig [as 别名]
# 或者: from pyasm.widget.WidgetConfig import get_by_search_type [as 别名]
    def check(my):
        my.web = WebContainer.get_web()
        search_type = my.sobject.get_search_type_obj()
        
        config = WidgetConfig.get_by_search_type(search_type, "insert", local_search=True)
        columns = config.get_element_names()

        if len(columns) != 3:
            raise TacticException('The command is expecting 3 fields only.')
      
        my.date = my.web.get_form_value('edit|%s' % columns[0])
        my.desc =  my.web.get_form_value('edit|%s'% columns[1])
        date = Date(db_date=my.date)
        my.year = date.get_year()
        my.week = date.get_week()
        my.project_code =  my.web.get_form_value('edit|%s'% columns[2])
         
        if not my.desc or not my.date or not my.project_code:
            raise UserException('One or more fields are empty.')
        Project.set_project(my.project_code)
        return True
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:23,代码来源:timecard_wdg.py

示例2: get_display

# 需要导入模块: from pyasm.widget import WidgetConfig [as 别名]
# 或者: from pyasm.widget.WidgetConfig import get_by_search_type [as 别名]
    def get_display(my):
        if not my.search_type:
            return "No search type found"

        web = WebContainer.get_web()
        my.view = web.get_form_value("view")
        if not my.view:
            my.view = web.get_form_value("filter|view")
        if not my.view:
            my.view = get_template_view()

        widget = Widget()

        widget.add( HiddenWdg("search_type", my.search_type) )

        element_names = []

        # see if there is an override
        search_type_obj = SearchType.get(my.search_type)  
        config = WidgetConfig.get_by_search_type(my.search_type,"browser_list")
        if config:
            element_names = config.get_element_names()


        search = Search("sthpw/widget_config")
        search.add_filter("search_type", my.search_type)
        search.add_filter("view", my.view)
        widget_config = search.get_sobject()
        if widget_config:
            edit_link_wdg = EditLinkWdg("sthpw/widget_config", widget_config.get_id(), text="Edit XML", long=True)
            edit_link_wdg.set_iframe_width(95)
            widget.add(edit_link_wdg)


        custom_config = WidgetConfigView.get_by_search_type(my.search_type,my.view)
        custom_element_names = custom_config.get_element_names()


        # get the custom properties
        search = Search("prod/custom_property")
        search.add_filter("search_type", my.search_type)
        custom_properties = search.get_sobjects()


        # action popup
        action_popup = PopupMenuWdg("table_action", multi=True, width='12em')
        action_popup.set_auto_hide(False)
        action_popup.set_submit(False)

        
        action_popup.add( HtmlElement.href("Add ...", "javascript:document.form.submit()") )


        for custom_property in custom_properties:
            element_name = custom_property.get_name()
            if element_name not in custom_element_names:
                action_popup.add( " %s" % element_name, "add|%s" % element_name )

        # if there is an override
        if element_names:
            for element_name in element_names:
                if element_name not in custom_element_names:
                    action_popup.add( " %s" % element_name, "add|%s" % element_name )


        # get all of the columns
        else:
            search_type_obj = SearchType.get(my.search_type)
            element_names = search_type_obj.get_columns()

            for element_name in element_names:
                if element_name not in custom_element_names:
                    action_popup.add( " %s" % element_name, "add|%s" % element_name )

            # add some standard properties
            if my.view in ["edit", "insert"]:
                for element_name in PREDEFINED_EDIT_ELEMENTS:
                    if element_name not in custom_element_names:
                        action_popup.add( " %s" % element_name, "add|%s" % element_name )
            else:
                for element_name in PREDEFINED_ELEMENTS:
                    if element_name not in custom_element_names:
                        action_popup.add( " %s" % element_name, "add|%s" % element_name )

        action_popup.add_separator()
        action_popup.add( HtmlElement.href("Remove ...", "javascript:document.form.submit()") )
        for element_name in custom_element_names:
            action_popup.add( " %s" % element_name, "remove|%s" % element_name )
        action_popup.add_separator()

        span = SpanWdg("New Custom ...", css="hand")
        iframe = WebContainer.get_iframe()
        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", "pyasm.widget.CustomAddPropertyWdg")
        url.set_option("search_type", my.search_type)
        url.set_option("view", my.view)
        action = iframe.get_on_script(url.to_string() )
        span.add_event("onclick", action)
        action_popup.add( span )

#.........这里部分代码省略.........
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:103,代码来源:custom_view_wdg.py


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