本文整理汇总了Python中pyasm.web.Table.set_attr方法的典型用法代码示例。如果您正苦于以下问题:Python Table.set_attr方法的具体用法?Python Table.set_attr怎么用?Python Table.set_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Table
的用法示例。
在下文中一共展示了Table.set_attr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_attr [as 别名]
def get_display(self):
div = DivWdg()
div.add_style("margin: 0px 0px")
div.add_class("centered")
div.add(HtmlElement.br(7))
table = Table(css="login")
table.center()
table.set_attr("cellpadding", "3px")
table.add_row()
div.add(table)
error_div = DivWdg()
error_div.add_class("maq_search_bar")
error_div.add_style("font-size: 1.5em")
error_div.add_style("padding: 5px")
error_div.add_style("margin: 0 5px 0 5px")
error_div.add_style("text-align: center")
icon = IconWdg("Database Error", IconWdg.ERROR)
error_div.add(icon)
error_div.add("Databsae Error")
table.add_cell( error_div)
error = self.get_error()
table.add_row()
td = table.add_cell( "<b>%s</b>" % error )
td.add_style("padding: 5px 20px 5px 20px")
table.add_row()
td = table.add_cell( "<b>Please contact your Admistrator. In the meantime, you can login with 'admin'</b>" )
td.add_style("padding: 5px 20px 5px 20px")
table.add_row()
table.add_row()
OK = ProdIconSubmitWdg('Return to Login')
return div
示例2: DivWdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_attr [as 别名]
widget.add(HtmlElement.br())
table_div = DivWdg()
widget.add(table_div)
table_div.add_style("max-width: 650px")
table_div.add_style("overflow-x: auto")
# draw the actual table of data
table = Table()
table_div.add(table)
table.add_color('background','background')
table.add_color('color','color')
table.add_border()
table.set_attr("cellpadding", "3")
#table.add_attr('border','1')
table.add_style("width: 100%")
table.add_row()
for i, title in enumerate(columns):
if not title:
title = "<b style='color:red'>*</b>"
th = table.add_header(title)
th.add_style("min-width: 100px")
th.add_gradient("background", "background", -5)
th.add_style("padding: 3px")
th.add_style("text-align: left")
示例3: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_attr [as 别名]
def get_display(my):
web = WebContainer.get_web()
login_name = web.get_form_value('login')
hidden = HiddenWdg('login', login_name)
box = DivWdg(css='login')
if web.is_IE():
box.add_style("margin-top: 150px")
box.add_style("margin-bottom: 150px")
else:
box.add_style("margin-top: auto")
box.add_style("margin-bottom: auto")
box.add_style("text-align: center")
div = DivWdg()
div.add_style("margin: 0px 0px")
div.add_class("centered")
div.add_style("padding-top: 95px")
sthpw = SpanWdg("SOUTHPAW TECHNOLOGY INC", css="login_sthpw")
sthpw.add_style("color: #CCCCCC")
div.add( sthpw )
div.add( HtmlElement.br() )
div.add(hidden)
box.add(div)
# hidden element in the form to pass message that this was not
# actually a typical submitted form, but rather the result
# of a login page
div.add( HiddenWdg("is_from_login", "yes") )
div.add_style("font-size: 10px")
table = Table(css="login")
table.center()
table.set_attr("cellpadding", "3px")
table.add_row()
table2 = Table(css="login")
table2.center()
table2.add_style("width: 240px")
table2.add_row()
td = table2.add_header('After reset, the new password will be sent to the email address for [ %s ].'%login_name)
td.add_color('color','color', + 80)
table2.add_row_cell(' ')
# build the button manually
from tactic.ui.widget import ActionButtonWdg
button = ActionButtonWdg(tip='Reset Password', title='Reset')
button.add_style('margin: auto')
button.add_event('onclick',"document.form.elements['reset_password'].value='true'; document.form.submit()")
table2.add_row()
td = table2.add_cell(button)
hidden = HiddenWdg('reset_password')
td.add(hidden)
#th.add_class('center_content')
table2.add_row()
div.add(HtmlElement.br())
div.add(table)
div.add( HtmlElement.spacer_div(1,14) )
div.add(table2)
#div.add(HiddenWdg(my.LOGIN_MSG))
#box.add(script)
widget = Widget()
#widget.add( HtmlElement.br(3) )
table = Table()
table.add_style("width: 100%")
table.add_style("height: 85%")
table.add_row()
td = table.add_cell()
td.add_style("vertical-align: middle")
td.add_style("text-align: center")
td.add_style("background: transparent")
td.add(box)
widget.add(table)
return widget
示例4: ResizableTableWdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_attr [as 别名]
class ResizableTableWdg(BaseRefreshWdg):
def __init__(self, **kwargs):
self.table = Table()
self.table.add_style("border-collapse: collapse")
self.table.add_style("padding: 0px")
self.table.set_attr("cellpadding", "0px")
self.table.set_attr("cellspacing", "0px")
self.is_first_row = True
self.hilight = self.table.get_color("background", -40)
super(ResizableTableWdg, self).__init__(**kwargs)
def set_style(self, name, value=None):
self.table.set_style(name, value)
def set_max_width(self):
self.table.set_max_width()
def add_class(self, name):
self.table.add_class(name)
def get_display(self):
top = self.top
self.table.add_class("spt_resizable_table_top")
self.table.add_behavior( {
'type': 'load',
'cbjs_action': self.get_onload_js()
} )
self.table.add_behavior( {
'type': 'load',
'cbjs_action': '''
var resizable_cells = bvr.src_el.getElements(".spt_resizable_cell");
for (var i = 0; i < resizable_cells.length; i++) {
var resizable_el = resizable_cells[i].getElement(".spt_resizable");
if (!resizable_el) {
continue;
}
var size = resizable_cells[i].getSize();
resizable_el.setStyle("width", size.x);
resizable_el.setAttribute("width", size.x);
}
'''
} )
top.add(self.table)
return top
def set_keep_table_size(self):
self.table.add_class("spt_resizable_keep_size")
def add_color(self, color, modifier=0):
self.table.add_color(color, modifier)
def add_border(self, modifier=0):
self.table.add_border(modifier=modifier)
def add_style(self, name, value=None):
self.table.add_style(name, value=value)
def add_row(self, resize=True):
# add resize row
if not self.is_first_row and resize == True:
tr, td = self.table.add_row_cell()
td.add_style("height: 3px")
td.add_style("min-height: 3px")
td.add_style("cursor: n-resize")
tr.add_behavior( {
'type': 'drag',
'cb_set_prefix': 'spt.resizable_table.row_drag'
} )
tr.add_behavior( {
'type': 'hover',
'hilight': self.hilight,
'cbjs_action_over': '''
var color = bvr.src_el.getStyle("background-color");
bvr.src_el.setStyle("background-color", bvr.hilight);
bvr.src_el.setAttribute("spt_last_background", color);
''',
'cbjs_action_out': '''
var color = bvr.src_el.getAttribute("spt_last_background");
bvr.src_el.setStyle("background-color", color);
'''
} )
#.........这里部分代码省略.........
示例5: get_first_row_wdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_attr [as 别名]
def get_first_row_wdg(my):
# read the csv file
my.file_path = ""
div = DivWdg()
div.add( my.get_upload_wdg() )
if not my.search_type:
return div
if not my.file_path:
return div
if not my.file_path.endswith(".csv"):
div.add( "Uploaded file [%s] is not a csv file"% my.file_path)
return div
if not os.path.exists(my.file_path):
raise Exception("Path '%s' does not exists" % my.file_path)
div.add(HtmlElement.br(2))
div.add( HtmlElement.b("The following is taken from first line in the uploaded csv file. Select the appropriate column to match.") )
div.add(HtmlElement.br())
div.add( HtmlElement.b("Make sure you have all the required columns** in the csv."))
option_div = DivWdg()
option_div.add_style("float: left")
option_div.add_style("margin-right: 30px")
option_div.add("<p>3. Parsing Options:</p>")
my.search_type_obj = SearchType.get(my.search_type)
# first row and second row
option_div.add( HtmlElement.br(2) )
option_div.add("Use Title Row: ")
title_row_checkbox = FilterCheckboxWdg("has_title")
title_row_checkbox.set_default_checked()
option_div.add(title_row_checkbox)
option_div.add( HintWdg("Set this to use the first row as a title row to match up columns in the database") )
option_div.add( HtmlElement.br(2) )
option_div.add("Sample Data Row: ")
data_row_text = TextWdg("data_row")
data_row_text.set_attr("size", "3")
option_div.add(data_row_text)
option_div.add( HintWdg("Set this as a sample data row to match the columns to the database") )
option_div.add( HtmlElement.br(2) )
div.add(option_div)
my.has_title = title_row_checkbox.is_checked()
# parse the first fow
csv_parser = CsvParser(my.file_path)
if my.has_title:
csv_parser.set_has_title_row(True)
else:
csv_parser.set_has_title_row(False)
csv_parser.parse()
csv_titles = csv_parser.get_titles()
csv_data = csv_parser.get_data()
data_row = data_row_text.get_value()
if not data_row:
data_row = 0
else:
try:
data_row = int(data_row)
except ValueError:
data_row = 0
if data_row >= len(csv_data):
data_row = len(csv_data)-1
data_row_text.set_value(data_row)
table = Table()
table.set_attr("cellpadding", "10")
table.add_row()
table.add_header("CSV Column Value")
table.add_header("TACTIC Column")
table.add_header("Create New Column")
columns = my.search_type_obj.get_columns()
search_type = my.search_type_obj.get_base_search_type()
sobj = SObjectFactory.create(search_type)
required_columns = sobj.get_required_columns()
#.........这里部分代码省略.........