本文整理汇总了Python中pyasm.widget.TextWdg.add_color方法的典型用法代码示例。如果您正苦于以下问题:Python TextWdg.add_color方法的具体用法?Python TextWdg.add_color怎么用?Python TextWdg.add_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.TextWdg
的用法示例。
在下文中一共展示了TextWdg.add_color方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_bottom_wdg
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_color [as 别名]
def get_bottom_wdg(my, search_keys=[]):
# check if the user has enabled it
info = my.check_bottom_wdg()
if info.get('check') == False:
return None
if info.get('mode') != 'total':
top = DivWdg()
top.add("Only [total] is supported. Please change it in Edit Column Definition")
return top
my.today = datetime.date.today()
if my.is_refresh:
top = Widget()
else:
top = DivWdg()
days = []
for date in my.dates:
days.append( date.strftime("%Y_%m_%d") )
today = my.today.strftime("%Y_%m_%d")
table = Table()
top.add(table)
row_list = [my.ST_ROW]
if my.show_overtime:
row_list.append( my.OT_ROW)
for row_to_draw in row_list:
table.add_row()
table.add_color("color", "color")
table.add_styles("width: %spx; float: left"%my.table_width)
td = table.add_blank_cell()
td.add_style("min-width: %spx" % (my.MONTH_WIDTH + my.LEFT_WIDTH+8))
time_prefix = ''
if row_to_draw == my.OT_ROW:
time_prefix = 'ot'
div = DivWdg()
div.add("OT")
div.add_styles('text-align: right; margin-right: 4px; margin-bottom: 6px')
td.add(div)
elif row_to_draw == my.STT_ROW:
time_prefix = 'stt'
div = DivWdg()
div.add("ST")
div.add_styles('text-align: right; margin-right: 4px; margin-bottom: 6px')
td.add(div)
elif row_to_draw == my.ENT_ROW:
time_prefix = 'ent'
div = DivWdg()
div.add("ET")
div.add_styles('text-align: right; margin-right: 4px; margin-bottom: 6px')
td.add(div)
for idx, day in enumerate(days):
day_wdg = DivWdg()
day_wdg.add(day)
td = table.add_cell()
td.add_style("width: %spx" % my.day_width)
# keep it as text input for consistent alignment
text = TextWdg("%sday_%s" % (time_prefix, day) )
if row_to_draw == my.OT_ROW:
sobj_daily_dict = my.summary_ot[idx]
else:
sobj_daily_dict = my.summary_st[idx]
if search_keys:
sobj_daily_sub_dict = Common.subset_dict(sobj_daily_dict, search_keys)
else:
sobj_daily_sub_dict = sobj_daily_dict
daily_total = 0
for value in sobj_daily_sub_dict.values():
if value:
daily_total += value
text.set_value(daily_total)
td.add(text)
text.add_class("spt_day%s" % (time_prefix))
text.add_style("width: %spx"%(my.day_width-2))
#text.add_style("width: 100%")
text.add_style("text-align: right")
text.add_style("padding-left: 2px")
text.add_style('font-weight: 500')
text.set_attr("readonly", "readonly")
# grey out the text color
text.add_color('color', 'color', +40)
#.........这里部分代码省略.........