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


Python HtmlElement.style方法代码示例

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


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

示例1: get_style

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import style [as 别名]
    def get_style(self):
        '''Default style used when menu switcher is defined from config_xml'''

        style = HtmlElement.style('''

.spt_switcher_menu {
  padding: 0px 0px;
  border: solid 1px #CCC;
  width: 200px;
  height: auto;
  right: 5px;
  background: #FFF;
  text-align: center;
}

.spt_switcher_menu .spt_switcher_item {
  padding: 10px 0px;
  cursor: pointer;
}

        ''')

        return style
开发者ID:mincau,项目名称:TACTIC,代码行数:25,代码来源:layout_switcher_wdg.py

示例2: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import style [as 别名]
    def get_display(self):


        from tactic.ui.panel import CustomLayoutWdg

        top = self.top
        top.add_class("spt_content_box")
        top.add_class("spt_content_box_inline")
        top.add_style("min-width: 200px")

        #top.add_style("opacity: 0.1")

        """
        top.add_behavior( {
            'type': 'loadX',
            'cbjs_action': '''
            new Fx.Tween(bvr.src_el, {duration: 500}).start("opacity", 1.0);
            '''
        } )
        """

        colors = {
            #"color3": top.get_color("color3"),
            #"background3": top.get_color("background3"),
            #"background3": "rgba(18, 50, 91, 1.0)",
            "background3": "#323232",
            "color3": "#FFF",
            "border": top.get_color("border", -10),
        }

        style = HtmlElement.style()
        top.add(style)
        style.add('''
        .spt_content_box_inline {
            margin: 15px;
        }

        .spt_content_box_max {
            margin: 0px;
            width: 100%%;
            height: 100%%;
            background: rgba(0,0,0,0.0);
            z-index: 1000;
            position: fixed;
            top: 0px;
            left: 0px;
        }

        .spt_content_box_max .spt_content_box_content {
            //height: 100%% !important;
        }


        .spt_content_box .spt_content_box_title {
            width: auto;
            border: none;
            background: %(background3)s;
            color: %(color3)s;
            height: 18px;
            padding: 6px 8px;
            font-weight: bold;
            font-size: 1.2em;
            border: solid 1px %(border)s;
        }

        .spt_content_box .spt_content_box_shelf {
            margin-top: 0px;
            border: solid 1px #AAA;
            padding: 8px 15px;
            height: 23px;
            background: #F8F8F8;
        }

        .spt_content_box .spt_content_box_content {
            width: auto;
            margin-top: -1px;
            margin-bottom: 5px;
            border: solid 1px #AAA;
            padding: 15px 0px 0px 0px;
            background: #FFF;
            overflow-x: auto;

        }

        .spt_content_box .spt_content_box_footer {
            margin-top: -1px;
            border: solid 1px #AAA;
            padding: 8px 15px;
            height: 23px;
            background: #F8F8F8;
        }
        ''' % colors)


        top.add(self.get_title_wdg())

        inner = DivWdg()
        top.add(inner)
        inner.add_class("spt_content_box_inner")
        inner.add_style("overflow: hidden")
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:content_wdg.py

