本文整理汇总了Python中pyasm.web.Table.add_style方法的典型用法代码示例。如果您正苦于以下问题:Python Table.add_style方法的具体用法?Python Table.add_style怎么用?Python Table.add_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Table
的用法示例。
在下文中一共展示了Table.add_style方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_python_script_test
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def handle_python_script_test(self, top):
top.add(DivWdg('Python Script Test', css='spt_info_title'))
table = Table(css='script')
table.add_color("color", "color")
table.add_style("margin: 10px")
table.add_style("width: 100%")
top.add(table)
table.add_row()
td = table.add_cell("Script Path: ")
td.add_style("width: 150px")
text = TextWdg('script_path')
td = table.add_cell(text)
button = ActionButtonWdg(title='Run')
table.add_cell(button)
button.add_style("float: right")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var s = TacticServerStub.get();
try {
var path = bvr.src_el.getParent('.script').getElement('.spt_input').value;
if (! path)
throw('Please enter a valid script path');
s.execute_cmd('tactic.command.PythonCmd', {script_path: path});
} catch(e) {
spt.alert(spt.exception.handler(e));
}
'''
})
示例2: make_login_table
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def make_login_table(my, sob):
table = Table()
table.add_style('background-color: #fffff1;')
max_width = 4
table.add_row()
top_cell = table.add_cell('<b><u>Responsible</u></b>')
top_cell.add_attr('colspan',max_width)
top_cell.add_attr('align','center')
count = 0
users = my.server.eval("@SOBJECT(sthpw/login['location','internal']['license_type','user']['@ORDER_BY','login'])")
for u in users:
if count % max_width == 0:
table.add_row()
checker = CheckboxWdg('responsible_%s' % u.get('login'))
checker.add_attr('login',u.get('login'))
checker.add_attr('code',sob.get('code'))
checker.add_attr('current_list', sob.get('responsible_users'))
#checker.set_persistence()
if sob.get('responsible_users') not in [None,'']:
if u.get('login') in sob.get('responsible_users'):
checker.set_value(True)
else:
checker.set_value(False)
else:
checker.set_value(False)
checker.add_behavior(my.get_make_responsible_behavior())
table.add_cell(checker)
label = table.add_cell(u.get('login'))
label.add_attr('nowrap','nowrap')
label.add_attr('width','137px')
count = count + 1
return table
示例3: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def get_display(my):
sobject = None
code = ''
show_checks = False
if 'source_code' in my.kwargs.keys():
code = str(my.kwargs.get('source_code'))
else:
sobject = my.get_current_sobject()
code = sobject.get_code()
if sobject.get_value('high_security') in [True,'T','t','1']:
show_checks = True
widget = DivWdg()
table = Table()
table.add_attr('width', '50px')
if show_checks:
table.add_style('background-color: #ff0000;')
login = Environment.get_login()
user_name = login.get_login()
table.add_row()
cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="Security Checklist" name="Security Checklist" src="/context/icons/32x32/lock_32_01.png">')
cell1.add_attr('user', user_name)
launch_behavior = my.get_launch_behavior(code,user_name)
cell1.add_style('cursor: pointer;')
cell1.add_behavior(launch_behavior)
widget.add(table)
return widget
示例4: get_delivery_snapshot_section
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def get_delivery_snapshot_section(self):
label_value_pairs = (
('Feature', 'feature_delivery_snapshot'),
('Trailer', 'trailer_delivery_snapshot'),
('Alt Audio', 'alt_audio_delivery_snapshot'),
('Subtitle', 'subtitle_delivery_snapshot'),
('CC', 'cc_delivery_snapshot'),
('Vendor Notes', 'vendor_notes_delivery_snapshot'),
('Poster Art', 'poster_art_delivery_snapshot'),
('Dub Card', 'dub_card_delivery_snapshot')
)
table = Table()
table.add_style('float', 'left')
table.add_row()
table.add_header('Delivery Snapshot')
for label_value_pair in label_value_pairs:
label, value = label_value_pair
table.add_row()
table.add_cell(label)
table.add_cell(self.get_true_false_select_wdg(value))
section_div = DivWdg()
section_div.add(table)
return section_div
示例5: make_check_table
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def make_check_table(my, dictoid, arr, sob, my_name, color, is_external_rejection=False):
table = Table()
table.add_style('background-color: %s;' % color)
max_width = 3
table.add_row()
top_cell = table.add_cell('<b><u>%s</u></b>' % my_name)
top_cell.add_attr('colspan',max_width)
top_cell.add_attr('align','center')
count = 0
for entry in arr:
if count % max_width == 0:
table.add_row()
checker = CheckboxWdg('check_%s' % dictoid[entry])
checker.add_attr('code', sob.get('code'))
checker.add_attr('field', dictoid[entry])
#checker.set_persistence()
if sob.get(dictoid[entry]):
checker.set_value(True)
else:
checker.set_value(False)
if not is_external_rejection:
checker.add_behavior(my.get_reason_check_behavior(dictoid[entry]))
check_hold = table.add_cell(checker)
check_hold.add_attr('code', sob.get('code'))
check_hold.add_attr('field', dictoid[entry])
label = table.add_cell(entry)
label.add_attr('nowrap','nowrap')
label.add_attr('width','190px')
count = count + 1
return table
示例6: make_check_table
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def make_check_table(my, dictoid, arr, sob, sk, my_name, color):
#Makes a table of checklisted items
table = Table()
table.add_style('background-color: %s;' % color)
#The maximum width across (max number of columns of checkboxes)
max_width = 3
table.add_row()
top_cell = table.add_cell('<b><u>%s</u></b>' % my_name)
top_cell.add_attr('colspan',max_width)
top_cell.add_attr('align','center')
count = 0
for entry in arr:
#If it has hit the max width for the row, create a new row
if count % max_width == 0:
table.add_row()
#Create textbox
check_bool = 'false'
if sob:
if sob.get(dictoid[entry]):
check_bool = 'true'
else:
check_bool = 'false'
else:
check_bool = 'false'
checker = CustomCheckboxWdg(name='errcheck_%s_%s' % (dictoid[entry], sk),value_field=dictoid[entry],checked=check_bool,dom_class='check_table_selector',field=dictoid[entry])
check_hold = table.add_cell(checker)
check_hold.add_attr('field', dictoid[entry])
label = table.add_cell(entry)
label.add_attr('nowrap','nowrap')
label.add_attr('width','190px')
count = count + 1
return table
示例7: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def get_display(my):
#my.init()
item_table = Table(css='minimal')
item_table.add_style('margin-left','30px')
for item in my.items:
item_table.add_row()
space_td = item_table.add_blank_cell()
item_td = item_table.add_cell(item.get_description())
item_td.set_attr("nowrap", "1")
delete = IconSubmitWdg("Remove from group", \
"stock_stop-16.png",add_hidden=False)
delete.add_event("onclick","document.form.remove_cmd.value=\
'%s|%s';document.form.submit();" \
% (my.group.get_primary_key_value(), item.get_primary_key_value()) )
del_span = SpanWdg(css='med')
del_span.add(delete)
item_table.add_cell(del_span)
if not my.items:
item_table.add_blank_cell()
my.add(item_table)
return super(ItemInContainerWdg, my).get_display()
示例8: get_section_two_bottom_table
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def get_section_two_bottom_table(self):
table = Table()
table.add_style('margin', '10px')
table.add_row()
table.add_header('')
table.add_header('Feature')
table.add_header('Audio Bundle')
table.add_header('Trailer/Preview')
label_value_pairs = (
('Audio configuration verified (stereo or mono/mapping is correct)?', 'audio_configuration_verified'),
('Audio is in sync with video (checked in 3 random spots and head/tail)?', 'audio_in_sync_with_video'),
('Audio is tagged correctly?', 'audio_tagged_correctly'),
('No audio is cut off (at beginning or end)?', 'no_audio_cut_off'),
('TRT of audio equals TRT of the video?', 'trt_audio_equals_trt_video'),
('Correct language is present (on applicable channels)?', 'correct_language_present')
)
for label_value_pair in label_value_pairs:
table.add_row()
table.add_cell(label_value_pair[0])
for section in ('feature', 'audio', 'preview'):
table.add_cell(self.get_true_false_select_wdg(label_value_pair[1] + '_' + section))
return table
示例9: handle_load_balancing
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def handle_load_balancing(self, top):
# deal with asset directories
top.add(DivWdg('Load Balancing', css='spt_info_title'))
table = Table()
table.add_class("spt_loadbalance")
table.add_color("color", "color")
table.add_style("margin: 10px")
top.add(table)
table.add_row()
td = table.add_cell("Load Balancing: ")
td.add_style("width: 150px")
button = ActionButtonWdg(title='Test')
td = table.add_cell(button)
message_div = DivWdg()
message_div.add_class("spt_loadbalance_message")
table.add_cell(message_div)
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var server = TacticServerStub.get()
var ports = {};
var count = 0;
for (var i = 0; i < 50; i++) {
var info = server.get_connection_info();
var port = info.port;
var num = ports[port];
if (!num) {
ports[port] = 1;
count += 1;
}
else {
ports[port] += 1;
}
// if there are 10 requests and still only one, then break
if (i == 10 && count == 1)
break;
}
// build the ports string
x = [];
for (i in ports) {
x.push(i);
}
x.sort();
x = x.join(", ");
var loadbalance_el = bvr.src_el.getParent(".spt_loadbalance");
var message_el = loadbalance_el.getElement(".spt_loadbalance_message");
if (count > 1) {
var message = "Yes (found " + count + " ports: "+x+")";
}
else {
var message = "<blink style='background: red; padding: 3px'>Not enabled (found only port " + x + ")</blink>";
}
message_el.innerHTML = message
'''
} )
示例10: get_info_wdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def get_info_wdg(self, sobject):
div = DivWdg()
div.add_style("margin: 10px 20px 20px 20px")
div.add_style("padding: 0px 20px")
#div.add_color("background", "background", -3)
#div.add_border()
#div.add_color("color", "color3")
#div.set_round_corners(5)
div.add_style("height", "100%")
div.add_style("position: relative")
element_names = self.element_names
config = self.config
table = Table()
table.add_style("height", "100%")
div.add(table)
for element_name in element_names:
table.add_row()
title = Common.get_display_title(element_name)
td = table.add_cell("%s: " % title)
td.add_style("width: 200px")
td.add_style("padding: 5px")
element = config.get_display_widget(element_name)
if self.first:
try:
element.handle_layout_behaviors(self.layout_wdg)
except Exception as e:
print "e :", e
pass
element.set_sobject(sobject)
element.preprocess()
td = table.add_cell(element)
td.add_style("padding: 5px")
#value = sobject.get_value(element_name, no_exception=True) or "N/A"
#table.add_cell(value)
show_notes = self.kwargs.get("show_notes")
if show_notes in [True, 'true']:
div.add("<br/>")
from tactic.ui.widget import DiscussionWdg
search_key = sobject.get_search_key()
notes_wdg = DiscussionWdg(search_key=search_key)
notes_wdg.set_sobject(sobject)
div.add(notes_wdg)
return div
示例11: _get_target_span
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def _get_target_span(my):
# get the target span
search = Search(my.container_cls)
my._order_search(search)
groups = search.get_sobjects()
if groups:
my.container_sobj = groups[0]
target_span = SpanWdg(css='med')
group_table = Table(my.GROUP_TABLE_NAME, css='table')
group_table.add_style('width','30em')
group_table.add_col(css='small')
group_table.add_col(css='small')
group_table.add_col()
target_span.add(group_table)
group_table.add_row_cell(search.get_search_type_obj()\
.get_description(), "heading")
checkbox = CheckboxWdg()
checkbox.set_option("onclick", \
"a=new Elements('container_ids');a.toggle_all(this);")
group_table.add_row()
group_table.add_cell(checkbox)
col_name = group_table.get_next_col_name()
toggle_control = HiddenRowToggleWdg(col_name=col_name, is_control=True, auto_index=True)
group_table.add_cell(toggle_control)
group_table.add_cell('MASTER CONTROL')
remove_cmd = HiddenWdg(SObjectGroupCmd.REMOVE_CMD)
my.add(remove_cmd)
for group in groups:
group_table.add_row()
checkbox = CheckboxWdg("container_ids")
checkbox.set_option("value", group.get_primary_key_value() )
toggle = HiddenRowToggleWdg(col_name, auto_index=True)
toggle.store_event()
group_details = ItemInContainerWdg( group, my.item_sobj, my.item_cls, my.grouping_cls )
# set the target content of the toggle
toggle.set_static_content(group_details)
group_table.add_cell( checkbox )
group_table.add_cell( toggle, add_hidden_wdg=True )
group_table.add_cell( group.get_description())
num_items = group_details.get_num_items()
if num_items:
td = group_table.add_cell( "( %s )" % num_items, 'no_wrap')
td.add_color(color)
else:
group_table.add_blank_cell()
return target_span
示例12: configure_category
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def configure_category(my, title, category, options, options_type = {}):
div = DivWdg()
title_wdg = DivWdg()
div.add(title_wdg)
#from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
#swap = SwapDisplayWdg()
#div.add(swap)
title_wdg.add("<b>%s</b>" % title)
table = Table()
div.add(table)
#table.add_color("color", "color")
table.add_style("color: #000")
table.add_style("margin: 20px")
for option in options:
table.add_row()
display_title = Common.get_display_title(option)
td = table.add_cell("%s: " % display_title)
td.add_style("width: 150px")
option_type = options_type.get(option)
validation_scheme = ""
#add selectWdg for those options whose type is bool
if option_type == 'bool':
text = SelectWdg(name="%s/%s" % (category, option))
text.set_option('values','true|false')
text.set_option('empty','true')
text.add_style("margin-left: 0px")
elif option.endswith('password'):
text = PasswordInputWdg(name="%s/%s" % (category, option))
# dealing with options whose type is number
else:
if option_type == 'number':
validation_scheme = 'INTEGER'
else:
validation_scheme = ""
text = TextInputWdg(name="%s/%s" % (category, option), validation_scheme=validation_scheme, read_only="false")
value = Config.get_value(category, option)
if value:
text.set_value(value)
table.add_cell(text)
return div
示例13: get_info_wdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def get_info_wdg(my, sobject):
div = DivWdg()
div.add_style("margin: 10px 20px 20px 20px")
div.add_style("padding: 20px")
div.add_color("background", "background", -3)
div.add_border()
div.add_color("color", "color3")
div.set_round_corners(5)
div.add_style("height", "100%")
div.add_style("position: relative")
element_names = my.kwargs.get("element_names")
if not element_names:
element_names = ["code","name","description",]
else:
element_names = element_names.split(",")
view = "table"
from pyasm.widget import WidgetConfigView
search_type = sobject.get_search_type()
config = WidgetConfigView.get_by_search_type(search_type, view)
table = Table()
table.add_style("height", "100%")
div.add(table)
for element_name in element_names:
table.add_row()
title = Common.get_display_title(element_name)
td = table.add_cell("%s: " % title)
td.add_style("width: 200px")
td.add_style("padding: 5px")
element = config.get_display_widget(element_name)
element.set_sobject(sobject)
element.preprocess()
td = table.add_cell(element)
td.add_style("padding: 5px")
#value = sobject.get_value(element_name, no_exception=True) or "N/A"
#table.add_cell(value)
div.add("<br/>")
from tactic.ui.widget import DiscussionWdg
search_key = sobject.get_search_key()
notes_wdg = DiscussionWdg(search_key=search_key)
notes_wdg.set_sobject(sobject)
div.add(notes_wdg)
return div
示例14: make_intermediate_unit
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def make_intermediate_unit(my, in_link, work_order_code, in_or_out, type_str):
inlink_st = in_link.get('__search_key__').split('?')[0]
if inlink_st == 'twog/work_order_intermediate':
lookmeup = in_link.get('intermediate_file_code')
elif inlink_st == 'twog/work_order_passin':
lookmeup = in_link.get('intermediate_file_code')
sob = my.server.eval("@SOBJECT(twog/intermediate_file['code','%s'])" % lookmeup)[0]
table = Table()
name = sob.get('name')
description = sob.get('description')
table.add_attr('width','100%s' % '%')
table.add_attr('border','1')
table.add_style('background-color: %s;' % my.color_lookup[in_or_out])
table.add_row()
table_src = Table()
type_cell = table_src.add_cell(type_str)
type_cell.add_attr('width', '25%s' % '%')
table_src.add_row()
checkbox = CheckboxWdg('src_disp_chk_%s' % sob.get('code'))
checkbox.add_attr('code',sob.get('code'))
checkbox.add_attr('special_name',name)
checkbox.add_attr('location',sob.get('location'))
checkbox.set_value(False)
#checkbox.set_persistence()
table_src.add_cell(checkbox)
table.add_cell(table_src)
info_tbl = Table()
info_tbl.add_attr('width','100%s' % '%')
info_tbl.add_row()
cell1 = info_tbl.add_cell('<u>Title:</u> %s' % name)
cell1.add_style('cursor: pointer;')
cell1.add_behavior(my.inspect_intermediate_popup(sob.get('code')))
if in_or_out == 'IN':
killer = info_tbl.add_cell(my.x_butt)
killer.add_style('cursor: pointer;')
killer.add_behavior(my.get_intermediate_passin_killer_behavior(in_link.get('code'), work_order_code, name))
info_tbl.add_row()
desc = info_tbl.add_cell(description)
desc.add_attr('colspan','2')
else:
info_tbl.add_row()
desc = info_tbl.add_cell(description)
long_cell = table.add_cell(info_tbl)
long_cell.add_attr('width','75%s' % '%')
table.add_row()
loc_cell1 = table.add_cell(' <u>Location:</u>')
loc_cell1.add_style('cursor: pointer;')
loc_cell1.add_behavior(my.location_changer(sob.get('__search_key__')))
loc_cell2 = table.add_cell(sob.get('location'))
loc_cell2.add_attr('class', 'sd_location_%s' % sob.get('code'))
loc_cell2.add_attr('colspan','2')
return table
示例15: set_dates_table
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_style [as 别名]
def set_dates_table(self, parent_table, client_deliver_by_date, expected_due_date):
"""
Sets a table showing the Client Deliver By and Expected Due Date. Both rows have a color depending on whether
or not the title is past due, due today, or neither. Dates are displayed in a more human readable format.
:param parent_table: The table containing the date table
:param client_deliver_by_date: Timestamp in '%Y-%m-%d %H:%M:%S' format
:param expected_due_date: Timestamp in '%Y-%m-%d %H:%M:%S' format
:return: None
"""
date_row = parent_table.add_row()
date_table = Table()
date_table.add_style('margin', '2px 0px')
client_deliver_by_date_status = get_date_status(client_deliver_by_date)
expected_due_date_status = get_date_status(expected_due_date)
# Get the color statuses of each date. Set to black if no status found
client_deliver_by_date_status_color = self.DATE_STATUS_COLOR.get(client_deliver_by_date_status, '#000000')
expected_due_date_status_color = self.DATE_STATUS_COLOR.get(expected_due_date_status, '#000000')
# The tr's for our td's in the table
expected_due_date_row = date_table.add_row()
client_deliver_by_row = date_table.add_row()
# Set the row's color
client_deliver_by_row.add_style('color', client_deliver_by_date_status_color)
expected_due_date_row.add_style('color', expected_due_date_status_color)
# Both rows will have the following styles
for each_row in [client_deliver_by_row, expected_due_date_row]:
each_row.add_style('font-size', '14px')
each_row.add_style('font-weight', 'bold')
each_row.add_style('text-shadow', '1px 1px #000000')
# Set the td's for Client Deliver By row, get the second cell for the padding-left function below
date_table.add_cell(data='Client Deliver By:', row=expected_due_date_row)
expected_due_date_cell = date_table.add_cell(data=expected_due_date.strftime('%m-%d-%Y %I:%M %p'),
row=expected_due_date_row)
# Set the td's for Expected Due Date row, get the second cell for the padding-left function below
date_table.add_cell(data='Expected Due Date:', row=client_deliver_by_row)
client_deliver_by_cell = date_table.add_cell(data=client_deliver_by_date.strftime('%m-%d-%Y %I:%M %p'),
row=client_deliver_by_row)
# Add left side padding to each of the td's with the dates (looks a little better when rendered)
map(lambda x: x.add_style('padding-left', '5px'), [client_deliver_by_cell, expected_due_date_cell])
# Append the date table to the parent table and we're done
parent_table.add_cell(data=date_table, row=date_row)