本文整理汇总了Python中pyasm.web.DivWdg.add_tip方法的典型用法代码示例。如果您正苦于以下问题:Python DivWdg.add_tip方法的具体用法?Python DivWdg.add_tip怎么用?Python DivWdg.add_tip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.DivWdg
的用法示例。
在下文中一共展示了DivWdg.add_tip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_tip [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(' ')
# 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)
#.........这里部分代码省略.........
示例2: _get_bar
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_tip [as 别名]
def _get_bar(my, percent, proc_count, task):
'''get a vertical bar indicating the progress of a task '''
sobject = my.get_current_sobject()
bar = DivWdg()
if my.desc_checkbox_value == "on":
bar.add_style('margin-right: 20px')
else:
bar.add_style('width: 10px')
bar.add_style('float: left')
cur_percent = 100.0
increment = 100.0 / proc_count
# get some task info
assigned = 'unassigned'
process = task.get_value('process')
if task.get_value('assigned').strip():
assigned = task.get_value('assigned')
task_desc = task.get_value('description')
if not task_desc:
task_desc = 'n/a'
start_date = task.get_value("bid_start_date")
end_date = task.get_value("bid_end_date")
if start_date:
start_date = Date(db_date=start_date, show_warning=False).get_display_date()
else:
start_date = "?"
if end_date:
end_date = Date(db_date=end_date, show_warning=False).get_display_date()
else:
end_date = "?"
# remove some spacing characters
task_desc = re.sub('(\n|\r|\t)', ' ', task_desc)
task_desc = re.sub('"', "'", task_desc)
task_status = task.get_value('status')
display_percent = percent
if percent < 0:
task_status = "%s <font color=red>(obsolete)</font>" % task_status
display_percent = 0
msg = '<b>%s</b><br/><hr>%s<br/><span style=padding-left:1em>desc: %s</span><br/>' \
'<span style=padding-left:1em>status:%s (%s%%)</span><br/>'\
'<span style=padding-left:1em>%s - %s</span>'\
% (process, assigned, task_desc, task_status, display_percent, start_date, end_date)
if WebContainer.get_web().get_browser() == "IE":
bar.add_event('onmouseover', "hint_bubble.show(event, '%s')" %msg)
else:
bar.add_tip(msg)
from pyasm.widget import IconWdg
end_date = task.get_value("bid_end_date")
end_date = Date(db_date=end_date, show_warning=False)
now_date = Date(show_warning=False)
if now_date.get_utc() > end_date.get_utc() and percent != 100:
alert_color = "#f00"
else:
alert_color = None
for x in xrange(proc_count):
cur_percent -= increment
div = DivWdg()
content = ' '
# unidentified status probably
if percent < 0:
content = '—'
div.add_style('text-decoration: blink')
div.add(content)
div.add_style('width: 10px')
if cur_percent < percent or cur_percent == 0:
if alert_color:
div.add_style("background-color: %s" % alert_color)
else:
div.add_style("background-color: %s" % my._get_color_code(percent))
bar_height = my.get_option("bar_height")
if not bar_height:
bar_height = my.bar_select_value
if not bar_height:
bar_height = '3'
div.add_style("height: %spx" % bar_height)
# IE needs to set the font size to reduce the overall size
div.add_style("font-size: %spx" % bar_height )
if sobject.is_retired():
div.add_class('task_status_bar_retired')
else:
if my.label_select_value == "abbr":
div.add_style("margin: -1px")
#div.add_class("task_status_bar")
#div.add_style("margin-top: 2px")
div.add_border()
#.........这里部分代码省略.........