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


Python HtmlElement.i方法代码示例

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


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

示例1: init

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import i [as 别名]
    def init(self):
        if self.icon_path.startswith("BS") or self.icon_path.startswith("FA"):
            icon_path = self.icon_path
        elif not self.icon_path.startswith("/"):
            # icon_path = "/context/icons/oo/%s" % self.icon_path
            icon_path = "/context/icons/silk/%s" % self.icon_path
        else:
            icon_path = self.icon_path

        if icon_path.startswith("BS_"):
            icon = HtmlElement.span()
            icon.add_class("glyphicon")
            part = icon_path.replace("BS_", "")
            part = part.lower()
            part = part.replace("_","-")
            if part == "save":
                part = "floppy-disk"
            icon.add_class("glyphicon-%s" % part)
            if not self.size:
                self.size = "16px"
            icon.add_style("font-size: %s" % self.size)
            if not self.opacity:
                self.opacity = 0.6

        elif icon_path.startswith("FA"):
            icon = HtmlElement.i()
            icon.add_class("fa")
            part = icon_path.replace("FA_", "")
            part = part.lower()
            part = part.replace("_","-")
            icon.add_class("fa-%s" % part)
            if not self.size:
                self.size = "16px"
            icon.add_style("font-size: %s" % self.size)
            if not self.opacity:
                self.opacity = 0.6


        else:
            icon = HtmlElement.img(icon_path)

        if self.opacity:
            icon.add_style("opacity: %s" % self.opacity)


        if self.text and self.text != "":
            icon.set_attr("title", self.text)
        if self.right_margin:
            icon.add_style("margin-right: %s" % self.right_margin)
       
        self.icon = icon

        inline = self.kwargs.get("inline")
        if inline in [False, 'false']:
            self.add_style("float: left")
        else:
            self.add_style("display: inline")
开发者ID:mincau,项目名称:TACTIC,代码行数:59,代码来源:icon_wdg.py

示例2: get_display

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

        web = WebContainer.get_web()
        task = my.get_current_sobject()
        id = task.get_id()

        if task.is_insert():
            return HtmlElement.i("Dependency on insert not supported yet.")

        # get the sobject
        sobject = task.get_parent()
        if not sobject:
            return "No parent"

        tmp_tasks = Task.get_by_sobject(sobject)
        tasks = []
        for tmp_task in tmp_tasks:
            # skip the task self
            if tmp_task.get_id() == id:
                continue

            # prevent direct circular dependencies
            if tmp_task.get_value("depend_id") == id:
                continue

            tasks.append(tmp_task)


        ids = [x.get_id() for x in tasks]
        labels = []
        for task in tasks:
            process = task.get_value("process")
            description = task.get_value("description")
            if len(description) > 30:
                description = description[0:30]+"..."
            label = "%s - %s" % (process, description)
            labels.append(label)

        my.set_option("empty", "true")
        my.set_option("labels", labels)
        my.set_option("values", ids)
        

        return super(TaskParentInputWdg,my).get_display()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:46,代码来源:task_wdg.py

示例3: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import i [as 别名]
    def get_display(my):
        sobject = my.get_current_sobject()
        task_table = Table(css="minimal")
        task_table.add_style("width: 300px")
        search_key = sobject.get_search_key()
        tasks = my.tasks_dict.get(search_key)
        if tasks:
            for task in tasks:
                task_table.add_row()
                process = task.get_value("process")
                td = task_table.add_cell(HtmlElement.i(process))
                task_table.add_data(':')
                td.add_style("vertical-align: top")
                td.add_style("text-align: right")
                td.add_style("width: 75px")
                td.add_style("padding: 2px")
                task_table.add_cell( task.get_value("description") )

        return task_table
开发者ID:0-T-0,项目名称:TACTIC,代码行数:21,代码来源:layout_summary_wdg.py

