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


Python ThumbWdg.set_sobjects方法代码示例

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


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

示例1: SubmissionInfoWdg

# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_sobjects [as 别名]
class SubmissionInfoWdg(AssetInfoWdg):
    '''widget information about a submission in a condensed manner'''

    def preprocess(self):
        self.thumb = ThumbWdg()
        self.thumb.set_sobjects(self.sobjects)
        self.thumb.preprocess()


    def get_display(self):
        
        self.sobject = self.get_current_sobject()

        table = Table(css='embed')
        table.add_style("width: 300px")
        table.add_color('color','color')
        table.add_row()
        td = table.add_cell("<i>Code: </i> <b style='font-size: 1.2em'>%s</b>" % self.sobject.get_code() )
        td.add_style("background: #e0e0e0")
        table.add_row()

        self.thumb.set_current_index(self.get_current_index())
        table.add_cell(self.thumb)

        table2 = Table(css='embed')
        table2.add_row()
        table2.add_cell("<i>Status: </i>")
        status = self.sobject.get_value("status")
        if not status:
            table2.add_cell("<i style='color: #c0c0c0'>None</i>")
        else:
            table2.add_cell(self.sobject.get_value("status") )

        self._add_frame_range(table2)
        table.add_cell( table2 )

        table.add_row()
        td = table.add_cell( "<i>Description: </i>")

        description = self.sobject.get_value("description")
        #td.add(WikiUtil().convert(description))

        expand = ExpandableTextWdg()
        expand.set_id('asset_info_desc')
        expand.set_value( WikiUtil().convert(description) )
        expand.set_max_length(300) 
        td.add(expand)

        return table
开发者ID:mincau,项目名称:TACTIC,代码行数:51,代码来源:asset_info_wdg.py

示例2: GeneralPublishElementWdg

# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_sobjects [as 别名]
class GeneralPublishElementWdg(BaseTableElementWdg):
    ''' A general publish table element with the option of having a thumbnail '''
    def get_arg_keys(self):
        return {'view': 'a custom view other than publish'}

    def preprocess(self):
        if self.get_option('preview') != 'false':
            self.thumb = ThumbWdg()
            self.thumb.set_sobjects(self.sobjects)
            self.thumb.set_icon_size(60)
            # passing options from this to ThumbWdg, shouldn't have conflicts
            options = self.options
            self.thumb.set_options(options)
        # for its own preprocess and data caching

    def get_display(self):
        self.view = self.kwargs.get('view')
        if not self.view:
            self.view = 'publish'
        widget = Widget()
        sobject = self.get_current_sobject()
        search_type = sobject.get_search_type()
        search_id = sobject.get_id()

        if self.get_option('preview') != 'false': 
            self.thumb.set_current_index(self.get_current_index())
            widget.add(self.thumb)

        publish_link = PublishLinkWdg(search_type,search_id, config_base=self.view) 
        div = DivWdg(publish_link)
        div.set_style('clear: left; padding-top: 6px')
        widget.add(div)

        # build a popup link to show publish browsing
        browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
        browse_link.add_behavior({'type': 'click_up',
            'cbjs_action': 'spt.popup.get_widget(evt, bvr)',
            'options': {'popup_id' : 'publish_browser',
                        'class_name' : 'pyasm.prod.web.PublishBrowserWdg' ,
                        'title': 'Publish Browser'},
            'args' : { 'search_type': search_type,
                        'search_id' : search_id }
            })
        div.add(browse_link)
        div.set_style('padding-top: 6px')


        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:50,代码来源:table_element_wdg.py

示例3: ShotInfoWdg

# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_sobjects [as 别名]
class ShotInfoWdg(AssetInfoWdg):
    '''widget to display the code, name and description in one column'''


    def preprocess(self):
        self.thumb = ThumbWdg()
        self.thumb.set_icon_size('60')
        self.thumb.set_sobjects(self.sobjects)
        self.thumb.preprocess()


    def get_display(self):
        if not self.thumb:
            self.preprocess()
        
        self.sobject = self.get_current_sobject()

        table = Table(css='embed')
        table.add_color('color','color')
        table.add_style("width: 300px")
        table.add_row()

        th = table.add_header("<i>Code: </i> <b style='font-size: 1.2em'>%s</b>" % self.sobject.get_code() )
        # add status
        th.add_style('text-align','left')
        status_span = SpanWdg("", css='large')
        th.add(status_span)

        status = self.sobject.get_value("status")
        if status:
            status_span.add(self.sobject.get_value("status"))
        
        table.add_row()
        
        self.thumb.set_current_index(self.get_current_index())
        thumb_td = table.add_cell(self.thumb)
        row_span = 2
       
        if self.sobject.has_value("priority"):
            row_span = 3
            # add priority
            table.add_cell("<i>Priority: </i>")
            priority = self.sobject.get_value("priority")
            if not priority:
                table.add_cell("None")
            else:
                table.add_cell(self.sobject.get_value("priority") )
            # this row should be added only if priority is added
            table.add_row()
        
        thumb_td.set_attr('rowspan', row_span) 

        # add pipeline
        table.add_cell("<i>Pipeline: </i>")
        status = self.sobject.get_value("pipeline_code")
        if not status:
            table.add_cell("None")
        else:
            table.add_cell(self.sobject.get_value("pipeline_code") )

        self._add_frame_range(table)

        table.add_row()
        td = table.add_cell( "<i>Description: </i>")
        description = self.sobject.get_value("description")
        expand = ExpandableTextWdg()
        expand.set_id('asset_info_desc')
        expand.set_value( WikiUtil().convert(description) )
        expand.set_max_length(300) 
        td.add(expand)

        main_div = DivWdg(table)
        
        if self.get_option("publish") == "false":
            return main_div
            
        #self._add_publish_link(main_div)

        return main_div


    def get_simple_display(self):
        sobject = self.get_current_sobject()
        code = sobject.get_code()
        description = sobject.get_value("description")
        status = sobject.get_value("status")
        return "%s, %s, %s" % (code, status, description)



    def _add_frame_range(self, table):

        frame_wdg = FrameRangeWdg()
        frame_wdg.set_sobject(self.sobject)
        table.add_row()
        table.add_cell("<i>Frame Info:</i>")
        table.add_cell( frame_wdg )

    def _add_publish_link(self, main_div):
        publish_link = PublishLinkWdg(self.sobject.get_search_type(), self.sobject.get_id())
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:asset_info_wdg.py


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