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


Python WidgetConfigView.get_by_search_type方法代码示例

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


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

示例1: get_config

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def get_config(cls, search_type, view, default=None, personal=False):
        # personal doesn't mean much here since this is only for Project view definition
        """
        if view == "__column__":
            xml == '''
            <config>
                <element name="tttt" type="__database__"/>
                <element name="uuuu" type="__database__"/>
                <element name="vvvv" type="__database__"/>
            </config>
            '''
        """
        widget_config = None
        config_view = None
        widget_config_list = []

        # get all the configs relevant to this search_type
        configs = []

        from pyasm.widget import WidgetConfigView

        if view == "definition":
            if default:
                try:
                    default_config_view = WidgetConfigView.get_by_search_type(
                        search_type, view, use_cache=False, local_search=True
                    )

                    user_config_view = WidgetConfigView.get_by_search_type(search_type, view)

                    # merge the user config view from db into the default config view in xml file
                    default_config = default_config_view.get_definition_config()
                    user_config = user_config_view.get_definition_config()
                    if user_config:
                        user_element_names = user_config.get_element_names()
                        # make sure it's unique, there is a new validate function for
                        # WidgetDbConfig to ensure that also
                        user_element_names = Common.get_unique_list(user_element_names)
                        for elem in user_element_names:
                            user_node = user_config.get_element_node(elem)
                            default_config.append_xml_element(elem, node=user_node)
                except SqlException, e:
                    print "Search ERROR: ", e.__str__()
                    default_config = None

                if default_config:
                    default_config.get_xml().clear_xpath_cache()
                    widget_config_list = [default_config]

            else:
                config_view = WidgetConfigView.get_by_search_type(search_type, view, use_cache=True)
开发者ID:pombredanne,项目名称:TACTIC,代码行数:53,代码来源:search_type_manager_wdg.py

示例2: execute

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def execute(my):

        search_keys = my.kwargs.get("search_keys")
        if not search_keys:
            return

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

        # get all of the sobjects
        sobjects = Search.get_by_search_keys(search_keys)
        if not sobjects:
            return

        from pyasm.widget import WidgetConfigView

        search_type = sobjects[0].get_base_search_type()
        view = "definition"

        config = WidgetConfigView.get_by_search_type(search_type, view)

        # TEST
        widget = config.get_display_widget(element_name)
        for sobject in sobjects:
            widget.set_sobject(sobject)
            value = widget.get_text_value()
            sobject.set_value(element_name, value)
            sobject.commit()
开发者ID:raidios,项目名称:TACTIC,代码行数:29,代码来源:expression_element_wdg.py

示例3: execute

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def execute(my):

        my.search_type = my.kwargs.get('search_type')
        my.element_name = my.kwargs.get('element_name')
        #print "Calculating aggregate: ", my.search_type, my.element_name

        my.view = my.kwargs.get('view')
        if not my.view:
            my.view = 'definition'

        config = WidgetConfigView.get_by_search_type(search_type=my.search_type, view=my.view)
        widget = config.get_display_widget(my.element_name)

        # calculate all of the values
        search = Search(my.search_type)
        sobjects = search.get_sobjects()
        widget.set_sobjects(sobjects)
        widget.kwargs['use_cache'] = "false"

        for i, sobject in enumerate(sobjects):
            widget.set_current_index(i)
            value = widget.get_text_value()

            print sobject.get_code(), "value [%s]: " %value

            # all cache columns need are named with a c_ preceeding it
            # s_status
            # c_element_name
            #
            # this_month -> c_this_month
            #column = "c_%s" % my.element_name
            #sobject.set_value(column, value)
            sobject.set_value(my.element_name, value)
            sobject.commit()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:36,代码来源:aggregate_wdg.py

示例4: append

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def append(cls, search_type, view, name, class_name=None, display_options={}, element_attrs={}, config_xml=None, login=None):
        '''append an element with display class and options to the specified widget config'''
        assert view
        config_search_type = "config/widget_config"

        search = Search(config_search_type)
        search.add_filter("search_type", search_type)
        search.add_filter("view", view)
        search.add_filter("login", login)
        db_config = search.get_sobject()
        config_exists = True
        view_node = None
        if not db_config:
            db_config = SearchType.create(config_search_type)
            db_config.set_value("search_type", search_type )
            db_config.set_value("view", view )
            if login:
                db_config.set_value("login", login)

            config_exists = False

        # maintain the config variable here to mean WidgetConfig
        from pyasm.widget import WidgetConfigView
        if not config_exists and search_type not in ["SideBarWdg"]:
            config_view = WidgetConfigView.get_by_search_type(search_type, view)            
            #xml = config.get_xml()
            configs = config_view.get_configs()
            if configs:
                config = configs[0]
                view_node = config.get_view_node()
                config_exists = True
        
        if not config_exists:
            xml = db_config.get_xml_value("config", "config")
            db_config._init()
            root = xml.get_root_node()
            # build a new config
            view_node = xml.create_element(view)
            #root.appendChild(view_node)
            xml.append_child(root, view_node)
        else:   
            xml = db_config.get_xml_value("config", "config")
            root = xml.get_root_node()
            # it could be passed in thru a widget_config already
            if view_node is None:
                view_node = db_config.get_view_node()
            #root.appendChild(view_node)
            xml.append_child(root, view_node)

            db_config._init()

        if config_xml:
            db_config.append_xml_element( name, config_xml)
        else:
            db_config.append_display_element(name, class_name, options=display_options, element_attrs=element_attrs)
        db_config.commit_config()

        return db_config