示例3: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import style [as 别名]
    def get_display(self):

        top = self.top
        top.add_class("spt_switcher_top")
        
        '''
        This supports supports two menu definitions:
        menu - specifies a view for SideBarWdg which will be ingected as menu 
        config_xml - specifies menu entries. For example:

        <display class="tactic.ui.widget.LayoutSwitcherWdg">
          <!-- config_xml -->
          <config>
            <!-- Menu item 1 -->
            <element name="self_tasks_default" title="My Tasks" target=spt_my_tasks_table_top">
              <display class="tactic.ui.panel.ViewPanelWdg">
                <search_type>sthpw/task</search_type>
                <show_shelf>false</show_shelf>
                <view>my_tasks_default</view>
              </display>
            </element>
            <!-- Menu item 2 -->
            <element ... >
              <display ... >
              </display>
            </element>
          </config>
        </display>

        target - specifies target div to load views when using "menu" kwarg
        use_href - updates address bar hash (this is TODO)
        '''
        
        menu = self.kwargs.get("menu")
        config_xml = self.kwargs.get("config_xml")
        target = self.kwargs.get("target")

        #default
        default_layout = self.kwargs.get("default_layout")

        # find the save state value, if state is to be saved
        save_state = self.kwargs.get("save_state")

        if save_state in [False, 'false']:
            save_state = None
            show_first = False
        else:
            show_first = True

        state_value = None
        if save_state:
            state_value = WidgetSettings.get_value_by_key(save_state)
        elif default_layout:
            state_value = default_layout

        title = self.kwargs.get("title")
        if not title and state_value:
            title = state_value
        if not title:
            title = "Switch Layout"

        mode = self.kwargs.get("mode")
        if mode == "button":
            color = self.kwargs.get("color") or "default"
            activator = DivWdg("<button class='btn btn-%s dropdown-toggle' style='width: 160px'><span class='spt_title'>%s</span> <span class='caret'></span></button>" % (color, title))
        elif mode == "div":
            color = self.kwargs.get("color") or ""
            background = self.kwargs.get("background") or "transparent"
            activator = DivWdg("<button class='btn dropdown-toggle' style='width: 160px; background: %s; color: %s; font-weight: bold'><span class='spt_title'>%s</span> <span class='caret'></span></button>" % (background, color, title))

        else:
            activator = IconButtonWdg( name="Layout Switcher", icon="BS_TH_LIST")


        top.add(activator)
        activator.add_class("spt_switcher_activator")
        activator.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = bvr.src_el;
            var top = activator.getParent(".spt_switcher_top");
            var menu = top.getElement(".spt_switcher_menu");
            
            if (top.hasClass("spt_selected")) {
                top.removeClass("spt_selected");
                menu.setStyle("display", "none");    
            } else {
                top.addClass("spt_selected");
                menu.setStyle("display", "");
                var pos = activator.getPosition();
                var button_size = activator.getSize();
                var menu_size = menu.getSize();
                var offset = {
                    x: button_size.x - menu_size.x,
                    y: button_size.y
                }
                menu.position({position: 'upperleft', relativeTo: activator, offset: offset});

                spt.body.add_focus_element(menu);

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

示例4: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import style [as 别名]
    def get_display(my):

        top = my.top
        top.add_class("spt_switcher_top")
        
        '''
        This supports supports two menu definitions:
        menu - specifies a view for SideBarWdg which will be ingected as menu 
        config_xml - specifies menu entries. For example:

        <display class="tactic.ui.widget.LayoutSwitcherWdg">
          <!-- config_xml -->
          <config>
            <!-- Menu item 1 -->
            <element name="my_tasks_default" title="My Tasks">
              <display class="tactic.ui.panel.ViewPanelWdg">
                <search_type>sthpw/task</search_type>
                <show_shelf>false</show_shelf>
                <view>my_tasks_default</view>
                <target>spt_my_tasks_table_top</target>
              </display>
            </element>
            <!-- Menu item 2 -->
            <element ... >
              <display ... >
                <target ... />
              </display>
            </element>
          </config>
        </display>

        target - specifies target div to load views when using "menu" kwarg
        use_href - updates address bar hash (this is TODO)
        '''
        
        menu = my.kwargs.get("menu")
        config_xml = my.kwargs.get("config_xml")
        target = my.kwargs.get("target")
        # TODO: use_href to go to specific layout switcher view
        # use_href = my.kwrags.get("use_href")
        
        # Layout switcher button displays menu and assumes right hand position of screen
        activator = IconButtonWdg( name="Layout Switcher", icon="BS_TH_LIST")
        top.add(activator)
        activator.add_class("spt_switcher_activator")
        activator.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = bvr.src_el;
            var top = activator.getParent(".spt_switcher_top");
            var menu = top.getElement(".spt_switcher_menu");
            
            if (top.hasClass("spt_selected")) {
                top.removeClass("spt_selected");
                menu.setStyle("display", "none");    
            } else {
                top.addClass("spt_selected");
                menu.setStyle("display", "");
                var pos = activator.getPosition();
                var button_size = activator.getSize();
                var menu_size = menu.getSize();
                var offset = {
                    x: button_size.x - menu_size.x,
                    y: button_size.y
                }
                menu.position({position: 'upperleft', relativeTo: activator, offset: offset});

                var pointer = menu.getElement(".spt_popup_pointer");
                pointer.setStyle("margin-left", menu_size.x - button_size.x);
            } 
            '''
        } )
            
        # menu_wdg 
        menu_wdg = DivWdg()
        top.add(menu_wdg)
        menu_wdg.add_class("spt_switcher_menu")
        menu_wdg.add_style("display: none")
        menu_wdg.add_style("margin-top", "15px")
        menu_wdg.add_style("position", "absolute")
        menu_wdg.add_style("z-index", "10")
        menu_wdg.add_behavior( {
            'type': 'mouseleave',
            'cbjs_action': '''
            var menu = bvr.src_el;
            var top = menu.getParent(".spt_switcher_top");
            top.removeClass("spt_selected");
            menu.setStyle("display", "none")
            '''
        } )
        
        # Pointer under activator
        pointer_wdg = DivWdg()
        menu_wdg.add(pointer_wdg)
        pointer_wdg.add('''
            <div class="spt_first_arrow_div"> </div>
            <div class="spt_second_arrow_div"> </div>
        ''')
        pointer_wdg.add_class("spt_popup_pointer")

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


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