本文整理汇总了Python中pyasm.web.Table类的典型用法代码示例。如果您正苦于以下问题:Python Table类的具体用法?Python Table怎么用?Python Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_check_table
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
示例2: get_display
def get_display(self):
self.order_sk = str(self.kwargs.get("order_sk"))
self.title_code = str(self.kwargs.get("title_code"))
full_title = str(self.kwargs.get("full_title"))
delivs_search = Search("twog/work_order_deliverables")
delivs_search.add_filter("title_code", self.title_code)
delivs = delivs_search.get_sobjects()
linked = []
for d in delivs:
linked.append(d.get_value("satisfied"))
satisfied = 0
unsatisfied = 0
for link in linked:
if link == True:
satisfied += 1
else:
unsatisfied += 1
table = Table()
table.add_row()
deliverable_launcher = table.add_cell("<u>Delivs: (%s/%s)</u>" % (satisfied, satisfied + unsatisfied))
deliverable_launcher.add_attr("nowrap", "nowrap")
deliverable_launcher.add_attr("valign", "bottom")
deliverable_launcher.add_style("font-size: 80%;")
deliverable_launcher.add_style("font-color: #2e2e2e;")
deliverable_launcher.add_style("cursor: pointer;")
deliverable_launcher.add_behavior(get_launch_deliverables_behavior(self.order_sk, self.title_code, full_title))
return table
示例3: make_check_table
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
示例4: get_display
def get_display(self):
if self.is_refresh:
top = Widget()
self.add(top)
web = WebContainer.get_web()
self.checked_processes = web.get_form_values('process_names')
left_checked_processes = web.get_form_values('left_process_names')
right_checked_processes = web.get_form_values('right_process_names')
is_split_view = web.get_form_values('split_view') == 'true'
else:
top = self.get_viewer()
self.process_names = [x for x in self.process_names if x ]
if self.is_refresh:
if self.process_names:
table = Table()
table.add_row()
td = table.add_cell()
expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(self.process_names)
table_id = 'main_table_left'
left_table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=self.view,\
show_row_select=True, show_insert=False, state={'parent_key': self.parent_key}, inline_search=False, show_refresh=True, expression=expression )
if self.resize:
from tactic.ui.container import ResizeScrollWdg
inner_wdg = ResizeScrollWdg( width='500px', height='500px', scroll_bar_size_str='thick', scroll_expansion='inside' )
inner_wdg.add(left_table)
td.add(inner_wdg)
else:
td.add(left_table)
top.add(table)
return top
示例5: get_content_wdg
def get_content_wdg(my):
div = DivWdg()
div.add_class("spt_tool_top")
table = Table()
div.add(table)
table.add_row()
td = table.add_cell()
from table_layout_wdg import FastTableLayoutWdg
kwargs = my.kwargs.copy()
td.add_style("width: 1%")
td.add_style("vertical-align: top")
layout_div = DivWdg()
layout_div.add_style("min-height: 500px")
td.add(layout_div)
my.kwargs['element_names'] = ['name','description','detail', 'file_list','general_checkin']
my.kwargs['show_shelf'] = False
layout = FastTableLayoutWdg(**my.kwargs)
layout_div.add(layout)
#from tactic.ui.panel import TileLayoutWdg
#layout = TileLayoutWdg(**my.kwargs)
#layout_div.add(layout)
td = table.add_cell()
td.add_border(color="#EEE")
td.add_style("vertical-align: top")
content = DivWdg()
td.add(content)
content.add_class("spt_tool_content")
#content.add_style("margin: -1px")
no_content_wdg = DivWdg()
content.add(no_content_wdg)
no_content_wdg.add("<br/>"*3)
no_content_wdg.add("<i>-- No Content --</i>")
#no_content_wdg.add_style("opacity: 0.5")
no_content_wdg.add_style("margin: 30px auto")
no_content_wdg.add_color("color", "color3")
no_content_wdg.add_color("background", "background3")
no_content_wdg.add_style("text-align", "center")
no_content_wdg.add_style("padding-top: 20px")
no_content_wdg.add_style("padding-bottom: 20px")
no_content_wdg.add_style("width: 350px")
no_content_wdg.add_style("height: 110px")
no_content_wdg.add_border()
return div
示例6: configure_category
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
示例7: get_display
def get_display(my):
widget = DivWdg()
table = Table()
table.add_row()
cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="%s">' % my.button_image)
launch_behavior = my.get_launch_behavior()
cell1.add_style("cursor: pointer;")
cell1.add_behavior(launch_behavior)
widget.add(table)
return widget
示例8: get_display
def get_display(my):
xml = ''
if my.client in ['Sony','sony']:
xml = my.make_sony_xml()
widget = DivWdg()
table = Table()
table.add_row()
table.add_cell('<textarea cols="120" rows="50" class="xml_display" name="xml_display" disabled="disabled">%s</textarea>' % xml)
widget.add(table)
return widget
示例9: get_display
def get_display(my):
widget = DivWdg()
table = Table()
order_poster = my.get_poster_img(my.code)
order_poster_entry = 'None'
if order_poster not in [None, '']:
order_poster_entry = '<img src="%s" width="135" height="200"/>' % order_poster
table.add_cell(order_poster_entry)
widget.add(table)
return widget
示例10: get_display
def get_display(my):
import re
from client.tactic_client_lib import TacticServerStub
from tactic.ui.panel import FastTableLayoutWdg
server = TacticServerStub.get()
sk = str(my.kwargs.get('sk'))
splits = sk.split('code=')
search_type = splits[0].split('?')[0];
code = splits[1];
search_id = re.findall(r'\d+', code)
search_id = int(search_id[0])
widget = DivWdg()
table = Table()
table.add_attr('class','snapshot_viewer_wdg')
table.add_attr('sk',sk)
#ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='table', element_names='preview,process,description,web_path,timestamp,login', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, width='100%s' % '%', show_column_manager=False, expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))", temp=True)
if search_type == 'sthpw/note':
expression = "@SOBJECT(sthpw/snapshot)"
else:
expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))"
ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='snapshot_by_process', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, height='300px', width='100%s' % '%', show_column_manager=False, expression=expression, temp=True)
table.add_row()
table.add_cell(ftl)
widget.add(table)
return widget
示例11: get_split_viewer
def get_split_viewer(self):
table = Table()
table.add_row()
td = table.add_cell()
inner_wdg = SingleNoteViewerWdg(processes_names=self.process_names, parent_key=self.kwargs.get('parent_key'), resize='true', checkbox_name = 'left_context_cb', show_context='true', append_context=self.append_context, view=self.view)
td.add(inner_wdg)
td = table.add_cell()
inner_wdg = SingleNoteViewerWdg(processes_names=self.process_names, parent_key=self.kwargs.get('parent_key'), resize='true', checkbox_name = 'right_context_cb', show_context='true', append_context=self.append_context, view=self.view)
td.add(inner_wdg)
return table
示例12: get_display
def get_display(my):
sobject = my.get_current_sobject()
tcode = sobject.get_code()
wo_inst = my.server.eval("@GET(twog/work_order['task_code','%s'].instructions)" % tcode)
instructions = ''
if len(wo_inst) > 0:
if wo_inst[0] != '':
instructions = '<textarea rows=8 cols=50 readonly>%s</textarea>' % wo_inst[0]
table = Table()
table.add_row()
table.add_cell(instructions)
return table
示例13: set_dates_table
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)
示例14: add_unassigned_instances
def add_unassigned_instances(my, widget, shot_inst_names):
''' add the unassigned instances into a SwapDisplayWdg '''
info = []
session = SessionContents.get()
if not session:
return ""
tactic_nodes = session.get_instance_names(is_tactic_node=True)
non_tactic_nodes = session.get_node_names(is_tactic_node=False)
"""
title = HtmlElement.b('Unassigned instances')
widget.add(title)
# this is just a filler for now, can be any sobjects
snapshots = []
for tactic_node in tactic_nodes:
if tactic_node not in shot_inst_names:
session_version = session.get_version(tactic_node)
session_snap = session.get_snapshot(tactic_node)
if session_snap:
snapshots.append(session_snap)
info.append({'session_version': session_version, 'instance':\
tactic_node})
div = DivWdg(id="unassigned_table")
SwapDisplayWdg.create_swap_title( title, swap, div)
table = TableWdg('sthpw/snapshot', 'session_items')
table.set_show_property(False)
table.set_aux_data(info)
table.set_sobjects(snapshots)
div.add(table)
widget.add(div)
widget.add(HtmlElement.br())
"""
# Add other non-tactic nodes
swap2 = SwapDisplayWdg.get_triangle_wdg()
title2 = HtmlElement.b('Other Nodes')
div2 = DivWdg(id="other_node_div")
widget.add(swap2)
widget.add(title2)
SwapDisplayWdg.create_swap_title( title2, swap2, div2)
hidden_table = Table(css='table')
div2.add(hidden_table)
hidden_table.set_max_width()
for node in non_tactic_nodes:
hidden_table.add_row()
hidden_table.add_cell(node)
hidden_table.add_blank_cell()
widget.add(div2)
示例15: get_files_checkbox_from_file_list
def get_files_checkbox_from_file_list(file_sobjects, selected_file_sobjects):
"""
Given a list of file sobjects, return a table of Checkbox widgets (CheckboxWdg) using the file paths and codes.
If a file is also in the selected_file_sobjects list, check it automatically.
:param file_sobjects: List of file sobjects
:param selected_file_sobjects: List of file sobjects (that are already selected)
:return: Table
"""
files_checkbox_table = Table()
header_row = files_checkbox_table.add_row()
header = files_checkbox_table.add_header(data='Files', row=header_row)
header.add_style('text-align', 'center')
header.add_style('text-decoration', 'underline')
for file_sobject in file_sobjects:
checkbox = CheckboxWdg(name=file_sobject.get_code())
if file_sobject.get_code() in [selected_file.get_code() for selected_file in selected_file_sobjects]:
checkbox.set_checked()
checkbox_row = files_checkbox_table.add_row()
files_checkbox_table.add_cell(data=checkbox, row=checkbox_row)
files_checkbox_table.add_cell(data=file_sobject.get_value('file_path'), row=checkbox_row)
return files_checkbox_table