本文整理汇总了Python中pyasm.web.Table.add_styles方法的典型用法代码示例。如果您正苦于以下问题:Python Table.add_styles方法的具体用法?Python Table.add_styles怎么用?Python Table.add_styles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Table
的用法示例。
在下文中一共展示了Table.add_styles方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_styles [as 别名]
def get_display(my):
dd_activator = DivWdg()
if my.style:
dd_activator.add_styles( my.style )
dd_activator.add_style( "width: %spx" % my.width )
dd_activator.add_class("SPT_DTS");
if my.nudge_menu_horiz != 0:
dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz)
if my.nudge_menu_vert != 0:
dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert)
# Generate button ...
#
table = Table()
table.add_row()
table.add_styles("width: 100%; padding: 0px; margin: 0px;")
td = table.add_cell()
td.add_looks("menu border curs_default")
td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )
title_div = DivWdg()
title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
if my.icon_path:
img = HtmlElement.img()
img.set_attr("src", my.icon_path)
img.set_attr("title", my.title)
img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;")
title_div.add(img)
title_div.add_looks("menu")
else:
title_div.add(my.title)
title_div.add_looks("menu fnt_text")
td.add( title_div )
td = table.add_cell()
# -- Example of setting only some of the borders with dotted style ...
# td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
td.add_looks( "menu_btn_icon border curs_default" )
td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
"width: 15px; min-width: 15px;" \
"height: 12px; max-height: 12px;" )
arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
td.add( arrow_img )
dd_activator.add(table)
dd_activator.add( my.kwargs.get("smart_menu_set") )
dd_activator.add_class("SPT_SMENU_ACTIVATOR")
dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu',
'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } )
return dd_activator
示例2: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_styles [as 别名]
def get_display(my):
table = Table()
table.add_row()
count = 0
for btn_wdg in my.button_widgets:
td = table.add_cell()
if my.spacing and count:
td.add_styles( "padding-left: %spx;" % my.spacing )
count += 1
td.add( btn_wdg )
if my.float:
table.add_styles("float: %s;" % my.float)
if my.align:
if my.align == "left":
table.push_left()
elif my.align == "right":
table.push_right()
elif my.align == "center":
table.center()
return table
示例3: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_styles [as 别名]
def get_display(my):
dd_activator = DivWdg()
dd_activator.set_id( my.id )
if my.style:
dd_activator.add_styles( my.style )
dd_activator.add_style( "width: %spx" % my.width )
dd_activator.add_class("SPT_DTS");
if my.nudge_menu_horiz != 0:
dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz)
if my.nudge_menu_vert != 0:
dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert)
# Generate button ...
#
table = Table()
table.add_row()
table.add_styles("width: 100%; padding: 0px; margin: 0px;")
td = table.add_cell()
td.add_looks("menu border curs_default")
td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )
title_div = DivWdg()
title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
title_div.add_looks("menu fnt_text")
title_div.add(my.title)
td.add( title_div )
td = table.add_cell()
# -- Example of setting only some of the borders with dotted style ...
# td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
td.add_looks( "menu_btn_icon border curs_default" )
td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
"width: 15px; min-width: 15px;" \
"height: 12px; max-height: 12px;" )
arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
td.add( arrow_img )
dd_activator.add(table)
# Now generate the main drop down menu and any needed sub-menus ...
#
dd_map = my.menus[0]
if not dd_map.has_key('allow_icons'):
dd_map['allow_icons'] = True # default is to allow icons
if my.match_width:
dd_map['width'] = my.width
dd_menu_wdg = DropdownMenuWdg( activator_wdg=dd_activator, menu_id=dd_map['menu_id'],
width=dd_map['width'], opt_spec_list=dd_map['opt_spec_list'],
allow_icons=dd_map['allow_icons'] )
dd_activator.add( dd_menu_wdg )
sm_map_list = my.menus[1:]
for sm_map in sm_map_list:
if not sm_map.has_key('allow_icons'):
sm_map['allow_icons'] = True
submenu_wdg = SubMenuWdg( menu_id=sm_map['menu_id'], width=sm_map['width'],
opt_spec_list=sm_map['opt_spec_list'], allow_icons=sm_map['allow_icons'] )
dd_activator.add( submenu_wdg )
return dd_activator
示例4: get_example_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_styles [as 别名]
def get_example_display(self):
font_div = DivWdg()
font_div.add_styles( "background: #CCCCCC; color: #000000; border: 3px solid black; width: 750px;" )
font_table = Table()
font_table.add_styles( "margin-top: 6px;" )
font_table.add_row()
ft_style = "border: 1px solid black; border-collapse: collapse; padding: 3px; " \
"color: #000000; cursor: pointer; %s"
td = font_table.add_cell()
td.add_styles( "border: 0px; border-collapse: collapse; padding: 0px; width: 6px; background: #CCCCCC;" )
td.add( " " )
td = font_table.add_cell()
td.set_id("SPT_FONT_EXAMPLE_BTN")
td.add_styles( ft_style % "background: #CCCCCC;" )
td.add( "normal" )
td.add_behavior( { 'type': 'click_up',
'cbjs_action': '$("SPT_FONT_EXAMPLE").setStyle("display","block"); ' \
'$("SPT_FONT_EXAMPLE_ITALIC").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BOLD").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_ITALIC").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BTN").setStyle("background","#CCCCCC"); ' \
'$("SPT_FONT_EXAMPLE_ITALIC_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN").setStyle("background","#777777"); ' } )
td = font_table.add_cell()
td.add_styles( "border: 0px; border-collapse: collapse; padding: 0px; width: 6px; background: #CCCCCC;" )
td.add( " " )
td = font_table.add_cell()
td.set_id("SPT_FONT_EXAMPLE_ITALIC_BTN")
td.add_styles( ft_style % "background: #777777;" )
td.add( "<i>italic</i>" )
td.add_behavior( { 'type': 'click_up',
'cbjs_action': '$("SPT_FONT_EXAMPLE").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_ITALIC").setStyle("display","block"); ' \
'$("SPT_FONT_EXAMPLE_BOLD").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_ITALIC").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_ITALIC_BTN").setStyle("background","#CCCCCC"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN").setStyle("background","#777777"); ' } )
td = font_table.add_cell()
td.add_styles( "border: 0px; border-collapse: collapse; padding: 0px; width: 6px; background: #CCCCCC;" )
td.add( " " )
td = font_table.add_cell()
td.set_id("SPT_FONT_EXAMPLE_BOLD_BTN")
td.add_styles( ft_style % "background: #777777;" )
td.add( "<b>bold</b>" )
td.add_behavior( { 'type': 'click_up',
'cbjs_action': '$("SPT_FONT_EXAMPLE").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_ITALIC").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BOLD").setStyle("display","block"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_ITALIC").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_ITALIC_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_BTN").setStyle("background","#CCCCCC"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN").setStyle("background","#777777"); ' } )
td = font_table.add_cell()
td.add_styles( "border: 0px; border-collapse: collapse; padding: 0px; width: 6px; background: #CCCCCC;" )
td.add( " " )
td = font_table.add_cell()
td.set_id("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN")
td.add_styles( ft_style % "background: #777777;" )
td.add( "<b><i>bold italic</i></b>" )
td.add_behavior( { 'type': 'click_up',
'cbjs_action': '$("SPT_FONT_EXAMPLE").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_ITALIC").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BOLD").setStyle("display","none"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_ITALIC").setStyle("display","block"); ' \
'$("SPT_FONT_EXAMPLE_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_ITALIC_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_BTN").setStyle("background","#777777"); ' \
'$("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN").setStyle("background","#CCCCCC"); ' } )
font_div.add( font_table )
font_palettes = [ 'fnt_title_1', 'fnt_title_2', 'fnt_title_3', 'fnt_title_4', 'fnt_title_5',
'fnt_text', 'fnt_text_small', 'fnt_serif', 'fnt_code' ]
font_modifiers = [ 'fnt_italic', 'fnt_bold', 'fnt_bold fnt_italic' ]
font_example_div = DivWdg()
font_example_div.set_id( "SPT_FONT_EXAMPLE" )
for fnt_pal in font_palettes:
font_palette_div = DivWdg()
font_palette_div.add_looks( fnt_pal )
font_palette_div.add_styles( "color: black; padding-top: 10px; padding-left: 10px;" )
#.........这里部分代码省略.........
示例5: get_bottom_wdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_styles [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)
#.........这里部分代码省略.........
示例6: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_styles [as 别名]
def get_display(my):
if not my.preprocessed:
my.preprocess()
if my.is_refresh:
top = Widget()
else:
top = DivWdg()
top.add_class("spt_work_hours_top")
hidden = HiddenWdg('workhour_data')
hidden.add_class('spt_workhour_data')
header_data = {'start_date': str(my.start_date)}
header_data = jsondumps(header_data).replace('"', """)
hidden.set_value(header_data, set_form_value=False )
top.add(hidden)
days = []
for date in my.dates:
days.append( date.strftime("%Y_%m_%d") )
today = my.today.strftime("%Y_%m_%d")
task = my.get_current_sobject()
if not my.is_refresh:
my.set_as_panel(top)
entries = my.entries.get(task.get_code())
if isinstance(task, Task):
parent = task.get_parent()
if not parent:
disabled = True
else:
disabled = False
else:
disabled = False
if not entries:
entries = {}
table = Table()
top.add(table)
if my.use_straight_time:
row_list = [my.ST_ROW]
if my.show_overtime:
row_list.append(my.OT_ROW)
prefix_list = ['','ot']
else:
row_list = [my.STT_ROW, my.ENT_ROW]
prefix_list = ['stt','ent']
text = HiddenWdg(my.get_name() )
text.add_class("spt_data")
table.add_color("color", "color")
table.add_styles("width: %spx; float: left"%my.table_width)
for row_to_draw in row_list:
tr = table.add_row()
tr.add_style('line-height','8px')
td = table.add_blank_cell()
offset_width = my.MONTH_WIDTH + my.LEFT_WIDTH+8
td.add_style("min-width: %spx" % offset_width)
td.add(text)
# go through each day and draw an input for overtime
total_hours_st = 0
total_hours_ot = 0
search_key = task.get_search_key()
# Add a label to indicate if the row is straight time or overtime
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')
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: 0 4px 4px 0')
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: 0 4px 4px 0')
td.add(div)
for idx, day in enumerate(days):
day_wdg = DivWdg()
#.........这里部分代码省略.........
示例7: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_styles [as 别名]
def get_display(my):
#content.add_event("oncontextmenu", "spt.side_bar.manage_context_menu_action_cbk(); return false")
context_menu = DivWdg()
context_menu.add_class('spt_menu_top')
context_menu.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.finger_menu = {};
spt.finger_menu.timeout_id = -1;
'''
} )
context_menu.add_behavior( {
'type': 'mouseover',
'cbjs_action': '''
if (spt.finger_menu.timeout_id != -1) {
clearTimeout(spt.finger_menu.timeout_id);
spt.finger_menu.timeout_id = -1;
}
'''
} )
#context_menu.set_box_shadow(color='#fff')
# this may not be needed as it is set in JS
context_menu.add_style("z-index: 200")
# set up what happens when the mouse leaves the actual menu
my._set_menu_out(context_menu)
width = my.kwargs.get('width')
height = my.kwargs.get('height')
if not height:
height = 20
if not width:
width = 35
font_size = my.kwargs.get('font_size')
if not font_size:
font_size = 'smaller'
force = my.kwargs.get("force")
if my.mode == 'horizontal':
div = DivWdg(css='spt_finger_menu')
if force:
div.add_attr("spt_finger_force", force)
div.add_style("border-color: #aaa")
div.add_style("border-style: solid")
if force == "left":
div.add_style("border-width: 1px 0px 1px 1px")
div.add_style("border-radius: 12px 0px 0px 12px")
else:
div.add_style("border-width: 1px 1px 1px 0px")
div.add_style("border-radius: 0px 12px 12px 0px")
div.set_box_shadow(value="0px 0px 2px 1px")
#div.add_style("z-index: 1000")
total_width = width * len(my.items) + 15
div.add_style('width', total_width)
div.add_styles('height: %spx; padding: 2px;' %height)
context_menu.add(div)
div.add_color('background','background', -10)
palette = div.get_palette()
sb_title_bg = palette.color('side_bar_title')
bg_color = div.get_color('background', -10)
color = div.get_color('color')
for item in my.items:
mouse_enter_bvr = {'type':'mouseenter', 'cbjs_action': '''
bvr.src_el.setStyles({'background': '%s', 'color': 'white'})''' %sb_title_bg}
mouse_leave_bvr = {'type':'mouseleave', 'cbjs_action': '''
bvr.src_el.setStyles({'background': '%s', 'color': '%s'})''' %(bg_color, color)}
menu_item = FloatDivWdg(css='unselectable hand')
menu_item.add_color('background','background', -10)
menu_item.add(item.get_option('label'))
menu_item.add_behavior( mouse_enter_bvr )
menu_item.add_behavior( mouse_leave_bvr )
# add the passed-in bvr
bvr = item.get_option('bvr_cb')
menu_item.add_behavior(bvr )
menu_item.add_styles('margin: 0px 0 0 0; padding: 2px 0 2px 0; text-align: center; font-size: %s; width: %s; height: %spx'%(font_size, width, height-4))
menu_item.add_behavior({'type': 'click_up',
'cbjs_action': '''var menu = bvr.src_el.getParent('.spt_menu_top'); spt.hide(menu);'''})
div.add(menu_item)
#.........这里部分代码省略.........