本文整理汇总了Python中pyasm.widget.SelectWdg.add_attr方法的典型用法代码示例。如果您正苦于以下问题:Python SelectWdg.add_attr方法的具体用法?Python SelectWdg.add_attr怎么用?Python SelectWdg.add_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.SelectWdg
的用法示例。
在下文中一共展示了SelectWdg.add_attr方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
widget = DivWdg()
table = Table()
table.add_attr('class','my_preferences_wdg')
prefs = my.login_obj.get('twog_preferences').split(',')
for pref in prefs:
if pref not in [None,'']:
kv = pref.split('=')
key = kv[0]
val = kv[1]
table.add_row()
desc = table.add_cell(my.key_dict[key])
desc.add_attr('nowrap','nowrap')
this_sel = SelectWdg(key)
this_sel.add_attr('id',key)
this_sel.add_style('width: 100px;')
this_sel.append_option('True','true')
this_sel.append_option('False','false')
this_sel.set_value(val)
table.add_cell(this_sel)
table.add_row()
t2 = Table()
t2.add_row()
t2.add_cell()
tc = t2.add_cell('<input type="button" name="Save My Preferences" value="Save My Preferences"/>')
tc.add_attr('width', '50px')
tc.add_behavior(my.get_save_preferences())
t2.add_cell()
table.add_cell(t2)
widget.add(table)
return widget
示例2: get_sel
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_sel(my, id_name, arr, default, alpha_sort):
this_sel = SelectWdg(id_name)
this_sel.add_attr('id',id_name)
if default not in arr and default not in [None,'']:
arr.append(default)
if alpha_sort:
arr.sort()
arr2 = []
for a in arr:
arr2.append(a)
this_sel.append_option('--Select--','')
for a in arr2:
this_sel.append_option(a,a)
this_sel.set_value(default)
return this_sel
示例3: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
return ''
search_types = 'MMS/discipline.MMS/product_type'.split(".")
top = DivWdg()
parents = None
for search_type in search_types:
if not parents:
search = Search(search_type)
sobjects = search.get_sobjects()
columns = search.get_columns()
column = columns[1]
select = SelectWdg(search_type)
select.set_option("values", [x.get_id() for x in sobjects] )
select.set_option("labels", [x.get_value(column) for x in sobjects] )
top.add(select)
else:
for parent in parents:
search = Search(search_type)
search.add_relationship_filter(parent)
sobjects = search.get_sobjects()
if not sobjects:
continue
columns = search.get_columns()
column = columns[1]
values = [x.get_id() for x in sobjects]
labels = [x.get_value(column) for x in sobjects]
select = SelectWdg(search_type)
select.add_attr("spt_input_key", parent.get_id() )
select.set_option("values", values )
select.set_option("labels", labels )
top.add(select)
parents = sobjects
return top
示例4: get_statuses_select_from_task_pipe
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_statuses_select_from_task_pipe(self, status, pipe_code, search_type, task_sk, user_is_scheduler):
# gets the processes from the sobject's pipeline
statuses = ['Pending', 'Ready', 'On Hold', 'Client Response', 'Fix Needed', 'Rejected', 'In Progress',
'DR In Progress', 'Amberfin01 In Progress', 'Amberfin02 In Progress', 'BATON In Progress',
'Export In Progress', 'Need Buddy Check', 'Buddy Check In Progress', 'Completed']
task_select = SelectWdg('task_stat_select')
task_select.add_attr('old_status', status)
task_select.add_attr('id', 'status_{0}'.format(task_sk))
if len(statuses) > 0:
task_select.append_option('--Select--', '')
task_select.set_value(status)
for stat in statuses:
if stat == 'On Hold' and user_is_scheduler:
task_select.append_option(stat, stat)
if stat == 'Approved':
task_select.append_option('Rejected', 'Rejected')
task_select.append_option(stat, stat)
if stat == 'Approved':
task_select.append_option('Completed', 'Completed')
return task_select
示例5: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
from tactic_client_lib import TacticServerStub
work_order_code = ''
user = ''
sources = ''
platform = ''
colors = {'0': '#828282', '1': '#b8b8b8'}
types = ['Internal','Client','Platform']
if 'work_order_code' in my.kwargs.keys():
work_order_code = str(my.kwargs.get('work_order_code'))
if 'user' in my.kwargs.keys():
user = str(my.kwargs.get('user'))
if 'sources' in my.kwargs.keys():
sources = my.kwargs.get('sources')
if 'platform' in my.kwargs.keys():
platform = my.kwargs.get('platform')
delim1 = 'ZXuO#'
delim2 = '|||'
sources_arr = sources.split(delim1)
widget = DivWdg()
table = Table()
table.add_attr('class','alert_popup_%s' % work_order_code)
color_count = 0
for source in sources_arr:
entry_tbl = Table()
if source != 'MISSING SOURCE':
source_code, barcode, location = source.split(delim2);
else:
source_code = 'MISSING SOURCE'
barcode = 'MISSING SOURCE'
location = 'UNKNOWN'
row00 = entry_tbl.add_row()
nw00 = entry_tbl.add_cell('<b>Issue Type for <u>%s</u>:</b> ' % barcode)
nw00.add_attr('nowrap','nowrap')
type_sel = SelectWdg('report_type_%s' % work_order_code)
for t in types:
type_sel.append_option(t,t)
type_sel.add_attr('code', source_code)
type_sel.add_attr('name', barcode)
nw0 = entry_tbl.add_cell(type_sel)
nw0.add_attr('align','left')
nw0.add_attr('width','100%s' % '%')
row1 = entry_tbl.add_row()
nw1 = entry_tbl.add_cell('<b>File Path for <u>%s</u> (if applicable)</b>' % barcode)
nw1.add_attr('nowrap','nowrap')
row2 = entry_tbl.add_row()
nw11 = entry_tbl.add_cell('<textarea cols="45" rows="2" class="report_file_%s" code="%s" name="%s">%s</textarea>' % (work_order_code, source_code, barcode, location))
row3 = entry_tbl.add_row()
nw2 = entry_tbl.add_cell('<b>Description of Issue for <u>%s</u></b>' % barcode)
nw2.add_attr('nowrap','nowrap')
row4 = entry_tbl.add_row()
nw21 = entry_tbl.add_cell('<textarea cols="45" rows="10" class="report_operator_description_%s" code="%s" name="%s"></textarea>' % (work_order_code, source_code, barcode))
row1.add_style('background-color: %s;' % colors[str(color_count % 2)])
row2.add_style('background-color: %s;' % colors[str(color_count % 2)])
row3.add_style('background-color: %s;' % colors[str(color_count % 2)])
row4.add_style('background-color: %s;' % colors[str(color_count % 2)])
row00.add_style('background-color: %s;' % colors[str(color_count % 2)])
nw1.add_attr('colspan','2')
nw11.add_attr('colspan','2')
nw2.add_attr('colspan','2')
nw21.add_attr('colspan','2')
color_count = color_count + 1
table.add_row()
table.add_cell(entry_tbl)
table.add_row()
submit_cell = table.add_cell('<input type="button" value="Submit Alert(s)"/>')
submit_cell.add_attr('align','center')
submit_cell.add_behavior(my.alert_problems(work_order_code, user, platform))
widget.add(table)
return widget
示例6: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
table = Table()
tbl_id = "manual_proj_adder_top_%s" % my.order_sk
table.add_attr("id", tbl_id)
table.add_attr("search_type", "twog/proj")
table.add_attr("order_sk", my.order_sk)
table.add_attr("parent_sk", my.parent_sk)
table.add_attr("title_code", my.title_code)
table.add_attr("user_name", Environment.get_user_name())
ctbl = Table()
ctbl.add_row()
c1 = ctbl.add_cell("Project Names (Comma Delimited)")
c1.add_attr("nowrap", "nowrap")
ctbl.add_row()
ctbl.add_cell('<textarea cols="100" rows="5" id="comma_names" order_sk="%s"></textarea>' % my.order_sk)
table.add_row()
table.add_cell(ctbl)
table.add_row()
mid = table.add_cell("-- OR --")
mid.add_attr("align", "center")
ntbl = Table()
ntbl.add_row()
ntbl.add_cell("Name: ")
ntbl.add_cell('<input type="text" id="primary_name" style="width: 200px;"/>')
n1 = ntbl.add_cell(" From Number: ")
n1.add_attr("nowrap", "nowrap")
ntbl.add_cell('<input type="text" id="from_number" style="width: 50px;"/>')
n2 = ntbl.add_cell(" To Number: ")
n2.add_attr("nowrap", "nowrap")
ntbl.add_cell('<input type="text" id="to_number" style="width: 50px;"/>')
table.add_row()
table.add_cell(ntbl)
ptbl = Table()
start_date = CalendarInputWdg("start_date")
start_date.set_option("show_time", "true")
start_date.set_option("show_activator", "true")
start_date.set_option("display_format", "MM/DD/YYYY HH:MM")
start_date.set_option("time_input_default", "5:00 PM")
ptbl.add_row()
ptbl.add_cell("Start Date: ")
ptbl.add_cell(start_date)
due_date = CalendarInputWdg("due_date")
due_date.set_option("show_time", "true")
due_date.set_option("show_activator", "true")
due_date.set_option("display_format", "MM/DD/YYYY HH:MM")
due_date.set_option("time_input_default", "5:00 PM")
ptbl.add_row()
ptbl.add_cell("Due Date: ")
ptbl.add_cell(due_date)
btbl = Table()
etbl = Table()
platform_search = Search("twog/platform")
platform_search.add_order_by("name desc")
platforms = platform_search.get_sobjects()
plat_sel = SelectWdg("platform")
plat_sel.add_attr("id", "platform")
plat_sel.append_option("--Select--", "")
for p in platforms:
plat_sel.append_option(p.get_value("name"), p.get_value("name"))
ptbl.add_row()
ptbl.add_cell("Priority: ")
ptbl.add_cell('<input type="text" id="priority" style="width: 50px;"/>')
ptbl.add_row()
ptbl.add_cell("Platform: ")
ptbl.add_cell(plat_sel)
proj_search = Search("twog/proj")
proj_search.add_filter("title_code", my.parent_code)
proj_search.add_order_by("order_in_pipe")
projs = proj_search.get_sobjects()
btbl.add_row()
p1 = btbl.add_cell("<u>First Proj Comes After</u>")
p1.add_attr("nowrap", "nowrap")
p2 = btbl.add_cell("<u>Last Proj Leads To</u>")
p2.add_attr("nowrap", "nowrap")
fromtbl = Table()
for p in projs:
fromtbl.add_row()
checker = CustomCheckboxWdg(
name="from_check",
value_field=p.get_value("code"),
id=p.get_value("code"),
checked="false",
dom_class="from_check",
code=p.get_value("code"),
)
fromtbl.add_cell(checker)
fromtbl.add_cell("%s (%s)" % (p.get_value("process"), p.get_value("code")))
#.........这里部分代码省略.........
示例7: handle_dir_or_item
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def handle_dir_or_item(my, item_div, dirname, basename):
spath = "%s/%s" % (dirname, basename)
fspath = "%s/%s" % (dirname, File.get_filesystem_name(basename))
md5 = my.md5s.get(fspath)
changed = False
context = None
error_msg = None
snapshot = None
file_obj = my.checked_in_paths.get(fspath)
if not file_obj:
if fspath.startswith(my.base_dir):
rel = fspath.replace("%s/" % my.base_dir, "")
file_obj = my.checked_in_paths.get(rel)
if file_obj != None:
snapshot_code = file_obj.get_value("snapshot_code")
snapshot = my.snapshots_dict.get(snapshot_code)
if not snapshot:
# last resort
snapshot = file_obj.get_parent()
if snapshot:
context = snapshot.get_value("context")
item_div.add_attr("spt_snapshot_code", snapshot.get_code())
snapshot_md5 = file_obj.get_value("md5")
item_div.add_attr("spt_md5", snapshot_md5)
item_div.add_attr("title", "Checked-in as: %s" % file_obj.get_value("file_name"))
if md5 and md5 != snapshot_md5:
item_div.add_class("spt_changed")
changed = True
else:
error_msg = 'snapshot not found'
status = None
if file_obj != None:
if changed:
check = IconWdg( "Checked-In", IconWdg.ERROR, width=12 )
status = "changed"
else:
check = IconWdg( "Checked-In", IconWdg.CHECK, width=12 )
status = "same"
item_div.add_color("color", "color", [0, 0, 50])
else:
check = None
item_div.add_style("opacity: 0.8")
status = "unversioned"
if check:
item_div.add(check)
check.add_style("float: left")
check.add_style("margin-left: -16px")
check.add_style("margin-top: 4px")
# add the file name
filename_div = DivWdg()
item_div.add(filename_div)
filename_div.add(basename)
file_info_div = None
if snapshot and status != 'unversioned':
file_info_div = SpanWdg()
filename_div.add(file_info_div)
if error_msg:
filename_div.add(' (%s)'%error_msg)
filename_div.add_style("float: left")
filename_div.add_style("overflow: hidden")
filename_div.add_style("width: 65%")
# DEPRECATED
from pyasm.widget import CheckboxWdg, TextWdg, SelectWdg, HiddenWdg
checkbox = CheckboxWdg("check")
checkbox.add_style("display: none")
checkbox.add_class("spt_select")
checkbox.add_style("float: right")
checkbox.add_style("margin-top: 1px")
item_div.add(checkbox)
subcontext_val = ''
cat_input = None
is_select = True
if my.context_options:
context_sel = SelectWdg("context")
context_sel.add_attr('title', 'context')
context_sel.set_option("show_missing", False)
context_sel.set_option("values", my.context_options)
#.........这里部分代码省略.........
示例8: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
widget = DivWdg()
table = Table()
table.add_attr('class','client_deliverable_wdg')
table.add_row()
table2 = Table()
table2.add_style('border-spacing: 5px;')
table2.add_style('border-collapse: separate;')
table2.add_row()
c1 = table2.add_cell('Order Code:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('order_code')
tb1.add_attr('id','order_code')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['order_code'])
table2.add_cell(tb1)
c1 = table2.add_cell('PO Number:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('po_number')
tb1.add_attr('id','po_number')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['po_number'])
table2.add_cell(tb1)
c1 = table2.add_cell('Title Code:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('title_code')
tb1.add_attr('id','title_code')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['title_code'])
table2.add_cell(tb1)
c1 = table2.add_cell('Platform:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('platform')
tb1.add_attr('id','platform')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['platform'])
table2.add_cell(tb1)
c1 = table2.add_cell('Client:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('client_name')
tb1.add_attr('id','client_name')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['client_name'])
table2.add_cell(tb1)
table2.add_row()
table2.add_cell(table2.hr())
table2.add_row()
c1 = table2.add_cell('Title Source(s):')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('original_source_code')
tb1.add_attr('id','original_source_code')
tb1.add_attr('disabled','disabled')
tb1.add_style('width','200px')
tb1.set_value(my.sob['original_source_code'])
c2 = table2.add_cell(tb1)
c2.add_attr('colspan','2')
c1 = table2.add_cell('Title Source Barcodes(s):')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('original_source_barcode')
tb1.add_attr('id','original_source_barcode')
tb1.add_attr('disabled','disabled')
tb1.add_style('width','200px')
tb1.set_value(my.sob['original_source_barcode'])
c2 = table2.add_cell(tb1)
c2.add_attr('colspan','2')
c1 = table2.add_cell('Ancestors:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('ancestors')
tb1.add_attr('id','ancestors')
tb1.add_attr('disabled','disabled')
tb1.add_style('width','300px')
tb1.set_value(my.sob['ancestors'])
c2 = table2.add_cell(tb1)
c2.add_attr('colspan','3')
table2.add_row()
table2.add_cell(table2.hr())
table2.add_row()
c1 = table2.add_cell('Destination:')
c1.add_attr('nowrap','nowrap')
destination_sel = SelectWdg('destination')
destination_sel.add_attr('id','destination')
destination_sel.append_option('--Select--','')
for c in my.all_clients:
destination_sel.append_option(c.get('name'),c.get('name'))
if my.sob.get('destination') == None:
my.sob['destination'] = ''
destination_sel.set_value(my.sob.get('destination'))
table2.add_cell(destination_sel)
#.........这里部分代码省略.........
示例9: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
#.........这里部分代码省略.........
'percent': ['-13%',
'-12.95%'],
'currency': ['-$1,234',
'-$1,234.00',
'-$1,234.--',
'-1,234.00 CAD',
'($1,234.00)',
],
'date': ['31/12/99',
'December 31, 1999',
'31/12/1999',
'Dec 31, 99',
'Dec 31, 1999',
'31 Dec, 1999',
'31 December 1999',
'Fri, Dec 31, 99',
'Fri 31/Dec 99',
'Fri, December 31, 1999',
'Friday, December 31, 1999',
'12-31',
'99-12-31',
'1999-12-31',
'12-31-1999',
'12/99',
'31/Dec',
'December',
'52',
'DATE'],
'time': ['13:37',
'13:37:46',
'01:37 PM',
'01:37:46 PM',
'31/12/99 13:37',
'31/12/99 13:37:46',
'DATETIME'],
'scientific': ['-1.23E+03',
'-1.234E+03'],
'boolean': ['true|false', 'True|False', 'Checkbox'],
'timecode': ['MM:SS.FF',
'MM:SS:FF',
'MM:SS',
'HH:MM:SS.FF',
'HH:MM:SS:FF',
'HH:MM:SS'],
}
for key, select_values in selects_values.items():
# skip the empty key
if not key:
continue
# options for each
if prefix:
select = SelectWdg("%s|format" % prefix, for_display=False)
else:
select = SelectWdg("format", for_display=False)
select.add_class("spt_format")
select.add_attr("spt_type", key)
value = display_options.get('format')
if key == '':
select.add_style("display", "none")
elif widget_type == key:
select.set_value(value)
else:
select.add_style("display", "none")
select.add_attr("disabled", "disabled")
select.set_option("values", select_values)
select.add_empty_option("-- Format --")
top.add(select)
if key == 'timecode':
if prefix:
select = SelectWdg("%s|fps" % prefix, for_display=False)
else:
select = SelectWdg("fps", for_display=False)
select.add_class("spt_format")
select.add_attr("spt_type", key)
value = display_options.get('fps')
if widget_type == key:
select.set_value(value)
else:
select.add_style("display", "none")
select.set_option("values", "12|24|25|30|60")
select.set_option("labels", "12 fps|24 fps|25 fps|30 fps|60 fps")
select.add_empty_option("-- fps --")
top.add(select)
return top
示例10: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
person_code = ''
person = None
person_exists = False
has_login = 'false'
is_disabled = 'false'
is_employee = 'false'
login_obj = None
password = ''
existing_login_name = ''
if 'person_code' in my.kwargs.keys():
person_code = my.kwargs.get('person_code')
person_s = Search("twog/person")
person_s.add_filter('code',person_code)
person = person_s.get_sobject()
if person:
person_exists = True
login_name = person.get_value('login_name')
if login_name not in [None,'']:
login_s = Search("sthpw/login")
login_s.add_filter('login',login_name)
login_obj = login_s.get_sobject()
if login_obj:
has_login = 'true'
license_type = login_obj.get_value('license_type')
password = login_obj.get_value('password')
existing_login_name = login_obj.get_value('login')
if license_type == 'disabled':
is_disabled = 'true'
if login_obj.get_value('location') == 'internal':
is_employee = 'true'
first_name = ''
last_name = ''
company_code = ''
title = ''
email = ''
alternate_email = ''
main_phone = ''
work_phone = ''
cell_phone = ''
home_phone = ''
fax = ''
country = ''
state = ''
city = ''
zip = ''
street_address = ''
suite = ''
if person_exists:
first_name = person.get_value('first_name')
last_name = person.get_value('last_name')
company_code = person.get_value('company_code')
title = person.get_value('title')
email = person.get_value('email')
alternate_email = person.get_value('alternate_email')
main_phone = person.get_value('main_phone')
work_phone = person.get_value('work_phone')
cell_phone = person.get_value('cell_phone')
home_phone = person.get_value('home_phone')
fax = person.get_value('fax')
country = person.get_value('country')
state = person.get_value('state')
city = person.get_value('city')
zip = person.get_value('zip')
street_address = person.get_value('street_address')
suite = person.get_value('suite')
people_s = Search("twog/person")
people_s.add_order_by('last_name')
people_s.add_order_by('first_name')
people = people_s.get_sobjects()
peep_sel = SelectWdg("person_selector")
peep_sel.add_attr('id','person_selector')
peep_sel.append_option('--Create New Login--','NEW')
for peep in people:
peep_sel.append_option('%s, %s' % (peep.get_value('last_name'), peep.get_value('first_name')), peep.get_code())
if person_exists:
peep_sel.set_value(person_code)
peep_sel.add_behavior(my.switch_person())
company_s = Search("twog/company")
company_s.add_order_by('name')
companies = company_s.get_sobjects()
comp_sel = SelectWdg('company_code')
comp_sel.add_attr('id','company_code')
comp_sel.append_option('--Select--','')
for company in companies:
comp_sel.append_option(company.get_value('name'), company.get_code())
if person_exists:
comp_sel.set_value(company_code)
country_sel = SelectWdg('country')
country_sel.add_attr('id','country')
country_sel.append_option('--Select--','')
for country in my.countries:
country_sel.append_option(country,country)
if person_exists:
my_country = person.get_value('country')
if my_country in [None,'']:
my_country = ''
#.........这里部分代码省略.........
示例11: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
user_name = my.kwargs.get('user')
code = my.kwargs.get('code')
sk = my.kwargs.get('sk')
t_search = Search("twog/title")
t_search.add_filter('order_code',code)
titles = t_search.get_sobjects()
widget = DivWdg()
table = Table()
table.add_attr('class','clone_titles_selector')
# Select all or none
toggle_behavior = {'css_class': 'clickme', 'type': 'click_up', 'cbjs_action': '''
try{
var checked_img = '<img src="/context/icons/custom/custom_checked.png"/>'
var not_checked_img = '<img src="/context/icons/custom/custom_unchecked.png"/>'
var top_el = spt.api.get_parent(bvr.src_el, '.clone_titles_selector');
inputs = top_el.getElementsByClassName('title_selector');
var curr_val = bvr.src_el.getAttribute('checked');
image = '';
if(curr_val == 'false'){
curr_val = false;
image = not_checked_img;
}else if(curr_val == 'true'){
curr_val = true;
image = checked_img;
}
for(var r = 0; r < inputs.length; r++){
inputs[r].setAttribute('checked',curr_val);
inputs[r].innerHTML = image;
}
}
catch(err){
spt.app_busy.hide();
spt.alert(spt.exception.handler(err));
}
'''}
# Here need textbox for either an order code to clone to, or if the order code is invalid then create a new order with what is in the textbox as its name
table2 = Table()
table2.add_row()
uto = table2.add_cell('<input type="button" value="Clone to Same Order"/>')
uto.add_behavior(my.get_clone_here(code))
table2.add_row()
# User can enter a new name, which will create a new order with that name and place the clones inside
# Or user can provide an exiting order code, so the cloned titles will go into that one
t22 = table2.add_cell('Order Code or New Name:')
t22.add_attr('nowrap','nowrap')
namer = table2.add_cell('<input type="text" id="clone_order_name"/>')
charge_sel = SelectWdg("charge_sel")
charge_sel.add_style('width: 120px;')
charge_sel.add_attr('id','charge_sel')
charges = ['New','Redo','Redo - No Charge']
# Allow the user to tell us whether this is a normal order, a redo, or a redo with no charge
for ch in charges:
charge_sel.append_option(ch,ch)
table2.add_cell(' Type: ')
table2.add_cell(charge_sel)
table2.add_cell('Count: ')
table2.add_cell('<input type="text" value="1" id="clone_order_count"/>')
yn = SelectWdg('duplicate_order_vals')
yn.add_style('width: 100px;')
yn.append_option('No','No')
yn.append_option('Yes','Yes')
tac = table2.add_cell('Duplicate Order Values? ')
tac.add_attr('nowrap','nowrap')
table2.add_cell(yn)
table.add_row()
ncell = table.add_cell(table2)
t2b = Table()
t2b.add_attr('id','t2b')
# Put the toggler in if there are more than 1 titles
if len(titles) > 1:
t2b.add_row()
toggler = CustomCheckboxWdg(name='chk_clone_toggler',additional_js=toggle_behavior,value_field='toggler',id='selection_toggler',checked='false')
t2b.add_row()
t2b.add_cell(toggler)
t2b.add_cell('<b><- Select/Deselect ALL</b>')
table.add_row()
table.add_cell(t2b)
t3b = Table()
t3b.add_attr('id','t3b')
# Display list of titles to choose from
for title in titles:
t3b.add_row()
t3b.add_row()
tname = title.get_value('title')
if title.get_value('episode') not in [None,'']:
tname = '%s: %s' % (tname, title.get_value('episode'))
checkbox = CustomCheckboxWdg(name='clone_title_%s' % title.get_code(),value_field=title.get_code(),checked='false',text=tname,text_spot='right',text_align='left',nowrap='nowrap',dom_class='title_selector')
ck = t3b.add_cell(checkbox)
cter = t3b.add_cell(' --- Count: ')
# This is how many clones you want to add of each title
inser = t3b.add_cell('<input type="text" value="1" id="clone_count_%s" style="width: 40px;"/>' % title.get_code())
table.add_row()
table.add_cell(t3b)
#.........这里部分代码省略.........
示例12: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
top = DivWdg()
element_name = my.kwargs.get('element_name')
config_view = my.kwargs.get("config_view")
display_class = config_view.get_display_handler(element_name)
display_options = config_view.get_display_options(element_name)
element_attr = config_view.get_element_attributes(element_name)
name = element_attr.get('name')
edit = element_attr.get('edit')
title = element_attr.get('title')
width = element_attr.get('width')
# add the name
from pyasm.web import Table
table = Table()
top.add(table)
table.add_row()
td = table.add_cell("Name: ")
td.add_style("padding: 5px")
name_text = SpanWdg(name)
name_text.add_style('font-weight: bold')
name_text.add_attr("size", "50")
table.add_cell(name_text)
table.add_row_cell("<br/>Element Attributes:<br/>")
# add the title
table.add_row()
td = table.add_cell("Title: ")
td.add_style("padding: 5px")
title_text = TextWdg("title")
title_text.add_attr("size", "50")
if title:
title_text.set_value(title)
table.add_cell(title_text)
# add the width
table.add_row()
td = table.add_cell("Width: ")
td.add_style("padding: 5px")
width_text = TextWdg("width")
if width:
width_text.set_value(width)
width_text.add_attr("size", "50")
table.add_cell(width_text)
# add the editable
table.add_row()
td = table.add_cell("Editable: ")
td.add_style("padding: 5px")
editable_text = CheckboxWdg("editable")
editable_text.add_attr("size", "50")
table.add_cell(editable_text)
table.add_row_cell("<br/>Display:<br/>")
# add the widget
table.add_row()
td = table.add_cell("Widget: ")
td.add_style("padding: 5px")
widget_select = SelectWdg("widget")
options = ['Expression']
widget_select.set_option("values", options)
widget_select.add_empty_option("-- Select --")
#widget_select.set_value(display_class)
table.add_cell(widget_select)
table.add_row_cell(" - or -")
# add the class
table.add_row()
td = table.add_cell("Class Name: ")
td.add_style("padding: 5px")
class_text = TextWdg("class_name")
class_text.set_value(display_class)
class_text.add_attr("size", "50")
table.add_cell(class_text)
# introspect the widget
if not display_class:
display_class = "pyasm.widget.SimpleTableElementWdg"
#display_class = "tactic.ui.panel.ViewPanelWdg"
from pyasm.common import Common
import_stmt = Common.get_import_from_class_path(display_class)
if import_stmt:
exec(import_stmt)
else:
#.........这里部分代码省略.........
示例13: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_attr [as 别名]
def get_display(my):
table = Table()
tbl_id = 'manual_wo_adder_top_%s' % my.order_sk
table.add_attr("id", tbl_id)
table.add_attr('search_type', 'twog/work_order')
table.add_attr('order_sk', my.order_sk)
table.add_attr('parent_sk', my.parent_sk)
table.add_attr('title_code', my.title_code)
table.add_attr('user_name', Environment.get_user_name())
ctbl = Table()
ctbl.add_row()
c1 = ctbl.add_cell('Work Order Names (Comma Delimited)')
c1.add_attr('nowrap', 'nowrap')
ctbl.add_row()
ctbl.add_cell('<textarea cols="100" rows="5" id="comma_names" order_sk="%s"></textarea>' % my.order_sk)
table.add_row()
table.add_cell(ctbl)
table.add_row()
mid = table.add_cell('-- OR --')
mid.add_attr('align', 'center')
ntbl = Table()
ntbl.add_row()
ntbl.add_cell('Name: ')
ntbl.add_cell('<input type="text" id="primary_name" style="width: 200px;"/>')
n1 = ntbl.add_cell(' From Number: ')
n1.add_attr('nowrap', 'nowrap')
ntbl.add_cell('<input type="text" id="from_number" style="width: 50px;"/>')
n2 = ntbl.add_cell(' To Number: ')
n2.add_attr('nowrap', 'nowrap')
ntbl.add_cell('<input type="text" id="to_number" style="width: 50px;"/>')
table.add_row()
table.add_cell(ntbl)
ptbl = Table()
start_date = CalendarInputWdg('start_date')
start_date.set_option('show_time', 'true')
start_date.set_option('show_activator', 'true')
start_date.set_option('display_format', 'MM/DD/YYYY HH:MM')
start_date.set_option('time_input_default', '5:00 PM')
ptbl.add_row()
ptbl.add_cell("Start Date: ")
ptbl.add_cell(start_date)
due_date = CalendarInputWdg('due_date')
due_date.set_option('show_time', 'true')
due_date.set_option('show_activator', 'true')
due_date.set_option('display_format', 'MM/DD/YYYY HH:MM')
due_date.set_option('time_input_default', '5:00 PM')
ptbl.add_row()
ptbl.add_cell("Due Date: ")
ptbl.add_cell(due_date)
btbl = Table()
etbl = Table()
g_search = Search("sthpw/login_group")
g_search.add_where("\"login_group\" not in ('user','client')")
g_search.add_order_by('login_group')
groups = g_search.get_sobjects()
group_sel = SelectWdg('assigned_login_group')
group_sel.add_attr('id', 'assigned_login_group')
group_sel.append_option('--Select--', '')
for group in groups:
group_sel.append_option(group.get_value('login_group'), group.get_value('login_group'))
user_search = Search("sthpw/login")
user_search.add_filter('location', 'internal')
user_search.add_filter('license_type', 'user')
user_search.add_order_by('login')
users = user_search.get_sobjects()
user_sel = SelectWdg("assigned")
user_sel.add_attr('id', 'assigned')
user_sel.append_option('--Select--', '')
for u in users:
user_sel.append_option(u.get_value('login'), u.get_value('login'))
ptbl.add_row()
p1 = ptbl.add_cell('Work Group: ')
p1.add_attr('nowrap', 'nowrap')
ptbl.add_cell(group_sel)
ptbl.add_row()
ptbl.add_cell('Assigned: ')
ptbl.add_cell(user_sel)
ptbl.add_row()
p2 = ptbl.add_cell('Title Id Number: ')
p2.add_attr('nowrap', 'nowrap')
ptbl.add_cell('<input type="text" id="title_id_num" style="width: 200px;"/>')
ptbl.add_row()
p3 = ptbl.add_cell('Estimated Work Hours: ')
p3.add_attr('nowrap', 'nowrap')
ptbl.add_cell('<input type="text" id="estimated_work_hours" style="width: 50px;"/>')
ptbl.add_row()
p4 = ptbl.add_cell('Instructions: ')
p4.add_attr('valign', 'top')
ptbl.add_cell('<textarea cols="100" rows="20" id="instructions"></textarea>')
wo_search = Search("twog/work_order")
#.........这里部分代码省略.........