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


Python SpanWdg.set_attr方法代码示例

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


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

示例1: get_tool_bar

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_attr [as 别名]
    def get_tool_bar(my):
        widget = Widget()
        trash_div = SpanWdg()
        # reset some global variables on load
        trash_div.add_behavior({'type':'load', 'cbjs_action':'spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}'})

        trash_div.set_id('trash_me')

        trash_div.add(IconWdg('Trash', IconWdg.TRASH))
        trash_div.add("TRASH!")
        trash_div.add_class("hand")
        trash_div.add_class("spt_side_bar_trash")
      
        trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
        bvr = { "type": "click_up",\
                'cbjs_action': "alert('Drag and drop link or folder here to remove it.')"}
        trash_div.add_behavior(bvr)

        widget.add(trash_div)
        
        save_div = SpanWdg(css='med hand spt_side_bar_trash')
        save_div.add(IconWdg('Save Ordering', IconWdg.SAVE))
      
        # FIXME: is_personal???
        is_personal = 'false'
        bvr = { "type": "click_up",\
                'cbjs_action': "spt.side_bar.manage_section_action_cbk({'value':'save'},'%s',%s);" % (my.view, is_personal)} 
        save_div.add_behavior(bvr)
        widget.add(save_div)
        return widget
开发者ID:blezek,项目名称:TACTIC,代码行数:32,代码来源:view_manager_wdg.py

示例2: get_tool_bar

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_attr [as 别名]
    def get_tool_bar(self):
        widget = Widget()
        trash_div = SpanWdg()
        trash_div.set_id('trash_me')

        trash_div.add(IconWdg('Trash', IconWdg.TRASH))
        trash_div.add("TRASH!")
        trash_div.add_class("hand")
        trash_div.add_class("spt_side_bar_trash")
      
        
        trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
        bvr = { "type": "click_up",\
                'cbjs_action': "alert('Drag and drop element name here to remove it.')"}
        trash_div.add_behavior(bvr)

        widget.add(trash_div)
        
        save_div = SpanWdg(css='med hand spt_side_bar_trash')
        save_div.add(IconWdg('Save', IconWdg.SAVE))
        
        bvr = { "type": "click_up",\
                'cbjs_action': "spt.custom_project.manage_action_cbk({'value':'save'},'%s');" % self.view} 
        save_div.add_behavior(bvr)
        widget.add(save_div)
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:search_type_manager_wdg.py

示例3: get_tool_bar

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_attr [as 别名]
    def get_tool_bar(my):
        widget = DivWdg()
        widget.add_style("width: 250px")

        refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
        refresh.add_behavior(
            {
                "type": "click_up",
                "cbjs_action": """
            var top = bvr.src_el.getParent(".spt_panel");
            spt.panel.refresh(top);
            """,
            }
        )

        widget.add(refresh)
        widget.add("   ")

        trash_div = SpanWdg()
        # reset some global variables on load
        trash_div.add_behavior(
            {"type": "load", "cbjs_action": "spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}"}
        )

        trash_div.set_id("trash_me")

        trash_div.add(IconWdg("Trash", IconWdg.TRASH))
        trash_div.add_class("hand")
        trash_div.add_class("spt_side_bar_trash")

        trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
        bvr = {"type": "click_up", "cbjs_action": "alert('Drag and drop link or folder here to remove it.')"}
        trash_div.add_behavior(bvr)

        widget.add(trash_div)

        save_div = SpanWdg(css="med hand spt_side_bar_trash")
        save_div.add(IconWdg("Save Ordering", IconWdg.SAVE))

        bvr = {
            "type": "click_up",
            "search_type": my.search_type,
            "view": my.view,
            "cbjs_action": """
            if (confirm("Save ordering of this view [" + bvr.view + "] ?") ) {

                var top = bvr.src_el.getParent(".spt_view_manager_top");
                var list_top = top.getElement(".spt_menu_item_list");

                var server = TacticServerStub.get();
                server.start({"title": "Updating views"});

                var is_personal = false;
                spt.app_busy.show("Saving", "Saving view ["+bvr.view+"]");
                spt.side_bar.save_view(bvr.search_type, bvr.view, is_personal, list_top);
                server.finish();

                spt.app_busy.hide();
            }
            """,
        }

        save_div.add_behavior(bvr)
        widget.add(save_div)

        gear = my.get_gear_menu()
        gear.add_style("float: right")

        widget.add(gear)

        return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:73,代码来源:view_manager_wdg.py

