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


Python widget.WidgetConfigView类代码示例

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


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

示例1: get_config

    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,代码行数:51,代码来源:search_type_manager_wdg.py

示例2: execute

    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,代码行数:27,代码来源:expression_element_wdg.py

示例3: execute

    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,代码行数:34,代码来源:aggregate_wdg.py

示例4: append

    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,代码行数:58,代码来源:widget_db_config.py

示例5: 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

示例6: 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

示例7: get_info_wdg

    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,代码行数:54,代码来源:tool_layout_wdg.py

示例8: init_color_map

    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,代码行数:54,代码来源:sobject_calendar_wdg.py

示例9: preprocess

 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,代码行数:11,代码来源:custom_info_wdg.py

示例10: get_hint_text

 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,代码行数:12,代码来源:simple_search_wdg.py

示例11: get_config

    def get_config(my):
        # look in the db first
        configs = []
        config = WidgetDbConfig.get_by_search_type(my.search_type, my.view)
        get_edit_def = False
        if config:
            configs.append(config)
            get_edit_def = True
            config = WidgetDbConfig.get_by_search_type(my.search_type, "edit_definition")
            if config:
                configs.append(config)

        #if my.mode == 'insert':
        #    config = WidgetDbConfig.get_by_search_type(my.search_type, "insert")
        #    if config:
        #        configs.append(config)
        # look for a definition
        #config = WidgetDbConfig.get_by_search_type(my.search_type, "edit")
        #if config:
        #    configs.append(config)

        file_configs = WidgetConfigView.get_configs_from_file(my.search_type, my.view)
        configs.extend(file_configs)

        file_configs = WidgetConfigView.get_configs_from_file(my.search_type, "edit")
        configs.extend(file_configs)

        #TODO: add edit_definition    
        #file_configs = WidgetConfigView.get_configs_from_file(my.search_type, "edit_definition")
        #configs.extend(file_configs)
        if not get_edit_def:
            config = WidgetDbConfig.get_by_search_type(my.search_type, "edit_definition")
            if config:
                configs.append(config)
    
        config = WidgetConfigView(my.search_type, my.view, configs)
        return config
开发者ID:funic,项目名称:TACTIC,代码行数:37,代码来源:edit_wdg.py

示例12: get_search_col

    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,代码行数:17,代码来源:simple_search_wdg.py

示例13: preprocess

    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,代码行数:18,代码来源:task_status_report_wdg.py

示例14: get_definitions

    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,代码行数:18,代码来源:element_definition_wdg.py

示例15: check

    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,代码行数:21,代码来源:timecard_wdg.py


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