开发者ID:mincau,项目名称:TACTIC,代码行数:60,代码来源:widget_db_config.py

示例5: get_info_wdg

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def get_info_wdg(my, sobject):

        div = DivWdg()
        div.add_style("margin: 10px 20px 20px 20px")
        div.add_style("padding: 20px")
        div.add_color("background", "background", -3)
        div.add_border()
        div.add_color("color", "color3")
        div.set_round_corners(5)

        div.add_style("height", "100%")
        div.add_style("position: relative")

        element_names = my.kwargs.get("element_names")
        if not element_names:
            element_names = ["code","name","description",]
        else:
            element_names = element_names.split(",")


        view = "table"

        from pyasm.widget import WidgetConfigView
        search_type = sobject.get_search_type()
        config = WidgetConfigView.get_by_search_type(search_type, view)


        table = Table()
        table.add_style("height", "100%")
        div.add(table)
        for element_name in element_names:
            table.add_row()
            title = Common.get_display_title(element_name)
            td = table.add_cell("%s: " % title)
            td.add_style("width: 200px")
            td.add_style("padding: 5px")


            element = config.get_display_widget(element_name)
            element.set_sobject(sobject)
            element.preprocess()
            td = table.add_cell(element)
            td.add_style("padding: 5px")
            #value = sobject.get_value(element_name, no_exception=True) or "N/A"
            #table.add_cell(value)

        div.add("<br/>")
        from tactic.ui.widget import DiscussionWdg
        search_key = sobject.get_search_key()
        notes_wdg = DiscussionWdg(search_key=search_key)
        notes_wdg.set_sobject(sobject)
        div.add(notes_wdg)

        return div
开发者ID:nuxping,项目名称:TACTIC,代码行数:56,代码来源:tool_layout_wdg.py

示例6: init_color_map

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def init_color_map(my):
        ''' initialize the color map for bg color and text color'''
        search_type = my.kwargs.get('search_type')
        
        if not search_type:
            search_type = 'sthpw/task'

        # get the color map
        from pyasm.widget import WidgetConfigView
        color_config = WidgetConfigView.get_by_search_type(search_type, "color")
        color_xml = color_config.configs[0].xml
        my.color_map = {}
        name = 'status'
        xpath = "config/color/element[@name='%s']/colors" % name
        text_xpath = "config/color/element[@name='%s']/text_colors" % name
        bg_color_node = color_xml.get_node(xpath)
        bg_color_map = color_xml.get_node_values_of_children(bg_color_node)

        text_color_node = color_xml.get_node(text_xpath)
        text_color_map = color_xml.get_node_values_of_children(text_color_node)
        
        # use old weird query language
        query = bg_color_map.get("query")
        query2 = bg_color_map.get("query2")
        if query:
            bg_color_map = {}

            search_type, match_col, color_col = query.split("|")
            search = Search(search_type)
            sobjects = search.get_sobjects()

            # match to a second table
            if query2:
                search_type2, match_col2, color_col2 = query2.split("|")
                search2 = Search(search_type2)
                sobjects2 = search2.get_sobjects()
            else:
                sobjects2 = []

            for sobject in sobjects:
                match = sobject.get_value(match_col)
                color_id = sobject.get_value(color_col)

                for sobject2 in sobjects2:
                    if sobject2.get_value(match_col2) == color_id:
                        color = sobject2.get_value(color_col2)
                        break
                else:
                    color = color_id


                bg_color_map[match] = color

        my.color_map[name] = bg_color_map, text_color_map
开发者ID:0-T-0,项目名称:TACTIC,代码行数:56,代码来源:sobject_calendar_wdg.py

示例7: preprocess

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
 def preprocess(my):
     sobject = my.get_current_sobject() 
     if not sobject:
         my.columns = []
         return 
     search_type = sobject.get_search_type_obj()
     config = WidgetConfigView.get_by_search_type(search_type, "custom")
     if not config:
         my.columns = []
     else:
         my.columns = config.get_element_names()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:13,代码来源:custom_info_wdg.py

示例8: get_hint_text

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
 def get_hint_text(cls, search_type, simple_search_view=''):
     '''Get the hint text for keyword search col defined from widget_config'''
     if simple_search_view:
         from pyasm.widget import WidgetConfigView
         config = WidgetConfigView.get_by_search_type(search_type, simple_search_view)
         # assume the keyword filter is named "keyword"
         options = config.get_display_options('keyword')
         hint_text = options.get('hint_text')
         if hint_text:
             return hint_text
     
     return ""
开发者ID:mincau,项目名称:TACTIC,代码行数:14,代码来源:simple_search_wdg.py