示例4: get_display

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_attr [as 别名]
    def get_display(my):
        sobject = my.get_current_sobject()
        if isinstance(sobject, Shot):
            frame_range = sobject.get_frame_range()
            frame_in, frame_out = sobject.get_frame_handles()
            frame_notes = sobject.get_frame_notes()
        else:
            from pyasm.prod.biz import FrameRange
            frame_start = my._get_frame_num(sobject, "tc_frame_start")
            frame_end = my._get_frame_num(sobject, "tc_frame_end")
            frame_range = FrameRange(frame_start, frame_end, 1 )
            frame_in, frame_out = my._get_frame_handles(sobject)
            frame_notes = sobject.get_value("frame_note", no_exception=True)
        
        frame_notes = WikiUtil().convert(frame_notes)    
        if frame_range.frame_end == frame_range.frame_start == 0:
            return 'n/a'

        widget = SpanWdg()
        widget.set_attr("nowrap", "1")

        offset = 2
        label_width = 16
        if frame_range.frame_start > 99:
            label_width = 20
        # start / end frame
        duration_color = '#969353'
        div = DivWdg()
        div.add_tip('START -- END (TOTAL)')
        wdg_width = 150
        div.add_style('width', wdg_width)
        
        total = frame_range.frame_end - frame_range.frame_start + 1
        start_frame = SpanWdg(str(frame_range.frame_start))
        end_frame = SpanWdg(str(frame_range.frame_end))

        end_div = FloatDivWdg(end_frame)

        duration_width = wdg_width * 0.2 - offset

        #spacer_width = float('%.2f' %((duration_width + offset) * (frame_range.frame_start -1 ) /\
        #        frame_range.frame_end))

        spacer_width = 0
        start_div = FloatDivWdg(start_frame, width=label_width+spacer_width )
        start_div.add_class('right_content')
        duration = FloatDivWdg( width=duration_width )
        duration.add_style("border: 1px dotted %s" % duration_color)
        duration.add_style("margin-top: 3px")
        duration.add_style("margin-left: 5px")
        duration.add_style("margin-right: 5px")
        duration.add_style("height: 3px")
        duration.add_style("line-height: 3px")
        div.add(start_div)
        div.add(duration)
        div.add(end_div)
        dur_text = FloatDivWdg('<i>(%s)</i>' %total)
        dur_text.add_style("opacity", "0.3")
        div.add(dur_text)
        widget.add(div)
        widget.add(HtmlElement.br())
        if frame_in:
            # in / out frame
            duration_color = '#b8b365'
            div = DivWdg()
            div.add_tip('IN -- OUT')
            div.add_style('width', wdg_width)
            
            handle_total = frame_out - frame_in + 1
            in_frame = SpanWdg(str(frame_in))
            out_frame = SpanWdg(str(frame_out))
           
            if frame_range.frame_start == 0:
                frame_range.frame_start = 0.001

            spacer_width = float('%.2f' % ((spacer_width) * \
                float(frame_in) /frame_range.frame_start )) 

            in_div = FloatDivWdg(in_frame, width=label_width + spacer_width)
            in_div.add_class('right_content')
            out_div = FloatDivWdg(out_frame)

            factor =  float(handle_total) / total
            if factor > 1:
                factor = 1
            duration_width = (duration_width + offset) * factor - offset
            duration = FloatDivWdg( width=duration_width )
            duration.add_style("border: 1px solid %s" % duration_color)
            duration.add_style("background", duration_color)
            duration.add_style("margin-top: 5px")
            duration.add_style("margin-left: 5px")
            duration.add_style("margin-right: 5px")
            duration.add_style("line-height: 1px")
            duration.add('&nbsp;')
            
            # IE needs that to draw a 1px wide div
            bar = FloatDivWdg('<!-- -->', width=1)
            bar.add_style("margin-top: 1px")
            bar.add_style("line-height: 10px")
            bar.add_style("background", duration_color)
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:frame_info_wdg.py

