本文整理汇总了Python中pyasm.web.DivWdg类的典型用法代码示例。如果您正苦于以下问题:Python DivWdg类的具体用法?Python DivWdg怎么用?Python DivWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DivWdg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
def get_display(self):
top = self.top
top.add_color("background", "background")
top.add_border()
top.add_style("padding: 10px")
top.add_style("font-size: 12px")
from tactic.ui.container import WizardWdg
title = DivWdg()
title.add("Share Project")
wizard = WizardWdg(title=title, submit_title="Save", command="tactic.ui.sync.SyncServerAddCbk")
top.add(wizard)
#wizard.add(self.get_local_wdg(), "Local")
wizard.add(self.get_info_wdg(), "Info")
wizard.add(self.get_sync_mode_wdg(), "Mode")
#wizard.add(self.get_export_wdg(), "Export")
#wizard.add(self.get_security_wdg(), "Security")
return top
示例2: generate_div
def generate_div(self):
''' this is meant to be called to get the container div for the
ajax widget '''
div = DivWdg()
div.set_id(self.display_id)
div.add_style("display: block")
return div
示例3: get_display
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
示例4: get_display
def get_display(self):
sobject = self.get_current_sobject()
sobject_id = sobject.get_id()
result = self.data.get(sobject_id)
top = DivWdg()
if not result:
return top
expression = self.get_option("expression")
if expression:
value = Search.eval(expression, result)
else:
column = self.get_option("column")
if not column:
column = self.get_name()
try:
value = result.get_value(column)
except:
value = ""
top.add(value)
return top
示例5: get_info_wdg
def get_info_wdg(self):
div = DivWdg()
div.add_class("spt_info")
return div
示例6: get_example_display
def get_example_display(self):
div = DivWdg()
# --- Example of using _handoff_ property in behavior -----------------------------------------------------
table = Table()
table.add_row()
td = table.add_cell()
td.set_style( "background: #0f0f0f; color: #9f9f9f; border: 1px solid black; padding: 4px;" )
td_id = 'HandOffSource'
td.set_id(td_id)
td.add( "Element '%s' with '_handoff_' property in bvr spec" % td_id )
td.add_behavior( {
'_handoff_': '$(@.parentNode).getElement("#HandOffTarget")',
'type': 'click',
'cbfn_action': 'spt.ui_play.test_handoff',
'dst_el': '$(@.parentNode).getElement("#DestElForBvr");'
} )
td = table.add_cell()
td.set_style( "background: #2f2f2f; color: #9f9f9f; border: 1px solid black; padding: 4px; cursor: pointer;" )
td_id = 'HandOffTarget'
td.set_id(td_id)
td.add( "Element '%s' that receives the handed off behavior" % td_id );
td = table.add_cell()
td.set_style( "background: #4f4f4f; color: #9f9f9f; border: 1px solid black; padding: 4px;" )
td_id = 'DestElForBvr'
td.set_id(td_id)
td.add( "Element '%s' specified as dst_el for handed off behavior" % td_id );
div.add( table )
return div
示例7: get_display
def get_display(self):
sobject = self.get_current_sobject()
snapshots = []
if isinstance(sobject, Layer):
# for layer renders, we try to get all render sobjects
renders = Render.get_all_by_sobject(sobject)
if renders:
snapshots = Snapshot.get_by_sobjects(renders, is_current=True)
else: # for object that has direct snapshots like plates
snapshot = Snapshot.get_current_by_sobject(sobject)
if snapshot:
snapshots.append(snapshot)
if not snapshots:
return "<i>- no files -</i>"
div = DivWdg()
for snapshot in snapshots:
file_types = snapshot.get_all_file_types()
table = Table(css='embed')
for file_type in file_types:
table.add_row()
table.add_cell( self.get_open_wdg(snapshot, file_type) )
dir = snapshot.get_client_lib_dir(file_type=file_type)
table.add_cell( "%s: <i>%s</i>" % (file_type, dir) )
div.add(table)
return div
示例8: get_display
def get_display(my):
sobject = None
if 'order_code' in my.kwargs.keys():
my.order_code = my.kwargs.get('order_code')
else:
sobject = my.get_current_sobject()
my.order_code = sobject.get_code()
sobject = my.server.eval("@SOBJECT(twog/order['code','%s'])" % my.order_code)[0]
my.order_name = sobject.get('name')
widget = DivWdg()
table = Table()
table.add_attr('width', '50px')
login = Environment.get_login()
user_name = login.get_login()
table.add_row()
cell1 = table.add_cell('<b><u>Calculate Costs</u></b>')
cell1.add_attr('order_code', my.order_code)
cell1.add_attr('user', user_name)
cell1.add_attr('order_name', my.order_name)
cell1.add_attr('nowrap','nowrap')
launch_behavior = my.get_launch_behavior()
cell1.add_style('cursor: pointer;')
cell1.add_behavior(launch_behavior)
widget.add(table)
return widget
示例9: get_group_bottom_wdg
def get_group_bottom_wdg(my, sobjects):
expression = my.get_option("group_bottom")
if not expression:
return None
# parse the expression
my.vars = my.get_vars()
parser = ExpressionParser()
result = parser.eval(expression, sobjects=sobjects, vars=my.vars)
format_str = my.kwargs.get("display_format")
if format_str:
from tactic.ui.widget import FormatValueWdg
format_wdg = FormatValueWdg(format=format_str, value=result)
result = format_wdg
else:
result = str(result)
div = DivWdg()
div.add(result)
div.add_style("text-align: right")
# div.add_class( "spt_%s_expr_bottom" % (my.get_name()) )
# add a listener
# for sobject in sobjects:
# if sobject.is_insert():
# continue
#
# if my.enable_eval_listener:
# my.add_js_expression(div, sobject, expression)
return div
示例10: get_display
def get_display(self):
widget = DivWdg()
# get the current project
project_code = Project.get_project_name()
user = Environment.get_user_name()
pipeline = Pipeline.get_by_code("task")
process_names = pipeline.get_process_names()
widget.add("Tasks Assigned: ")
for status in process_names:
search = Search("sthpw/task")
#search.add_filter("project_code", project_code)
search.add_filter("assigned", user)
search.add_filter("status", status)
#search.add_where("now() - timestamp < '1 day'")
count = search.get_count()
if not count:
continue
widget.add("%s (%s) " % (status,count))
return widget
示例11: get_display
def get_display(my):
sobject = my.get_current_sobject()
sk = sobject.get_search_key()
widget = DivWdg()
sts_to_perm = {'twog/qc_report_vars': 'compression|qc supervisor|edeliveries'}
if '-1' not in sk:
table = Table()
table.add_attr('width', '50px')
login = Environment.get_login()
user_name = login.get_login()
groups = Environment.get_group_names()
st = sk.split('?')[0];
perms = sts_to_perm[st]
allow = False
for g in groups:
if g in perms:
allow = True
if user_name == 'admin':
allow = True
if allow:
table.add_row()
cell1 = table.add_cell(my.x_butt)
cell1.add_attr('id','sp_del_%s' % sk)
launch_behavior = my.get_delete_behavior(sk)
cell1.add_style('cursor: pointer;')
cell1.add_behavior(launch_behavior)
widget.add(table)
return widget
示例12: get_display
def get_display(my):
top = my.top
unity_wdg = DivWdg()
top.add(unity_wdg)
unique_id = unity_wdg.set_unique_id("unity")
unity_wdg.add("Unity content can't be played. Make sure you are using compatible browser with JavaScript enabled.")
#<input id="versionButton" type="button" value="Version" disabled="disabled" onclick="versionButtonClick();" />
# TEST TEST TEST: dynamic loading of js
env = Environment.get()
install_dir = env.get_install_dir()
js_path = "%s/src/context/spt_js/UnityObject.js" % install_dir
f = open(js_path)
init_js = f.read()
f.close()
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
%s;
%s;
''' % (init_js, my.get_load_js(unique_id) )
} )
return top
示例13: get_div_for_department_instructions
def get_div_for_department_instructions(self, department_instructions_sobject):
department_instructions_div = DivWdg()
department_instructions_div.add(HtmlElement.h4(department_instructions_sobject.get('name')))
department_instructions_div.add(HtmlElement.p(department_instructions_sobject.get('instructions_text')))
return department_instructions_div
示例14: get_instantiation_wdg
def get_instantiation_wdg(self):
setting = self.get_default_setting()
default_instantiation = setting.get('instantiation')
div = DivWdg()
is_unchecked = True
default_cb = None
for value in self.get_instantiation_options():
name = self.get_element_name("instantiation")
checkbox = CheckboxWdg( name )
if value == default_instantiation:
default_cb = checkbox
checkbox.set_option("value", value)
checkbox.set_persistence()
if checkbox.is_checked():
is_unchecked = False
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True,
"cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name})
span = SpanWdg(checkbox, css='small')
span.add(value)
div.add(span)
if is_unchecked:
default_cb.set_checked()
return div
示例15: get_art_reference
def get_art_reference(self):
widget = Widget()
help = HelpItemWdg('References', 'References tab lets the user organize art references. Each reference can be [related] to one or more assets defined in TACTIC. It can be set up when you [Edit] the reference.')
self.add(help)
div = DivWdg(css="filter_box")
widget.add(div)
columns = ['description','keywords']
search_filter = SearchFilterWdg("art_ref_search", columns=columns,\
has_persistence=False)
div.add(search_filter)
select = FilterSelectWdg("art_ref_category", label='Category: ', css='snall')
select.set_option("setting", "art_reference_category")
select.add_empty_option('-- Any --')
div.add( select )
table = TableWdg("prod/art_reference")
search = Search("prod/art_reference")
search_filter.alter_search(search)
value = select.get_value()
if value != "":
search.add_filter("category", value)
table.set_search(search)
widget.add(table)
return widget