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


Python DivWdg.has_class方法代码示例

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


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

示例1: BaseConfigWdg

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import has_class [as 别名]
class BaseConfigWdg(BaseRefreshWdg):

    def __init__(self, search_type, config_base, input_prefix='', config=None):

        if type(search_type) in types.StringTypes:
            self.search_type_obj = SearchType.get(search_type)
            self.search_type = search_type
        elif isinstance(search_type, SearchType):
            self.search_type_obj = search_type
            self.search_type = self.search_type_obj.get_base_key() 
        elif inspect.isclass(search_type) and issubclass(search_type, SObject):
            self.search_type_obj = SearchType.get(search_type.SEARCH_TYPE)
            self.search_type = self.search_type_obj.get_base_key()
        else:
            raise LayoutException('search_type must be a string or an sobject')
        self.config = config
        self.config_base = config_base
        self.input_prefix = input_prefix
        self.element_names = []
        self.element_titles = []

        from pyasm.web import DivWdg
        self.top = DivWdg()

        # Layout widgets compartmentalize their widgets in sections for drawing
        self.sections = {}

        super(BaseConfigWdg,self).__init__() 


    # NEED to add these because this is derived from HtmlElement and not
    # BaseRefreshWdg
    def add_style(self, name, value=None):
        return self.top.add_style(name, value=value)

    def add_class(self, class_name):
        return self.top.add_class(class_name)

    def has_class(self, class_name):
        return self.top.has_class(class_name)

    def add_behavior(self, behavior):
        return self.top.add_behavior(behavior)

    def add_relay_behavior(self, behavior):
        return self.top.add_relay_behavior(behavior)




    def get_default_display_handler(cls, element_name):
        raise Exception("Must override 'get_default_display_handler()'")
    get_default_display_handler = classmethod(get_default_display_handler)


    def get_config_base(self):
        return self.config_base

    def get_config(self):
        return self.config

    def get_view(self):
        return self.config_base


    def remap_display_handler(self, display_handler):
        '''Provide an opportunity to remap a display handler for newer
        layouts engines using older configs'''
        return display_handler
        

    def init(self):

        # create all of the display elements
        if not self.config:
            # it shouldn't use the self.search_type_obj here as it would absorb the project info
            self.config = WidgetConfigView.get_by_search_type(self.search_type, self.config_base)
        self.element_names = self.config.get_element_names()
        self.element_titles = self.config.get_element_titles()  

        # TODO: should probably be all the attrs
        self.element_widths = self.config.get_element_widths()  

       
        simple_view = self.kwargs.get("show_simple_view")
        if simple_view == "true":
            simple_view = True
        else:
            simple_view = False


        self.extra_data = self.kwargs.get("extra_data")
        if self.extra_data and isinstance(self.extra_data, basestring):
            try:
                self.extra_data = jsonloads(self.extra_data)
            except:
                self.extra_data = self.extra_data.replace("'", '"')
                self.extra_data = jsonloads(self.extra_data)


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

示例2: BaseRefreshWdg

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import has_class [as 别名]

#.........这里部分代码省略.........
        xml = Xml()
        xml.create_doc("config")

        # create the top element
        element = xml.create_element("element")
        xml.set_attribute(element, "name", self.name)

        # create the display handler
        display = xml.create_element("display")
        xml.set_attribute(display, "class", Common.get_full_class_name(self) )
        element.appendChild(display)

        # create the options
        for name, value in self.kwargs.items():
            if value:
                option = xml.create_text_element(name, value)
            else:  # avoid the \n in the textContent of the textNode 
                option = xml.create_element(name) 
            display.appendChild(option)

        return xml.to_string(element)


    def get_top(self):
        return self.top


    def add_style(self, name, value=None):
        return self.top.add_style(name, value=value)

    def add_class(self, class_name):
        return self.top.add_class(class_name)

    def has_class(self, class_name):
        return self.top.has_class(class_name)

    def add_behavior(self, behavior):
        return self.top.add_behavior(behavior)

    def add_relay_behavior(self, behavior):
        return self.top.add_relay_behavior(behavior)


    def set_option(self, name, value):
        self.kwargs[name] = value

    def get_option(self, name):
        return self.kwargs.get(name)

   

    def get_persistent_key(self):
        return "whatever"

    def commit(self):
        # store the widget persistently
        config_xml = self.serialize()
        key = self.get_persistent_key()
        WidgetSettings.set_key_values(key, [config.xml.to_string()])

    
    def get_by_key(self, key):
        key = self.get_persistent_key()
        return WidgetSettings.set_key_values(key, [config.xml.to_string()])

开发者ID:mincau,项目名称:TACTIC,代码行数:68,代码来源:base_refresh_wdg.py


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