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


Python Table.set_class方法代码示例

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


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

示例1: get_display

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

        widget = Widget()

        project = self.get_current_sobject()

        table = Table()
        table.set_class("minimal")
        for setting in ('dir_naming_cls', 'file_naming_cls', 'code_naming_cls', 'node_naming_cls', 'sobject_mapping_cls'):

            table.add_row()
            td = table.add_cell("<i>%s</i>: " % setting)
            td.add_style("text-align: right")
            value = project.get_value(setting)
            table.add_cell(value)

        widget.add(table)
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:20,代码来源:project_wdg.py

示例2: get_display_old

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_class [as 别名]
    def get_display_old(my):
        '''This is NOT used, just used as a reference for the old method'''
        icon_id = 'upload_div'
        div = DivWdg()

        if my.get_option('upload_type') == 'arbitrary':
            counter = HiddenWdg('upload_counter','0')
            div.add(counter)
            icon = IconButtonWdg('add upload', icon=IconWdg.ADD)
            icon.set_id(icon_id)
            icon.add_event('onclick', "Common.add_upload_input('%s','%s','upload_counter')" \
                %(icon_id, my.get_input_name()))
            div.add(icon)
        
        table = Table()
        table.set_class("minimal")
        table.add_style("font-size: 0.8em")

        names = my.get_option('names')
        required = my.get_option('required')
        if not names:
            my.add_upload(table, my.name)
        else:
            names = names.split('|')
            if required:
                required = required.split('|')
                if len(required) != len(names):
                    raise TacticException('required needs to match the number of names if defined in the config file.')
            # check for uniqueness in upload_names
            if len(set(names)) != len(names):
                raise TacticException('[names] in the config file must be unique')
            
            for idx, name in enumerate(names):
                 if required:
                     is_required = required[idx] == 'true'
                 else:
                     is_required = False
                 my.add_upload(table, name, is_required)

        table.add_row()
开发者ID:makeittotop,项目名称:python-scripts,代码行数:42,代码来源:upload_wdg.py

示例3: get_display

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

        div = DivWdg()
        table = Table()
        table.set_class("minimal")
        table.add_style("font-size: 0.8em")
        table.add_row()
        table.add_cell("File")
        table.add_cell('<input type="file" name="%s"/>' % (my.get_input_name())
        )
        table.add_row()
        table.add_cell("Context")

        select = SelectWdg("%s|context" % my.get_input_name() )
        select.set_option("values", "publish|roughDesign|colorFinal|colorKey")
        table.add_cell(select)

        table.add_row()
        table.add_cell("Description")
        table.add_cell('<textarea name="%s|description"></textarea>' % my.get_input_name())
        div.add(table)

        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:25,代码来源:flash_background_upload_wdg.py

示例4: get_display

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

        # get all of the options
        direction = self.get_option("direction")
        if not direction:
            direction = "dst"
        

        icon_size = self.get_option("icon_size")
        if not icon_size:
            icon_size = 60
        try:
            sobject = self.get_current_sobject()
        except IndexError:
            return ''
        if not hasattr(self, 'info'):
            return ''
        
        connections, dst_sobjects, sobj = self.info.get(sobject.get_search_key())
      
        src_sobject = sobject

        # may not need this due to preprocess
        if isinstance(src_sobject, SObjectConnection):
            connection = src_sobject
            src_sobject = connection.get_sobject(direction="src")


        div = DivWdg()
        div.set_id("connection_%s" % src_sobject.get_id() )

        # set the ajax options
        self.set_ajax_top(div)
        self.set_ajax_option("search_key", src_sobject.get_search_key() )
        self.register_cmd("pyasm.widget.SObjectConnectionRemoveCbk")

        table = Table()
        table.set_max_width()
        table.set_class("minimal")
        count = 0
        
        for dst_sobject in dst_sobjects:
            tr = table.add_row()
            if not dst_sobject:
                table.add_cell("referenced to retired or deleted asset....")
                continue
            if dst_sobject.is_retired():
                tr.add_class("retired_row")

            thumb = ThumbWdg()
            thumb.set_show_filename(True)
            thumb.set_show_orig_icon(True) 
            thumb.set_icon_size(icon_size)
            thumb.set_sobject(dst_sobject)
            td = table.add_cell(thumb)
            td.add_style("padding: 1px")
            td.add_style("width: 20%")

            id = dst_sobject.get_id()
            name = dst_sobject.get_name()
            code = dst_sobject.get_code()
            if code == str(id):
                pass 
            elif name == code:
                td = table.add_cell(name)
                td.add_style("width: 20%")
            else:
                td = table.add_cell("%s<br/>%s" % (name,code) )
                td.add_style("width: 20%")

            if dst_sobject.has_value("title"):
                td = table.add_cell("%s" % dst_sobject.get_value("title") )
            elif dst_sobject.has_value("description"):
                td = table.add_cell("%s" % dst_sobject.get_value("description") )
                td.add_style("width: 30%")
            if dst_sobject.has_value("keywords"):

                td = table.add_cell("%s" % dst_sobject.get_value("keywords") )
                td.add_style("width: 20%")

            if dst_sobject.has_value("timestamp"):
                td = table.add_cell("%s" % Date(dst_sobject.get_value("timestamp")).get_display_time() )
                td.add_style("width: 20%")

            update = UpdateWdg()
            update.set_sobject(dst_sobject)
            update.set_option('delete', 'false')
            table.add_cell(update)
             
            # remove connection
            connection = connections[count]
            connection_id = connection.get_id()
            self.set_ajax_option("connection_id", connection_id )
            refresh_script = self.get_refresh_script(False)

            remove = IconButtonWdg("Remove Connection", IconWdg.DELETE)
            remove.add_event("onclick", refresh_script)

            table.add_cell(remove)

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

