本文整理汇总了Python中pyasm.widget.HiddenWdg.set_value方法的典型用法代码示例。如果您正苦于以下问题:Python HiddenWdg.set_value方法的具体用法?Python HiddenWdg.set_value怎么用?Python HiddenWdg.set_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.HiddenWdg
的用法示例。
在下文中一共展示了HiddenWdg.set_value方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
def get_display(my):
top = my.top
view = my.kwargs.get("view")
top.add_class("spt_help_edit_content")
search = Search("config/widget_config")
search.add_filter("category", "HelpWdg")
search.add_filter("view", view)
sobject = search.get_sobject()
if not sobject:
value = ""
search_key = ""
else:
xml_value = sobject.get_xml_value("config")
value = xml_value.get_value("config/%s/html/div" % (view) )
search_key = sobject.get_search_key()
title_wdg = DivWdg()
top.add(title_wdg)
title_wdg.add("<b>View: %s</b>" % view)
title_wdg.add_style("font-style: bold")
title_wdg.add_style("padding: 5px")
title_wdg.add_gradient("background", "background", 0, -10)
hidden = HiddenWdg("view")
top.add(hidden)
hidden.set_value(view)
text = TextAreaWdg("content")
text_id = text.set_unique_id()
text.set_value(value)
from tactic.ui.widget import ActionButtonWdg
if sobject:
delete_button = ActionButtonWdg(title="Delete")
top.add(delete_button)
delete_button.add_style("float: right")
delete_button.add_style("margin-top: -3px")
delete_button.add_behavior( {
'type': 'click_up',
'search_key': search_key,
'cbjs_action': '''
if (!confirm("Are you sure you wish to delete this help page?")) {
return;
}
var server = TacticServerStub.get();
server.delete_sobject(bvr.search_key);
var top = bvr.src_el.getParent(".spt_help_edit_top");
spt.panel.refresh(top);
'''
})
test_button = ActionButtonWdg(title="Preview")
top.add(test_button)
test_button.add_style("float: right")
test_button.add_style("margin-top: -3px")
test_button.add_behavior( {
'type': 'click_up',
'text_id': text_id,
'cbjs_action': '''
var js_file = "ckeditor/ckeditor.js";
var url = "/context/spt_js/" + js_file;
var js_el = document.createElement("script");
js_el.setAttribute("type", "text/javascript");
js_el.setAttribute("src", url);
var head = document.getElementsByTagName("head")[0];
head.appendChild(js_el);
var cmd = "CKEDITOR.instances." + bvr.text_id + ".getData()";
var text_value = eval( cmd );
bvr.options = {};
bvr.options.html = text_value;
spt.named_events.fire_event("show_help", bvr)
'''
})
save_button = ActionButtonWdg(title="Save")
top.add(save_button)
save_button.add_style("float: right")
save_button.add_style("margin-top: -3px")
top.add("<br/>")
#.........这里部分代码省略.........
示例2: get_data_wdg
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
#.........这里部分代码省略.........
name_div.add(category_div)
checkbox = RadioWdg("category")
checkbox.set_option("value", "by_week")
category_div.add(checkbox)
category_div.add(" Categorize files by Week")
category_div.add_style("margin-bottom: 5px")
category_div = DivWdg()
name_div.add(category_div)
checkbox = RadioWdg("category")
checkbox.set_option("value", "by_year")
category_div.add(checkbox)
category_div.add(" Categorize files by Year")
category_div.add_style("margin-bottom: 5px")
"""
checkbox = RadioWdg("category")
checkbox.set_option("value", "custom")
name_div.add(checkbox)
name_div.add(" Custom")
"""
name_div.add("<br/>")
hidden = HiddenWdg(name="parent_key")
dialog_data_div.add(hidden)
hidden.add_class("spt_parent_key")
parent_key = my.kwargs.get("parent_key") or ""
if parent_key:
hidden.set_value(parent_key)
dialog_data_div.add("Keywords:<br/>")
dialog.add(dialog_data_div)
text = TextAreaWdg(name="keywords")
dialog_data_div.add(text)
text.add_class("spt_keywords")
text.add_style("padding: 1px")
dialog_data_div.add("<br/>"*2)
extra_data = my.kwargs.get("extra_data")
if not isinstance(extra_data, basestring):
extra_data = jsondumps(extra_data)
dialog_data_div.add("Extra Data (JSON):<br/>")
text = TextAreaWdg(name="extra_data")
dialog_data_div.add(text)
if extra_data != "null":
text.set_value(extra_data)
text.add_class("spt_extra_data")
text.add_style("padding: 1px")
#### TEST Image options
"""
示例3: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
#.........这里部分代码省略.........
hidden = HiddenWdg(hidden_name,"")
next.add(hidden)
next.add_event('onclick',"spt.api.Utility.get_input(document,'%s').value ='Next';%s" \
%(hidden_name, my.refresh_script))
showing_wdg = DivWdg()
widget.add(showing_wdg)
showing_wdg.add_style("padding: 10px")
showing_wdg.add_style("margin: 10px")
showing_wdg.add_color("background", "background", -5)
showing_wdg.add_border()
label_span = SpanWdg("Showing: ")
showing_wdg.add(label_span)
showing_wdg.add( prev )
# this min calculation is used so that if my.sobjects is not set
# above for the calculation of the limit, which will make the last
# set of range numbers too big
left_bound = my.current_offset+1
if not limit:
# prevent error in ItemsNavigatorWdg if a search encounters query error
limit = 50
my.search_limit = limit
right_bound = min(my.current_offset+limit, my.count)
if left_bound > right_bound:
left_bound = 1
current_value = "%d - %d" % (left_bound, right_bound)
if my.style == my.SIMPLE:
showing_wdg.add( current_value )
else:
# add a range selector using ItemsNavigatorWdg
from pyasm.widget import ItemsNavigatorWdg
selector = ItemsNavigatorWdg(my.label, my.count, my.search_limit)
selector.select.add_behavior( {
'type': 'change',
'cbjs_action': my.refresh_script
} )
selector.set_style(my.style)
selector.set_value(current_value)
selector.set_display_label(False)
showing_wdg.add( selector)
showing_wdg.add( next )
#showing_wdg.add( " x ")
showing_wdg.add(my.text)
my.text.add_style("margin-top: -3px")
my.text.set_attr("size", "1")
my.text.add_attr("title", "Set number of items per page")
widget.add("<hr/>")
# set the limit
set_limit_wdg = my.get_set_limit_wdg()
widget.add(set_limit_wdg)
from tactic.ui.widget.button_new_wdg import ActionButtonWdg
button = ActionButtonWdg(title='Search')
widget.add(button)
button.add_style("float: right")
button.add_style("margin-top: 8px")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_search_limit_top");
var select = top.getElement(".spt_search_limit_select");
var value = select.value;
if (value == 'Custom') {
custom = top.getElement(".spt_search_limit_custom_text");
value = custom.value;
}
if (value == '') {
value = 20;
}
var text = top.getElement(".spt_search_limit_text");
text.value = value;
spt.dg_table.search_cbk({}, bvr)
'''
} )
offset_wdg = HiddenWdg("%s_last_search_offset" %my.label)
offset_wdg.set_value(my.current_offset)
widget.add(offset_wdg)
widget.add("<br clear='all'/>")
return widget
示例4: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
def get_display(self):
top = DivWdg()
top.add_class("ad_input_top")
name = self.get_name()
text = TextWdg(self.get_input_name())
# get the login
sobject = self.get_current_sobject()
client = sobject.get_value("contact_name")
print "client: ", client
if client:
login_sobj = Login.get_by_code(client)
else:
login_sobj = Environment.get_login()
# build the display_name
login = login_sobj.get_value("login")
display_name = login_sobj.get_value("display_name")
if not display_name:
display_name = "%s %s" % (user.get('first_name'), user.get('last_name'))
display_name = display_name.replace('"', "'")
print "login: ", login
hidden = HiddenWdg(self.get_input_name())
hidden.set_options( self.options.copy() )
hidden.add_class("spt_ad_input")
if login:
hidden.set_value(login)
top.add(hidden)
# copy over some options
#text.set_options( self.options.copy() )
if login:
text.set_value(display_name)
text.set_option("read_only", "true")
text.add_class("spt_ad_display")
top.add(text)
top.add(" ")
groups_str = self.get_option("groups_allowed_to_search")
if groups_str:
stmt = 'groups_list = %s' % groups_str
exec stmt
else:
groups_list = None
allow_search = True
if groups_list:
allow_search = False
login_in_group_list = Search.eval("@SOBJECT(sthpw/login_in_group['login','=','%s'])" % login)
for login_in_group in login_in_group_list:
group = login_in_group.get_value("login_group")
if group in groups_list:
allow_search = True
break
if login == 'admin':
allow_search = True
if allow_search:
button = IconButtonWdg('Search for User', IconWdg.USER)
#button = ButtonWdg()
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent('.ad_input_top');
var content = top.getElement('.ad_input_content');
spt.toggle_show_hide(content);
'''
} )
top.add(button)
ad_top = DivWdg()
ad_top.add_class("ad_input_content")
ad_top.add_style("display: none")
ad_top.add_style("position: absolute")
ad_top.add_style("background: #222")
ad_top.add_style("min-width: 300px")
ad_top.add_style("border: solid 1px #000")
ad_top.add_style("padding: 20px")
cbjs_action = '''
var value = bvr.src_el.getAttribute('spt_input_value');
var display_value = bvr.src_el.getAttribute('spt_display_value');
var phone_number = bvr.src_el.getAttribute('spt_phone_number');
var email = bvr.src_el.getAttribute('spt_mail');
var top = bvr.src_el.getParent('.ad_input_top');
#.........这里部分代码省略.........
示例5: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
def get_display(self):
top_wdg = DivWdg()
top_wdg.add_style("color: black")
top_wdg.add_style("width: 350px")
top_wdg.add_style("margin-top: 10px")
top_wdg.add_style("padding: 10px")
top_wdg.add_border()
title = DivWdg()
title.add_style("color: black")
title.add_style("margin-top: -22px")
top_wdg.add(title)
#if not self.name_string:
# title.add('No database column')
# return top_wdg
title.add("Widget Definition")
widget_types = {
'foreign_key': 'tactic.ui.table.ForeignKeyElementWdg',
'button': 'tactic.ui.table.ButtonElementWdg',
'expression': 'tactic.ui.table.ExpressionElementWdg'
}
web = WebContainer.get_web()
config_string = web.get_form_value("config_xml")
if not config_string:
config_string = '<config/>'
xml = Xml()
xml.read_string(config_string)
#print "config_string: ", config_string
# get values from the config file
element_name = xml.get_value('element/@name')
config = WidgetConfig.get(view='element',xml='<config><element>%s</element></config>' % config_string)
display_options = config.get_display_options(element_name)
title = xml.get_value('element/@title')
display_handler = xml.get_value('element/display/@class')
if not display_handler:
display_handler = 'tactic.ui.panel.TypeTableElementWdg'
widget_name = xml.get_value('element/display/@widget')
if not widget_name:
widget_name = 'custom'
custom_table = Table()
custom_table.add_style("color: black")
top_wdg.add(custom_table)
name_text = DivWdg()
name_text.add_style("color: black")
name_text.add(element_name)
custom_table.add_row()
custom_table.add_cell("Name: ")
custom_table.add_cell(name_text)
# add title
custom_table.add_row()
title_wdg = TextWdg("custom_title")
title_wdg.set_value(title)
title_wdg.add_attr("size", "50")
custom_table.add_cell( "Title: " )
custom_table.add_cell( title_wdg )
# add description
#custom_table.add_row()
#description_wdg = TextAreaWdg("custom_description")
#td = custom_table.add_cell( "Description: " )
#td.add_style("vertical-align: top")
#custom_table.add_cell( description_wdg )
type_select = SelectWdg("custom_type")
#type_select.add_empty_option("-- Select --")
type_select.set_option("values", "string|integer|float|boolean|currency|date|foreign_key|link|list|button|custom")
type_select.set_option("labels", "String(db)|Integer(db)|Float(db)|Boolean(db)|Currency(db)|Date(db)|Foreign Key|Link|List|Button|Custom")
type_select.set_value(widget_name)
#type_select.set_option("values", "string|integer|float|boolean|currency|date|link|list|foreign_key|button|empty")
#type_select.set_option("labels", "String|Integer|Float|Boolean|Currency|Date|Link|List|Foreign Key|Button|Empty")
custom_table.add_row()
td = custom_table.add_cell("Widget Type: ")
td.add_style("vertical-align: top")
td = custom_table.add_cell(type_select)
type_select.add_event("onchange", "spt.CustomProject.property_type_select_cbk(this)")
td.add(HtmlElement.br())
display_handler_text = TextWdg("display_handler")
display_handler_text.add_attr("size", "50")
#.........这里部分代码省略.........
示例6: handle_dir_or_item
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
#.........这里部分代码省略.........
input_cls = 'spt_context'
else:
if my.subcontext_options in [['(main)'], ['(auto)'] , []]:
is_select = False
#subcontext = TextWdg("subcontext")
subcontext = HiddenWdg("subcontext")
subcontext.add_class("spt_subcontext")
elif my.subcontext_options == ['(text)']:
is_select = False
subcontext = TextWdg("subcontext")
subcontext.add_class("spt_subcontext")
else:
is_select = True
subcontext = SelectWdg("subcontext")
subcontext.set_option("show_missing", False)
subcontext.set_option("values", my.subcontext_options)
#subcontext.add_empty_option("----")
cat_input = subcontext
input_cls = 'spt_subcontext'
if my.subcontext_options == ['(main)'] or my.subcontext_options == ['(auto)']:
subcontext_val = my.subcontext_options[0]
subcontext.set_value(subcontext_val)
item_div.add_attr("spt_subcontext", subcontext_val)
elif context:
parts = context.split("/")
if len(parts) > 1:
# get the actual subcontext value
subcontext_val = "/".join(parts[1:])
# identify a previous "auto" check-in and preselect the item in the select
if is_select and subcontext_val not in my.subcontext_options:
subcontext_val = '(auto)'
elif isinstance(cat_input, HiddenWdg):
subcontext_val = ''
# the Text field will adopt the subcontext value of the last check-in
subcontext.set_value(subcontext_val)
item_div.add_attr("spt_subcontext", subcontext_val)
else:
if is_select:
if my.subcontext_options:
subcontext_val = my.subcontext_options[0]
#subcontext_val = '(auto)'
cat_input.set_value(subcontext_val)
else:
subcontext_val = ''
item_div.add_attr("spt_subcontext", subcontext_val)
item_div.add(cat_input)
cat_input.add_behavior( {
'type': 'click_up',
示例7: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [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()
#.........这里部分代码省略.........
示例8: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
#.........这里部分代码省略.........
process_ypos = process.get_attribute('ypos')
task_pipeline_code = process.get_task_pipeline()
if task_pipeline_code != "task":
task_pipeline = Search.get_by_code("sthpw/pipeline", task_pipeline_code)
else:
task_pipeline = None
else:
task_pipeline_code = "task"
task_pipeline = None
process_div = DivWdg()
process_div.add_style("float: left")
process_div.add_class("spt_process_top")
if i == 0:
dyn_list.add_template(process_div)
else:
dyn_list.add_item(process_div)
#process_div.add_style("padding-left: 10px")
#process_div.add_style("margin: 5px")
table = Table()
process_div.add(table)
table.add_row()
text = TextInputWdg(name="process")
process_cell = table.add_cell(text)
text.add_style("width: 95px")
text.add_style("margin: 5px")
text.set_value(process_name)
text.add_class("spt_process")
# the template has a border
if i == 0:
text.add_style("border: solid 1px #AAA")
hidden = HiddenWdg(name='process_type')
hidden.set_value(process_type)
process_cell.add(hidden)
hidden = HiddenWdg(name='process_xpos')
hidden.set_value(process_xpos)
process_cell.add(hidden)
hidden = HiddenWdg(name='process_ypos')
hidden.set_value(process_ypos)
process_cell.add(hidden)
text = TextInputWdg(name="description")
table.add_cell(text)
text.add_style("width: 175px")
text.add_style("margin: 5px")
text.set_value(description)
# the template has a border
if i == 0:
text.add_style("border: solid 1px #AAA")
if process_type in ['manual','approval']:
read_only = False
else:
示例9: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
def get_display(self):
current = self.get_current_sobject()
if current.is_insert():
widget = Widget()
parent_key = self.get_option('parent_key')
if parent_key:
parent = SearchKey.get_by_search_key(parent_key)
if parent:
widget.add(SpanWdg(parent.get_code()))
else:
# use the project as the parent
parent = Project.get()
widget.add(SpanWdg("Project: %s" % parent.get_code()))
#raise TacticException('Task creation aborted since parent is undetermined. Please check the configuration that generates this table.')
text = HiddenWdg(self.get_input_name())
text.set_option('size','40')
text.set_value(parent_key)
widget.add(text)
return widget
else:
search_type = current.get_value('search_type')
if not search_type:
return "No parent type"
widget = Widget()
parent = current.get_parent()
if parent:
widget.add(parent.get_code())
return widget
# What is this look up code for?
text = TextWdg(self.get_input_name())
behavior = {
'type': 'keyboard',
'kbd_handler_name': 'DgTableMultiLineTextEdit'
}
text.add_behavior(behavior)
widget.add(text)
icon = IconButtonWdg("Look up", IconWdg.ZOOM)
icon.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var options = {
title: '%s',
class_name: 'tactic.ui.panel.ViewPanelWdg'
};
var args = {
search_type: '%s',
view: 'list'
};
spt.popup.get_widget( {}, {options: options, args: args} );
''' % (search_type, search_type)
} )
widget.add(icon)
return widget
示例10: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
def get_display(my):
top = my.top
top.add_color("background", "background")
top.add_class("spt_columns_top")
my.set_as_panel(top)
top.add_style("padding: 10px")
search_type = my.kwargs.get("search_type")
search_type_obj = SearchType.get(search_type)
inner = DivWdg()
top.add(inner)
inner.add_style("width: 500px")
#text = TextWdg("search_type")
text = HiddenWdg("search_type")
inner.add(text)
text.set_value(search_type)
title_wdg = DivWdg()
inner.add(title_wdg)
title_wdg.add( search_type_obj.get_title() )
title_wdg.add(" <i style='font-size: 9px;opacity: 0.5'>(%s)</i>" % search_type)
title_wdg.add_style("padding: 5px")
title_wdg.add_color("background", "background3")
title_wdg.add_color("color", "color3")
title_wdg.add_style("margin: -10px -10px 10px -10px")
title_wdg.add_style("font-weight: bold")
shelf_wdg = DivWdg()
inner.add(shelf_wdg)
shelf_wdg.add_style("height: 30px")
button = ActionButtonWdg(title='Create', icon=IconWdg.SAVE)
shelf_wdg.add(button)
shelf_wdg.add_style("float: right")
button.add_behavior( {
'type': 'click_up',
'search_type': search_type,
'cbjs_action': '''
var class_name = 'tactic.ui.startup.ColumnEditCbk';
var top = bvr.src_el.getParent(".spt_columns_top");
var elements = top.getElements(".spt_columns_element");
var values = [];
for (var i = 0; i < elements.length; i++ ) {
var data = spt.api.Utility.get_input_values(elements[i], null, false);
values.push(data)
}
var kwargs = {
search_type: bvr.search_type,
values: values
}
var server = TacticServerStub.get();
try {
server.execute_cmd(class_name, kwargs);
var names = [];
for (var i = 0; i < values.length; i++) {
var name = values[i].name;
name = name.strip();
if (name == '') { continue; }
names.push(name);
}
spt.table.add_columns(names)
// prevent grabbing all values, pass in a dummy one
spt.panel.refresh(top, {'refresh': true});
} catch(e) {
spt.alert(spt.exception.handler(e));
}
'''
} )
# add the headers
table = Table()
inner.add(table)
table.add_style("width: 100%")
tr = table.add_row()
tr.add_gradient("background", "background3")
tr.add_style("padding", "3px")
th = table.add_header("Column Name")
th.add_style("width: 170px")
th.add_style("text-align: left")
#.........这里部分代码省略.........
示例11: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
def get_display(my):
widget = Widget()
my.search_type = my.options.get("search_type")
if not my.search_type:
my.search_type = my.kwargs.get("search_type")
assert my.search_type
my.load_options_class = my.kwargs.get('load_options_class')
state = Container.get("global_state")
if state:
my.process = state.get("process")
else:
my.process = None
# the filter for searching assets
div = DivWdg(css='filter_box')
div.add_color("background", "background2", -35)
from app_init_wdg import PyMayaInit, PyXSIInit, PyHoudiniInit
if WebContainer.get_web().get_selected_app() == 'Maya':
app = PyMayaInit()
elif WebContainer.get_web().get_selected_app() == 'XSI':
app = PyXSIInit()
elif WebContainer.get_web().get_selected_app() == 'Houdini':
app = PyHoudiniInit()
div.add(app)
# add the possibility of a custom callback
callback = my.options.get('callback')
if callback:
hidden = HiddenWdg("callback", callback)
div.add(hidden)
# or add the possiblity of a switch mode
pipeline_type = "load"
hidden = HiddenWdg("pipeline_type", pipeline_type)
if my.process:
process_div = DivWdg()
process_div.add_style("margin: 10px")
process_div.add("PROCESS: %s" % my.process)
process_div.add_style("font-size: 20px")
widget.add(process_div)
hidden_wdg = HiddenWdg("process_select_%s" %my.search_type)
hidden_wdg.set_value(my.process)
widget.add(hidden_wdg)
else:
search_type = my.search_type
if search_type =='prod/shot_instance':
search_type = 'prod/shot'
process_filter = ProcessFilterWdg(my.get_context_data(search_type), search_type)
span = SpanWdg(process_filter, css='med')
div.add(span)
widget.add(div)
# load options for diff search type
if my.load_options_class:
load_options = Common.create_from_class_path(my.load_options_class)
elif my.search_type=='prod/asset':
load_options = LoadOptionsWdg()
elif my.search_type == 'prod/shot':
load_options = ShotLoadOptionsWdg()
elif my.search_type == 'prod/shot_instance':
load_options = AnimLoadOptionsWdg()
else:
load_options = LoadOptionsWdg()
load_options.set_prefix(my.search_type)
widget.add(load_options)
return widget
示例12: get_upload_wdg
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
def get_upload_wdg(my):
'''get search type select and upload wdg'''
key = 'csv_import'
widget = DivWdg(css='spt_import_csv')
widget.add_color('color','color')
widget.add_color('background','background')
widget.add_style('width: 600px')
# get the search type
stype_div = DivWdg()
widget.add(stype_div)
# DEPRECATED
# handle new search_types
"""
new_search_type = CheckboxWdg("new_search_type_checkbox")
new_search_type.add_event("onclick", "toggle_display('new_search_type_div')")
new_search_type_div = DivWdg()
new_search_type_div.set_id("new_search_type_div")
name_input = TextWdg("asset_name")
title = TextWdg("asset_title")
description = TextAreaWdg("asset_description")
table = Table()
table.set_id('csv_main_body')
table.add_style("margin: 10px 10px")
table.add_col().set_attr('width','140')
table.add_col().set_attr('width','400')
table.add_row()
table.add_header("Search Type: ").set_attr('align','left')
table.add_cell(name_input)
table.add_row()
table.add_header("Title: ").set_attr('align','left')
table.add_cell(title)
table.add_row()
table.add_header("Description: ").set_attr('align','left')
table.add_cell(description)
new_search_type_div.add(table)
new_search_type_div.add_style("display: none")
#widget.add(new_search_type_div)
"""
show_stype_select = my.kwargs.get("show_stype_select")
if show_stype_select in ['true',True] or not my.search_type:
title = DivWdg("<b>Select sType to import data into:</b> ")
stype_div.add( title )
title.add_style("float: left")
search_type_select = SearchTypeSelectWdg("search_type_filter", mode=SearchTypeSelectWdg.ALL)
search_type_select.add_empty_option("-- Select --")
if not search_type_select.get_value():
search_type_select.set_value(my.search_type)
search_type_select.set_persist_on_submit()
stype_div.add(search_type_select)
search_type_select.add_behavior( {'type': 'change', \
'cbjs_action': "spt.panel.load('csv_import_main','%s', {}, {\
'search_type_filter': bvr.src_el.value});" %(Common.get_full_class_name(my)) } )
else:
hidden = HiddenWdg("search_type_filter")
stype_div.add(hidden)
hidden.set_value(my.search_type)
if my.search_type:
sobj = None
try:
sobj = SObjectFactory.create(my.search_type)
except ImportError:
widget.add(HtmlElement.br())
widget.add(SpanWdg('WARNING: Import Error encountered. Please choose another search type.', css='warning'))
return widget
required_columns = sobj.get_required_columns()
if required_columns:
widget.add(HtmlElement.br())
req_span = SpanWdg("Required Columns: ", css='med')
req_span.add_color('color','color')
widget.add(req_span)
#required_columns = ['n/a']
req_span.add(', '.join(required_columns))
widget.add( HtmlElement.br() )
if my.file_path:
#.........这里部分代码省略.........
示例13: get_data_wdg
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import set_value [as 别名]
#.........这里部分代码省略.........
category_div = DivWdg()
name_div.add(category_div)
checkbox = RadioWdg("category")
checkbox.set_option("value", "by_year")
category_div.add(checkbox)
category_div.add(" Categorize files by Year")
category_div.add_style("margin-bottom: 5px")
"""
checkbox = RadioWdg("category")
checkbox.set_option("value", "custom")
name_div.add(checkbox)
name_div.add(" Custom")
"""
name_div.add("<br/>")
ingest_data_view = my.kwargs.get('ingest_data_view')
from tactic.ui.panel import EditWdg
sobject = SearchType.create(my.search_type)
edit = EditWdg(search_key =sobject.get_search_key(), mode='view', view=ingest_data_view )
dialog_data_div.add(edit)
hidden = HiddenWdg(name="parent_key")
dialog_data_div.add(hidden)
hidden.add_class("spt_parent_key")
parent_key = my.kwargs.get("parent_key") or ""
if parent_key:
hidden.set_value(parent_key)
extra_data = my.kwargs.get("extra_data")
if not isinstance(extra_data, basestring):
extra_data = jsondumps(extra_data)
if extra_data and extra_data != "null":
# it needs a TextArea instead of Hidden because of JSON data
text = TextAreaWdg(name="extra_data")
text.add_style('display: none')
text.set_value(extra_data)
dialog_data_div.add(text)
"""
dialog_data_div.add("Keywords:<br/>")
dialog.add(dialog_data_div)
text = TextAreaWdg(name="keywords")
dialog_data_div.add(text)
text.add_class("spt_keywords")
text.add_style("padding: 1px")
dialog_data_div.add("<br/>"*2)
text.add_class("spt_extra_data")
text.add_style("padding: 1px")
"""