示例9: get_search_col

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def get_search_col(cls, search_type, simple_search_view=''):
        '''Get the appropriate keyword search col based on column existence in this sType'''
        if simple_search_view:
            from pyasm.widget import WidgetConfigView
            config = WidgetConfigView.get_by_search_type(search_type, simple_search_view)
            # assume the keyword filter is named "keyword"
            options = config.get_display_options('keyword')
            column = options.get('column')
           
            if column:
                return column

        for col in cls.SEARCH_COLS:
            if SearchType.column_exists(search_type, col):
                return col

        return cls.SEARCH_COLS[-1]
开发者ID:makeittotop,项目名称:python-scripts,代码行数:19,代码来源:simple_search_wdg.py

示例10: preprocess

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def preprocess(my):
        my.elements = my.kwargs.get("elements")
        if my.elements:
            my.elements = my.elements.split('|')
        else:
            my.elements = []

        # get the definition
        sobjects = my.sobjects
        if sobjects:
            sobject = sobjects[0]
            search_type = sobject.get_search_type()
            view = 'definition'

            from pyasm.widget import WidgetConfigView
            my.config = WidgetConfigView.get_by_search_type(search_type, view)
        else:
            my.config = None
开发者ID:0-T-0,项目名称:TACTIC,代码行数:20,代码来源:task_status_report_wdg.py

示例11: get_definitions

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def get_definitions(my, element_name):
        '''get all the definitions for this element'''
        search_type = my.kwargs.get("search_type")
        view = my.kwargs.get("view")
        config_view = WidgetConfigView.get_by_search_type(search_type, view)

        display_class = config_view.get_display_handler(element_name)
        element_attr = config_view.get_element_attributes(element_name)

        for config in config_view.get_configs():
            #print config
            view = config.get_view()
            file_path = config.get_file_path()
            if not file_path:
                file_path = "from Database"
            #print view, file_path

            xml = config.get_element_xml(element_name)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:20,代码来源:element_definition_wdg.py

示例12: check

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def check(my):
        my.web = WebContainer.get_web()
        search_type = my.sobject.get_search_type_obj()
        
        config = WidgetConfigView.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:0-T-0,项目名称:TACTIC,代码行数:23,代码来源:timecard_wdg.py

示例13: get_display

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def get_display(my):
        web = WebContainer.get_web()

        if web.get_form_value("Insert/Exit"):
            widget = Widget()
            iframe = WebContainer.get_iframe()
            widget.add( HtmlElement.script(iframe.get_off_script()) )
            widget.add( HtmlElement.script("window.parent.document.form.submit()") )
            return widget


        database = Project.get_project_code()
        search_type = web.get_form_value("search_type")
        assert search_type

        view = web.get_form_value("view")
        if not view:
            view = get_template_view()
        
        widget = DivWdg()

        WebContainer.register_cmd("pyasm.widget.CustomAddElementCbk")

        # remember some parameters
        widget.add( HiddenWdg("search_type", search_type) )
        widget.add( HiddenWdg("view", view) )

        # Get the definition widget and list all of the custom elements
        config = WidgetConfigView.get_by_search_type(search_type,DEFAULT_VIEW)
        element_names = config.get_element_names()

        # show current custom
        widget.add("<h3>Add Element for [%s]</h3>" % search_type)

        widget.add( my.get_new_custom_widget(view) )

        return widget
开发者ID:0-T-0,项目名称:TACTIC,代码行数:39,代码来源:custom_view_wdg.py

示例14: execute

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def execute(my):
        sobject = my.sobject


        search_type = sobject.get_search_type_obj()
        config = WidgetConfigView.get_by_search_type(search_type, "custom")
        if not config:
            return

        my.element_names = config.get_element_names()

        # create all of the handlers
        action_handlers = []

        for element_name in (my.element_names):
            action_handler_class = \
                config.get_action_handler(element_name)

            if action_handler_class == "":
                action_handler_class = "DatabaseAction"
        

            action_handler = WidgetConfig.create_widget( action_handler_class )
            action_handler.set_name(element_name)
            action_handler.set_input_prefix("edit")

            action_options = config.get_action_options(element_name)
            for key, value in action_options.items():
                action_handler.set_option(key, value)
            action_handlers.append(action_handler)

        # set the sobject for each action handler
        for action_handler in action_handlers:
            action_handler.set_sobject(sobject)
            if action_handler.check():
                action_handler.execute()
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:38,代码来源:custom_info_wdg.py

示例15: get_display

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_by_search_type [as 别名]
    def get_display(my):
        my.preprocess()

        sobject = my.get_current_sobject()

        view = my.get_option("view")
        if not view:
            view = "custom_view"

        search_type = sobject.get_search_type_obj()
        config = WidgetConfigView.get_by_search_type(search_type, view)
        widget_config_view = WidgetConfigView(search_type, view, [config])
        if not config:
            span = SpanWdg("None")
            span.add_style("color: #ccc")
            return span
        try:
            base = CustomConfigWdg(search_type, view, \
                config=widget_config_view, input_prefix="edit")
            
        except TacticException, e:
            span = SpanWdg("None")
            span.add_style("color: #ccc")
            return span
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:26,代码来源:custom_info_wdg.py


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