示例5: get_display

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

        web = WebContainer.get_web()

        widget = Widget()

        div = SpanWdg(css='med')
        div.set_attr("nowrap", "1")

        limit_wdg = my.text
        limit_wdg.add_event('onchange', 'if (this.value < 20 || !Common.validate_int(this.value)) this.value=20 ') 
        limit_wdg.add_style("margin-top: -3px")
        limit_wdg.set_attr("size", "1")
        #limit_wdg.set_value(my.search_limit)

        offset_wdg = HiddenWdg("%s_last_search_offset" %my.label)
        offset_wdg.set_value(my.current_offset)
        #div.add(limit_wdg)
        div.add(offset_wdg)
    

        if my.search or my.sobjects:
            # my.count should have been set in alter_search()
            # which can be called explicitly thru this instance, my.
            if not my.count:
                my.count = my.search.get_count()
            
            # if my.sobjects exist thru inheriting from parent widgets
            # or explicitly set, (this is not mandatory though)
            if my.sobjects and len(my.sobjects) < my.search_limit:
                limit = len(my.sobjects)
            elif my.search and my.count < my.search_limit:
                # this is only true if the total result of the search is 
                # less than the limit and so this wdg will not display
                limit = my.count
            else:
                limit = my.search_limit
 
        
            if my.current_offset == 0 and limit < my.search_limit:
                return None
              
            if my.refresh:
                prev = IconSubmitWdg("Prev", IconWdg.LEFT, False )
                next = IconSubmitWdg("Next", IconWdg.RIGHT, False, icon_pos="right" )
            else:
                prev = IconButtonWdg("Prev", IconWdg.LEFT, False )
                hidden_name = my.prev_hidden_name
                hidden = HiddenWdg(hidden_name,"")
                prev.add(hidden)
                prev.add_event('onclick',"get_elements('%s').set_value('Prev');%s"\
                        %(hidden_name, my.refresh_script))
                next = IconButtonWdg("Next", IconWdg.RIGHT, False, icon_pos="right" )
                hidden_name = my.next_hidden_name
                hidden = HiddenWdg(hidden_name,"")
                next.add(hidden)
                next.add_event('onclick',"get_elements('%s').set_value('Next');%s" \
                        %(hidden_name, my.refresh_script))

            label_span = SpanWdg("Showing:")
            label_span.add_style('color','#c2895d')
            div.add(label_span)
            div.add( prev )
           

            # this min calculation is used so that if my.sobjects is not set
            # above for the calculation of the limit, which will make the last 
            # set of range numbers too big
            
            left_bound = my.current_offset+1
            right_bound = min(my.current_offset+limit, my.count)
            if left_bound > right_bound:
                left_bound = 1
            current_value = "%d - %d" % (left_bound, right_bound)

            if my.style == my.SIMPLE:
                div.add( current_value )
            else:
                # add a range selector using ItemsNavigatorWdg
                from input_wdg import ItemsNavigatorWdg
                selector = ItemsNavigatorWdg(my.label, my.count, my.search_limit, refresh=my.refresh)
                selector.set_style(my.style)

                selector.set_value(current_value)
                selector.set_display_label(False)
                if my.refresh_script:
                    selector.set_refresh_script(my.refresh_script)
                div.add( selector) 
                div.add( " - ")
                div.add( limit_wdg)

            div.add( next )

            widget.add(div)

            


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


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