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


Python ThumbWdg.set_has_img_link方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_has_img_link [as 别名]

#.........这里部分代码省略.........
                if category is not None and category != last_category:

                    table.add_row()
                    tr, td = table.add_row_cell()
                    category_div = DivWdg()
                    td.add(category_div)
                    if has_category and not category:
                        category_div.add(" ")
                    else:
                        category_div.add(category)
                    category_div.add_style("padding: 8px")
                    category_div.add_style("font-size: 16px")
                    category_div.add_style("font-weight: bold")
                    category_div.add_color("color", "color")
                    category_div.add_gradient("background", "background3",0, -10)
                    category_div.add_color("color", "color3")
                    #category_div.set_round_corners()
                    if last_category == None:
                        category_div.add_style("margin: -6 -6 6 -6")
                    else:
                        category_div.add_style("margin: 15 -6 0 -6")
                    table.add_row()
                    has_category = True
                    index = 0

                index += 1
                last_category = category


                thumb = ThumbWdg()
                thumb.set_name("snapshot")
                thumb.set_sobject(project)
                thumb.set_show_clipboard(False)
                thumb.set_has_img_link(False)
                thumb.set_icon_size(icon_size)
             
                code = project.get_code()
                title = project.get_value("title")
                # Restrict the length of project name
                if len(title) >= 36:
                    title = title[:36] + "..."
                if app_name != 'Browser':
                    href = HtmlElement.href(HtmlElement.h2(title), ref='/tactic/%s/%s'\
                        %(code, app_name))
                    img_href = HtmlElement.href(thumb, ref='/tactic/%s/%s'\
                        %(code, app_name))

                    link = '/tactic/%s/%s' % (code, app_name)
                else:
                    href = HtmlElement.href(HtmlElement.h2(title), ref="/tactic/%s/" % code)
                    img_href = DivWdg(thumb)
                    img_href.add_behavior( {
                        'type': 'click_up',
                        'code': code,
                        'cbjs_action': '''
                        document.location = '/tactic/'+bvr.code+'/';
                        '''
                    } )
                
                    link = '/tactic/%s/' % code

                href = href.get_buffer_display()
                if (index-1) % columns == 0:
                    table.add_row()
               
                td = table.add_cell()
开发者ID:mincau,项目名称:TACTIC,代码行数:70,代码来源:index_wdg.py

示例2: get_display

# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_has_img_link [as 别名]

#.........这里部分代码省略.........

        vnotes_div = DivWdg()
        vnotes_div.add_style("overflow: auto")
        vnotes_div.add_style("width: 200px")
        vnotes_div.add_style("min-height: 400px")
        vnotes_div.add_style("max-height: 600px")
        vnotes_div.add_style("border: solid 1px #999")
        vnotes_div.add_style("padding: 5px")
        vnotes_div.add_style("margin: 5px")

        left.add(vnotes_div)

        if not snapshots:
            vnotes_div.add("<b>No review notes available</b>")

            notes_wdg = VisualNotesWdg(search_key=my.search_key, context=my.context)
            content_div.add(notes_wdg)

        for snapshot in snapshots:
            vnote_div = DivWdg()
            vnotes_div.add(vnote_div)

            file_obj = snapshot.get_file_by_type("main")
            if not file_obj:
                vnote_div.add("None found")
                continue

            rel_path = file_obj.get_value("relative_dir")
            file_name = file_obj.get_value("file_name")
            image_url = "/assets/%s/%s" % (rel_path, file_name)

            login = snapshot.get_value("login")
            date = snapshot.get_value("timestamp")
            import dateutil

            date_str = dateutil.parser.parse(date).strftime("%b %m %Y - %H:%M")

            login_div = DivWdg()
            login_div.add_style("padding: 2px")
            login_div.add("User: ")
            login_div.add("<b>%s</b><br/>" % login)
            login_div.add("Date: ")
            login_div.add("<b>%s</b><br/>" % date_str)
            vnote_div.add(login_div)

            from pyasm.widget import ThumbWdg

            thumb_div = DivWdg()
            thumb_div.add_style("margin-left: 10px")
            thumb = ThumbWdg()
            thumb_div.add(thumb)
            thumb.set_has_img_link(False)
            thumb.set_option("detail", "false")
            thumb.set_option("icon_size", "80")
            thumb.set_sobject(snapshot)
            vnote_div.add(thumb_div)
            # file_obj = snapshot.get_file_by_type('icon')
            # rel_path = file_obj.get_value("relative_dir")
            # file_name = file_obj.get_value("file_name")
            # icon_url = "/assets/%s/%s" % (rel_path, file_name)
            # vnote_div.add("<img src='%s'/>" % icon_url )

            # vnote_div.add(snapshot.get_code() )
            vnote_div.add_attr("spt_image_url", image_url)
            vnote_div.add_class("hand")

            vnote_div.add_behavior(
                {
                    "type": "click_up",
                    "cbjs_action": """
            var value = bvr.src_el.innerHTML;
            var image_url = bvr.src_el.getAttribute("spt_image_url");

            var top = bvr.src_el.getParent(".spt_review_top");
            var content = top.getElement(".spt_review_content");
            content.innerHTML = "<img src='"+image_url+"'/>";
            """,
                }
            )

            # get the related note to this vnote
            # notes = vnotes_div.get_related_notes()
            search = Search("sthpw/note")
            search.add_parent_filter(sobject)
            notes = search.get_sobjects()

            # for note in notes:
            #    vnote_div.add(note.get_value("note"))

            from pyasm.biz import SObjectConnection

            connections, related_notes = SObjectConnection.get_connected_sobjects(snapshot, direction="src")
            for related_note in related_notes:
                vnote_div.add(related_note.get_value("note"))

            print "related_notes: ", related_notes

            vnote_div.add("<hr/>")

        return top
开发者ID:hellios78,项目名称:TACTIC,代码行数:104,代码来源:review_wdg.py


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