示例5: get_info_wdg

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

        widget = Widget()

        table = Table()
        table.set_class("minimal")
        table.add_style("font-size: 0.8em")

        context_option = my.kwargs.get('context')
        context_expr_option = my.kwargs.get('context_expr')
        
        pipeline_option = my.kwargs.get('pipeline') in ['true', True, 'True']
        setting_option = my.kwargs.get('setting')
        context_name = "%s|context" % my.get_input_name()
        text = None 
        span1 = SpanWdg("Context", id='context_mode')
        span2 = SpanWdg("Context<br/>/Subcontext", id='subcontext_mode')
        span2.add_style('display','none')
        table.add_cell(span1)
        table.add_data(span2)
        if context_expr_option or context_option or setting_option:
            # add swap display for subcontext only if there is setting or context option
            swap = SwapDisplayWdg()
            table.add_data(SpanWdg(swap, css='small'))
            swap.set_display_widgets(StringWdg('[+]'), StringWdg('[-]'))
            subcontext_name = "%s|subcontext" % my.get_input_name()
            subcontext = SpanWdg('/ ', css='small')
            subcontext.add(TextWdg(subcontext_name))
            subcontext.add_style('display','none')
            subcontext.set_id(subcontext_name)
            on_script = "set_display_on('%s');swap_display('subcontext_mode','context_mode')"%subcontext_name
            off_script = "set_display_off('%s');get_elements('%s').set_value(''); "\
                "swap_display('context_mode','subcontext_mode')"%(subcontext_name, subcontext_name)
            swap.add_action_script(on_script, off_script)
            text = SelectWdg(context_name)
            if my.sobjects:
                text.set_sobject(my.sobjects[0])
            if context_expr_option:
                text.set_option('values_expr', context_expr_option)
            elif context_option:
                text.set_option('values', context_option)
            elif setting_option:
                text.set_option('setting', setting_option)
                    

            td = table.add_cell(text)
            
            table.add_data(subcontext)
            
        elif pipeline_option:
            from pyasm.biz import Pipeline
            sobject = my.sobjects[0]
            pipeline = Pipeline.get_by_sobject(sobject)
            context_names = []
            process_names = pipeline.get_process_names(recurse=True)
            for process in process_names:
                context_names.append(pipeline.get_output_contexts(process))
            text = SelectWdg(context_name)
            text.set_option('values', process_names)
            table.add_cell(text)
            
        else:
            text = TextWdg(context_name)
            table.add_cell(text)
            hint = HintWdg('If not specified, the default is [publish]')
            table.add_data(hint)
      
        revision_cb = CheckboxWdg('%s|is_revision' %my.get_input_name(),\
            label='is revision', css='med')
        table.add_data(revision_cb)
        table.add_row()
        table.add_cell("Comment")
        textarea = TextAreaWdg("%s|description"% my.get_input_name())
        table.add_cell(textarea)
        widget.add(table)

        return widget
开发者ID:makeittotop,项目名称:python-scripts,代码行数:79,代码来源:upload_wdg.py


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