示例4: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import i [as 别名]
    def get_display(self):
        self.check()
        if self.is_refresh:
            div = Widget()
        else:
            div = DivWdg()
            self.set_as_panel(div)
            div.add_style('padding','6px')
            min_width = '400px'
            div.add_style('min-width', min_width)
            div.add_color('background','background')
            div.add_class('spt_add_task_panel')
            div.add_style("padding: 20px")


        from tactic.ui.app import HelpButtonWdg
        help_button = HelpButtonWdg(alias="creating-tasks")
        div.add(help_button)
        help_button.add_style("float: right")
        help_button.add_style("margin-top: -5px")

        if not self.search_key_list:
            msg_div = DivWdg()
            msg_table = Table()
            msg_div.add(msg_table)
            msg_table.add_row()
            msg_table.add_cell( IconWdg("No items selected", IconWdg.WARNING) )
            msg_table.add_cell('Please select at least 1 item to add tasks to.')

            msg_div.add_style('margin: 10px')
            msg_table.add_style("font-weight: bold")
            div.add(msg_div)
            return div

        msg_div = DivWdg()
        msg_div.add_style('margin-left: 4px')
        div.add(msg_div, 'info')
        msg_div.add('Total: %s item/s to add tasks to' %len(self.search_key_list))
        div.add(HtmlElement.br())
        hint = HintWdg('Tasks are added according to the assigned pipeline.')
        msg_div.add("   ")
        msg_div.add(hint)
        msg_div.add(HtmlElement.br())
        
        
        option_div = DivWdg(css='spt_ui_options')
        #option_div.add_style('margin-left: 12px')
        
        sel = SelectWdg('pipeline_mode', label='Create tasks by: ')
        sel.set_option('values', ['simple process','context', 'standard'])
        sel.set_option('labels', ['process','context', 'all contexts in process'])
        sel.set_persistence()
        sel.add_behavior({'type':'change',
                 'cbjs_action': 'spt.panel.refresh(bvr.src_el)'}) 
        
        option_div.add(sel)

        value = sel.get_value()
        # default to simple process
        if not value:
            value = 'simple process'
        msg = ''
        if value not in ['simple process','context','standard']:
            value = 'simple process'
        
        if value == 'context':
            msg = 'In context mode, a single task will be created for each selected context.'
        elif value == 'simple process':
            msg = 'In process mode, a single task will be created for each selected process.'

        elif value == 'standard':
            msg = 'In this mode, a task will be created for all contexts of each selected process.'

        option_div.add(HintWdg(msg))
        div.add(option_div)
        div.add(HtmlElement.br())

        title = DivWdg('Assigned Pipelines')
        title.add_style('padding: 6px')
        title.add_color('background','background2')
        title.add_color('color','color', +120)
        div.add(title)
    
        content_div = DivWdg()
        content_div.add_style('min-height', '150px')
        div.add(content_div)
        content_div.add_border()
        
        filtered_search_key_list = []
        for sk in self.search_key_list:
            id = SearchKey.extract_id(sk)
            if id=='-1':
                continue
            filtered_search_key_list.append(sk)

        sobjects = SearchKey.get_by_search_keys(filtered_search_key_list)
        skipped = []
        pipeline_codes = []
        for sobject in sobjects:
            if isinstance(sobject, Task):
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:task_wdg.py

示例5: get_display

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

        top = my.top
        top.add_color("background", "background")
        top.add_color("color", "color")
        top.add_style("padding: 10px")
        top.add_style("min-width: 400px")

        from tactic.ui.app import HelpButtonWdg
        help_wdg = HelpButtonWdg(alias="exporting-csv-data")
        top.add(help_wdg)
        help_wdg.add_style("float: right")
        help_wdg.add_style("margin-top: -3px")
        
        if not my.check(): 
            top.add(DivWdg('Error: %s' %my.error_msg))
            top.add(HtmlElement.br(2))
            return super(CsvExportWdg, my).get_display()

        if my.search_type_list and my.search_type_list[0] != my.search_type:
            st = SearchType.get(my.search_type_list[0])
            title_div =DivWdg('Exporting related items [%s]' % st.get_title())
            top.add(title_div)
            top.add(HtmlElement.br())
            my.search_type = my.search_type_list[0]
            my.view = my.related_view

        if my.mode != 'export_all':
            num = len(my.selected_search_keys)
        else:
            search = Search(my.search_type)
            num = search.get_count()
        msg_div = DivWdg('Total: %s items to export'% num)
        msg_div.add_style("font-size: 12px")
        msg_div.add_style("font-weight: bold")
        msg_div.add_style('margin-left: 4px')
        top.add(msg_div)
        if num > 300:
            msg_div.add_behavior({'type':'load',
            'cbjs_action': "spt.alert('%s items are about to be exported. It may take a while.')" %num})
                
        top.add(HtmlElement.br())

        div  = DivWdg(css='spt_csv_export', id='csv_export_action')
        div.add_color("background", "background", -10)
        div.add_style("padding: 10px")
        div.add_style("margin: 5px")
        
        div.add_styles('max-height: 350px; overflow: auto')
        table = Table( css='minimal')
        table.add_color("color", "color")
        div.add(table)
        table.set_id('csv_export_table')
        table.center()
        
        
        cb_name = 'csv_column_name'
        master_cb = CheckboxWdg('master_control')
        master_cb.set_checked()
        master_cb.add_behavior({'type': 'click_up',
            'propagate_evt': True,
            'cbjs_action': '''
                var inputs = spt.api.Utility.get_inputs(bvr.src_el.getParent('.spt_csv_export'),'%s');
                for (var i = 0; i < inputs.length; i++)
                    inputs[i].checked = !inputs[i].checked;
                    ''' %cb_name})


        span = SpanWdg('Select Columns To Export')
        span.add_style('font-weight','600')
        table.add_row_cell(span)
        table.add_row_cell(HtmlElement.br())

        tr = table.add_row()
        tr.add_style('border-bottom: 1px groove #777')
        td = table.add_cell(master_cb)
        label = HtmlElement.i('toggle all')
        label.add_style('color: #888')
        table.add_cell(label)


        col1 = table.add_col()
        col1.add_style('width: 35px')
        col2 = table.add_col()
        
        if not my.search_type or not my.view:
            return table

        
        # use overriding element names and derived titles if available
        config = WidgetConfigView.get_by_search_type(my.search_type, my.view)
        if my.element_names and config:
            filtered_columns = my.element_names
            titles = []
            for name in my.element_names:
                title = config.get_element_title(name)
                titles.append(title)

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


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