本文整理汇总了Python中pyasm.web.HtmlElement.b方法的典型用法代码示例。如果您正苦于以下问题:Python HtmlElement.b方法的具体用法?Python HtmlElement.b怎么用?Python HtmlElement.b使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.HtmlElement
的用法示例。
在下文中一共展示了HtmlElement.b方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_error_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_error_wdg(my):
div = DivWdg()
error_div = DivWdg()
error_div.add("Error %s" % my.status)
div.add(error_div)
error_div.add_style("font-size: 18px")
error_div.add_style("font-weight: bold")
error_div.add_style("padding: 10px")
error_div.add_style("width: auto")
error_div.add_gradient("background", "background")
error_div.add_border()
error_div.add_style("margin-left: 5px")
error_div.add_style("margin-right: 5px")
error_div.add_style("margin-top: -10px")
div.add("<br/>")
span = DivWdg()
#span.add_color("color", "color")
span.add_style("color", "#FFF")
if my.status == 404:
span.add(HtmlElement.b("You have tried to access a url that is not recognized."))
else:
span.add(HtmlElement.b(my.message))
span.add(HtmlElement.br(2))
web = WebContainer.get_web()
root = web.get_site_root()
if my.message.startswith('No project ['):
label = 'You may need to correct the default_project setting in the TACTIC config.'
else:
label = "Go to the Main page for a list of valid projects"
span.add(label)
div.add(span)
div.add(HtmlElement.br())
from tactic.ui.widget import ActionButtonWdg
button_div = DivWdg()
button_div.add_style("width: 90px")
button_div.add_style("margin: 0px auto")
div.add(button_div)
button = ActionButtonWdg(title="Go to Main", tip='Click to go to main page')
button_div.add(button)
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
document.location = '/';
'''
} )
button.add_event("onmouseup", "document.location='/'")
return div
示例2: init
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def init(my):
assert my.task
super(TaskExtraInfoWdg, my).init()
# create the visible element
icon = IconWdg('Time Card', icon=IconWdg.TIME)
my.add(icon)
my.add(HtmlElement.b(my.task.get_process()))
my.time_card = TimecardWdg()
my.time_card.set_task(my.task)
from pyasm.security import Login
# create the content
content = DivWdg()
content.add_style('width','46em')
# customize the extra info widget
my.set_class('timecard_main')
my.set_content(content)
my.set_mouseout_flag(False)
my.login = Login.get_by_login(my.task.get_assigned())
title = FloatDivWdg()
login_name = 'unassigned'
my.is_other = False
if my.login:
login_name = my.login.get_full_name()
if my.login.get_login() == Environment.get_login().get_login():
icon = IconWdg(icon=IconWdg.REFRESH)
icon.add_class('hand')
icon.add_event('onclick', my.time_card.get_refresh_script())
title.add(icon)
else:
my.is_other = True
title.add("Time card - %s" % login_name)
content.add(title)
content.add(CloseWdg(my.get_off_script()))
content.add(HtmlElement.br(2))
content.add(my.time_card, 'time')
if not my.login:
div = DivWdg(HtmlElement.b('Time card cannot be entered for unassigned task.'))
content.set_widget(div, 'time')
my.height = 60
elif my.is_other:
div = DivWdg(HtmlElement.b('Time card cannot be entered for other users [%s].'\
%login_name))
content.set_widget(div, 'time')
my.height = 60
示例3: get_file_type_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_file_type_wdg(my):
'''drop down which selects which file type to export to'''
# add a filter
div = DivWdg()
filter_div = FloatDivWdg(HtmlElement.b("File Type:"), width="15em")
div.add(filter_div)
select = SelectWdg()
select.set_name("file_type")
select.set_id("file_type")
app = WebContainer.get_web().get_selected_app()
if app == 'Maya':
select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")
elif app == 'Houdini':
select.set_option("values", "otl")
select.set_option("labels", "Houdini Digital Asset(.otl)")
elif app == 'XSI':
select.set_option("values", "emdl|dotXSI|obj")
select.set_option("labels", "3D Model (.emdl)|SoftImage dotXSI (.xsi)|Wavefront .obj")
else:
select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")
select.add_style("font-size: 0.8em")
select.add_style("margin-top: 5px")
select.add_style("margin-right: 10px")
select.set_persistence()
div.add(select)
return div
示例4: add_unassigned_instances
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
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)
示例5: _handle_refs
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def _handle_refs(self, snapshot, widget, upstream, recursive=True):
xml = snapshot.get_xml_value("snapshot")
# go through the references
if upstream:
nodes = xml.get_nodes("snapshot/ref")
if nodes:
widget.add(HtmlElement.b('Upstream ref.'))
block = DivWdg()
block.add_style("margin-left: 30px")
block.add_style("margin-top: 10px")
for node in nodes:
self._handle_ref_node(node, block, upstream, recursive)
block.add(HtmlElement.br())
widget.add(block)
# go through the input references
nodes = xml.get_nodes("snapshot/input_ref")
if nodes:
widget.add(HtmlElement.br())
widget.add(HtmlElement.b("Input ref."))
block = DivWdg()
block.add_style("margin-left: 30px")
block.add_style("margin-top: 10px")
for node in nodes:
self._handle_ref_node(node, block, upstream, recursive)
widget.add(block)
else:
# go through the forward references
nodes = xml.get_nodes("snapshot/fref")
if nodes:
widget.add(HtmlElement.b("Downstream ref."))
block = DivWdg()
block.add_style("margin-left: 30px")
block.add_style("margin-top: 10px")
for node in nodes:
self._handle_ref_node(node, block, upstream, recursive)
widget.add(block)
示例6: get_prefs
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_prefs(my):
select = FilterSelectWdg(my.RENDER_CAM)
search = Search(FlashLayer.SEARCH_TYPE)
search.add_where("name ~* '.*camera.*'")
select.set_search_for_options(search, "get_search_key()", "name")
select.add_empty_option()
select.get_value()
cam_span = SpanWdg(HtmlElement.b("Camera: "), css="med")
cam_span.add(select)
format_select = FilterSelectWdg(my.CONTEXT_NAME)
format_select.set_option("labels", "frame sequence|swf")
format_select.set_option("values", "FlashFinalSequenceRenderContext|FlashSwfRenderContext")
format_select.get_value()
format_span = SpanWdg(HtmlElement.b("Context: "), css="med")
format_span.add(format_select)
div = DivWdg()
div.add(cam_span)
div.add(HtmlElement.br())
div.add(format_span)
return div
示例7: get_simple_definition_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_simple_definition_wdg(self):
detail_wdg = DivWdg()
detail_wdg.add_color("color", "color")
detail_wdg.add_style("width: 350px")
detail_wdg.add_style("margin-top: 10px")
detail_wdg.add_style("padding: 10px")
detail_wdg.add_border()
title = DivWdg()
title.add_style("margin-top: -23px")
detail_wdg.add(title)
if not self.name_string:
title.add('No database column')
return detail_wdg
title.add("Column Definition")
# add a name entry
detail_wdg.add("<br/>")
title = SpanWdg()
detail_wdg.add("Name: ")
detail_wdg.add(title)
input = SpanWdg()
input.add_style('padding-top: 6px')
input.set_id("config_element_name")
input.add(HtmlElement.b(self.name_string))
detail_wdg.add(input)
hidden = HiddenWdg('column_name', self.name_string)
detail_wdg.add(hidden)
hidden = HiddenWdg('target_search_type', self.search_type)
detail_wdg.add(hidden)
detail_wdg.add(HtmlElement.br(2))
# add data_type entry
data_type = SpanWdg()
default_data_types = ['varchar(256)','varchar', 'character', 'text', 'integer', 'float', 'boolean', 'timestamp', 'Other...']
select = SelectWdg('config_data_type', label ='Data Type: ')
#detail_wdg.add(": ")
select.set_option('values', default_data_types )
select.set_value(self.data_type_string)
select.add_behavior({'type': 'change',
'cbjs_action': "if (bvr.src_el.value=='Other...') {spt.show('config_data_type_custom');}\
else {spt.hide('config_data_type_custom');}"})
data_type.add(select)
text = TextWdg('config_data_type_custom')
span = SpanWdg("Other: ", css='med')
span.add(text)
span.set_id('config_data_type_custom')
span.add_style('display','none')
text.set_value(self.data_type_string)
data_type.add("<br/>")
data_type.add(span)
detail_wdg.add(data_type)
detail_wdg.add("<br/>")
# add a nullable entry
nullable = SpanWdg()
checkbox = CheckboxWdg('config_nullable', label ='Allow null(empty) value: ')
#detail_wdg.add(": ")
nullable.add(checkbox)
if self.nullable_string in ['True', 'true']:
checkbox.set_checked()
detail_wdg.add(nullable)
#constraint = DivWdg()
#detail_wdg.add(constraint)
#constraint.add_style("margin-top: 10px")
#constraint.add("Constraint: ")
#select = SelectWdg("config_constraint")
#constraint.add(select)
#select.set_option("values", "unique|indexed")
#select.add_empty_option("-- None --")
button_div = DivWdg()
button_div.add_style("text-align: center")
button_div.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.manage_search_type = {};
spt.manage_search_type.change_column_cbk = function(bvr) {
var class_name = 'tactic.ui.panel.AlterSearchTypeCbk';
var options ={
'alter_mode': bvr.alter_mode,
'title': bvr.title
#.........这里部分代码省略.........
示例8: get_first_row_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_first_row_wdg(my):
# read the csv file
#my.file_path = ""
div = DivWdg(id='csv_import_main')
div.add_class('spt_panel')
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('<br>')
div.add( "Uploaded file [%s] is not a csv file. Refreshing in 3 seconds. . ."% os.path.basename(my.file_path))
div.add_behavior( {'type': 'load', \
'cbjs_action': "setTimeout(function() {spt.panel.load('csv_import_main','%s', {}, {\
'search_type_filter': '%s'});}, 3000);" %(Common.get_full_class_name(my), my.search_type) } )
return div
if not os.path.exists(my.file_path):
raise TacticException("Path '%s' does not exist" % my.file_path)
div.add(HtmlElement.br(2))
# NOT NEEDED: clear the widget settings before drawing
#expr = "@SOBJECT(sthpw/wdg_settings['key','EQ','pyasm.widget.input_wdg.CheckboxWdg|column_enabled_']['login','$LOGIN']['project_code','$PROJECT'])"
#sobjs = Search.eval(expr)
#for sobj in sobjs:
# sobj.delete(log=False)
div.add( HtmlElement.b("The following is taken from the first line in the uploaded csv file. Select the appropriate column to match.") )
div.add(HtmlElement.br())
"""
text = HtmlElement.b("Make sure you have all the required columns** in the csv.")
text.add_style('text-align: left')
div.add(text)
"""
div.add(HtmlElement.br(2))
option_div_top = DivWdg()
option_div_top.add_color('color','color')
option_div_top.add_color('background','background', -5)
option_div_top.add_style("padding: 10px")
option_div_top.add_border()
option_div_top.add_style("width: 300px")
swap = SwapDisplayWdg(title="Parsing Options")
option_div_top.add(swap)
option_div_top.add_style("margin-right: 30px")
my.search_type_obj = SearchType.get(my.search_type)
option_div = DivWdg()
swap.set_content_id(option_div.set_unique_id() )
option_div.add_style("display: none")
option_div.add_style('margin-left: 14px')
option_div.add_style('margin-top: 10px')
option_div.add_style("font-weight: bold")
option_div_top.add(option_div)
# first row and second row
#option_div.add( HtmlElement.br() )
option_div.add(SpanWdg("Use Title Row: ", css='small'))
title_row_checkbox = CheckboxWdg("has_title")
title_row_checkbox.set_default_checked()
title_row_checkbox.add_behavior({'type' : 'click_up',
'propagate_evt': 'true',
'cbjs_action': "spt.panel.refresh('preview_data',\
spt.api.Utility.get_input_values('csv_import_main'))"})
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(SpanWdg("Use Lowercase Title: ", css='small'))
lower_title_checkbox = CheckboxWdg("lowercase_title")
lower_title_checkbox.add_behavior({'type' : 'click_up',
'propagate_evt': 'true',
'cbjs_action': "spt.panel.refresh('preview_data',\
spt.api.Utility.get_input_values('csv_import_main'))"})
option_div.add(lower_title_checkbox)
option_div.add( HtmlElement.br(2) )
option_div.add(SpanWdg("Sample Data Row: ", css='small'))
data_row_text = SelectWdg("data_row")
data_row_text.set_option('values', '1|2|3|4|5')
data_row_text.set_value('1')
data_row_text.add_behavior({'type' : 'change',
'cbjs_action': "spt.panel.refresh('preview_data',\
#.........这里部分代码省略.........
示例9: get_action_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_action_wdg(self):
main_div = DivWdg(css="filter_box center_content")
div = DivWdg()
main_div.add(self.get_view_select())
main_div.add(div)
div.add_style('height', '16px')
div.add_style('margin', '3px 0 3px 0')
search_type = self.get_search_type()
div.add(HtmlElement.b("Action: "))
add_button = IconButtonWdg(self.ADD_BUTTON, IconWdg.ADD, long=True)
behavior = {
'type': 'click_up',
'mouse_btn': 'LMB',
'cbfn_action': 'spt.sobject_planner.action',
'action': 'add',
'search_type': search_type
}
add_button.add_behavior(behavior)
retire_button = IconButtonWdg("Retire Instance",\
IconWdg.RETIRE, long=True)
behavior = {
'type': 'click_up',
'mouse_btn': 'LMB',
'cbfn_action': 'spt.sobject_planner.action',
'action': 'retire',
'search_type': search_type
}
retire_button.add_behavior(behavior)
delete_button = IconButtonWdg("Delete Instance",\
IconWdg.DELETE, long=True)
behavior = {
'type': 'click_up',
'mouse_btn': 'LMB',
'cbfn_action': 'spt.sobject_planner.action',
'action': 'delete',
'search_type': search_type
}
delete_button.add_behavior(behavior)
div.add(add_button)
div.add(retire_button)
div.add(delete_button)
'''
# add test popup
from tactic.ui.container import PopupWdg
from tactic.ui.panel import TableLayoutWdg
popup = PopupWdg(id="planner", allow_page_activity=True)
content = DivWdg()
#content.add_style("height: 500px")
#content.add_style("overflow: scroll")
search_type = self.get_search_type()
layout = TableLayoutWdg(search_type=search_type, view="planner_left")
search = Search(search_type)
layout.set_sobjects( search.get_sobjects() )
content.add(layout)
popup.add("Assets", "title")
popup.add(content, "content")
popup_button = IconButtonWdg("Popup",\
IconWdg.DELETE, long=True)
popup_button.add_event("onclick", "$('planner').setStyle('display','')")
main_div.add(popup)
main_div.add(popup_button)
'''
return main_div
示例10: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_display(my):
web = WebContainer.get_web()
database = Project.get_project_code()
if my.is_aux_title == 'true':
return HtmlElement.b("Add Property for %s [%s]" \
%(SearchType.get(my.search_type).get_title(), my.search_type))
if not my.view:
my.view = get_template_view()
# show current custom
div = DivWdg(id="add_property_wdg")
div.add_class("spt_panel")
div.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.custom_property_adder = {}
// Called when a type selection is made when creating a new property type
spt.custom_property_adder.property_type_select_cbk = function(el) {
var panel = el.getParent(".spt_panel");
var kwargs = { top_el: panel };
spt.simple_display_hide('.foreign_key_options', kwargs);
spt.simple_display_hide('.list_options', kwargs);
spt.simple_display_hide('.button_options', kwargs);
if (el.value == "foreign_key") {
spt.simple_display_show('.foreign_key_options', kwargs);
}
else if (el.value == "list") {
spt.simple_display_show('.list_options', kwargs);
}
else if (el.value == "button") {
spt.simple_display_show('.button_options', kwargs);
}
}
// called when the mode of "add property" is switched"
spt.custom_property_adder.switch_property_mode = function(evt, bvr) {
var src_el = bvr.src_el;
var value = src_el.value;
var panel = src_el.getParent(".spt_panel")
var element = panel.getElement(".spt_custom_simple")
spt.simple_display_hide(element);
//var element = panel.getElement(".spt_custom_widget")
//spt.simple_display_hide(element);
var element = panel.getElement(".spt_custom_xml")
spt.simple_display_hide(element);
var element = panel.getElement(".spt_custom_" + value)
spt.simple_display_show(element);
}
spt.custom_property_adder.add_property_cbk = function(evt, bvr) {
var search_type = bvr['search_type'];
var view = bvr['view'];
var exit = bvr['exit'];
var panel = bvr.src_el.getParent(".spt_panel");
var popup = bvr.src_el.getParent(".spt_popup");
var mode = panel.getElement(".spt_custom_mode").value;
var input_top = panel.getElement(".spt_custom_"+mode);
var values = spt.api.Utility.get_input_values(input_top);
// add the mode value
values['custom_mode'] = mode;
var class_name = "tactic.ui.app.CustomPropertyAdderCbk";
var options = {
'search_type': search_type,
'view': view
};
var server = TacticServerStub.get();
try {
server.start({title:"Add new property"});
var response = server.execute_cmd(class_name, options, values);
if (exit == "true") {
$('add_property_wdg').setStyle("display", "none");
// this may or may not exist
if (popup)
spt.popup.close(popup);
#.........这里部分代码省略.........
示例11: _handle_files
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def _handle_files(self, snapshot, widget, upstream, recursive=True):
web_dir = snapshot.get_web_dir()
xml = snapshot.get_xml_value("snapshot")
# handle files
files = xml.get_nodes("snapshot/file")
for file in files:
file_code = Xml.get_attribute(file, "file_code")
file_type = Xml.get_attribute(file, "type")
file_range = Xml.get_attribute(file, "file_range")
#file_range = "1-4/1"
dir = snapshot.get_client_lib_dir(file_type=file_type)
lib_dir = snapshot.get_lib_dir(file_type=file_type)
open_button = IconButtonWdg( "Explore: %s" % dir, IconWdg.LOAD, False)
if dir == lib_dir:
open_button.add_behavior({'type':'click_up', 'cbjs_action': '''var applet = spt.Applet.get();
spt.alert('You are not allowed to browse directories on a web server.');
'''})
else:
open_button.add_behavior({'type':'click_up',
'dir' : dir,
'cbjs_action': '''
var applet = spt.Applet.get();
var dir = bvr.dir;
applet.open_explorer(dir);'''})
open_button.add_class('small')
open_button.add_style('float: left')
widget.add(open_button)
if file_range:
file_name = Xml.get_attribute(file, "name")
widget.add("%s [code = %s, type = %s]" % (file_name, file_code, file_type))
widget.add(HtmlElement.br(2))
# display all of the paths
file_names = FileGroup.expand_paths( file_name, FileRange.get(file_range) )
for file_name in file_names:
#link = HtmlElement.href(file_name, "%s/%s" % (web_dir, file_name), target="_blank" )
link = SpanWdg(file_name)
link.add_color("color", "color")
widget.add(link)
widget.add(HtmlElement.br())
else:
thumb = DependencyThumbWdg()
thumb.set_show_filename(True)
thumb.set_sobject(snapshot)
thumb.set_icon_size(15)
thumb.set_image_link_order([file_type])
thumb.set_option('detail', 'false')
widget.add(SpanWdg(thumb, css='small'))
widget.add("[code = %s, type = %s]" % ( file_code, file_type))
widget.add(HtmlElement.br())
block = DivWdg()
block.add_style("margin-left: 30px")
block.add_style("margin-top: 10px")
nodes = xml.get_nodes("snapshot/file[@file_code='%s']/ref" % file_code)
widget.add(HtmlElement.br(clear="all"))
# handle sub refs
for node in nodes:
self._handle_ref_node(node, block, upstream, recursive)
block.add(HtmlElement.br())
if nodes:
widget.add(block)
widget.add(HtmlElement.br())
files = xml.get_nodes("snapshot/unknown_ref")
if files:
widget.add(HtmlElement.b("Unknown ref."))
for file in files:
block = DivWdg()
block.add_style("margin-left: 30px")
block.add_style("margin-top: 10px")
block.add( IconWdg( "Unknown", IconWdg.UNKNOWN) )
path = Xml.get_attribute(file, "path")
block.add(path)
widget.add(block)
示例12: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_display(my):
div = DivWdg()
div.add_class("spt_security")
div.add_attr("id", "SecurityManagerWdg")
div.add_attr("spt_class_name", Common.get_full_class_name(my) )
div.add_attr("spt_search_key", my.search_key)
div.add_attr("spt_update", "true")
project_div = DivWdg()
project_div.add_color("background", "background")
project_div.add_color("color", "color")
project_div.add_style("padding: 10px")
project_div.add_border()
project_div.add_style("width: 300px")
group = SearchKey.get_by_search_key(my.search_key)
title = DivWdg()
title.add_class("maq_search_bar")
name = group.get_value("login_group")
title.add("Global security settings for %s" % name)
project_div.add(title)
access_rules = group.get_xml_value("access_rules")
access_manager = AccessManager()
access_manager.add_xml_rules(access_rules)
access_level = group.get_access_level()
project_code = group.get_value('project_code')
if project_code:
project_codes = set(project_code)
else:
project_codes = set()
xml = LoginGroup.get_default_access_rule(access_level, project_codes)
access_manager.add_xml_rules(xml)
group = "builtin"
global_default_access = "deny"
list_div = DivWdg()
list_div.add_style("color: #222")
for item in permission_list:
if item.get('group'):
group_div = DivWdg()
list_div.add(group_div)
group_div.add_style("margin-top: 10px")
group_div.add_style("font-weight: bold")
group_div.add(item.get('group'))
group_div.add("<hr/>")
continue
item_div = DivWdg()
list_div.add(item_div)
item_div.add_style("margin-top: 5px")
key = item.get('key')
item_default = item.get('default')
if item_default:
default_access = item_default
else:
default_access = global_default_access
allowed = access_manager.check_access(group, key, "allow", default=default_access)
checkbox = CheckboxWdg("rule")
if allowed:
checkbox.set_checked()
checkbox.set_option("value", key)
item_div.add(checkbox)
item_div.add_style("color: #222")
item_div.add(item.get('title') )
project_div.add(list_div)
project_div.add("<hr>")
#close_script = "spt.popup.close(bvr.src_el.getParent('.spt_popup'))"
save_button = ActionButtonWdg(title="Save", tip="Save Security Settings")
save_button.add_behavior( {
"type": "click_up",
"cbjs_action": "el=bvr.src_el.getParent('.spt_security');spt.panel.refresh(el);" } )
save_button.add_style("margin-left: auto")
save_button.add_style("margin-right: auto")
project_div.add(save_button)
#.........这里部分代码省略.........
示例13: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_display(my):
search_key = my.kwargs.get("search_key")
msg = None
base_search_type = SearchKey.extract_search_type(search_key)
sobject = SearchKey.get_by_search_key(search_key)
process_div = DivWdg()
process_div.add_style('padding-top: 10px')
if base_search_type in ['sthpw/task', 'sthpw/note']:
my.process = sobject.get_value('process')
my.context = sobject.get_value('context')
if not my.process:
my.process = ''
parent = sobject.get_parent()
if parent:
search_key = SearchKey.get_by_sobject(parent)
else:
msg = "Parent for [%s] not found"%search_key
else:
my.process = my.kwargs.get('process')
top = my.top
top.add_class('spt_simple_checkin')
top.add_color("background", "background")
top.add_styles("position: relative")
content = DivWdg(msg)
top.add(content)
#content.add_border()
#content.add_color("background", "background3")
#content.add_color("color", "background3")
content.add_style("width: 600px")
content.add_styles("margin-left: auto; margin-right: auto;")
content.add_style("height: 200px")
from tactic.ui.widget import CheckinWdg
content.add_behavior( {
'type': 'load',
'cbjs_action': CheckinWdg.get_onload_js()
} )
button_div = DivWdg()
content.add(process_div)
content.add(button_div)
button = IconWdg(title="Check-In", icon=IconWdg.CHECK_IN_3D_LG)
title = Common.get_display_title(my.checkin_action)
button.add_attr('title', title)
button_div.add(button)
button_div.set_box_shadow("1px 1px 1px 1px")
button_div.add_style("width: 60px")
button_div.add_style("height: 60px")
button_div.add_style("float: left")
button_div.add_style("background: white")
button_div.add_class("hand")
button_div.add_style("padding: 2px 3px 0 0")
button_div.add_style("margin: 20px 60px 20px 200px")
button_div.add_style("text-align: center")
button_div.add("Check-in")
# to be consistent with Check-in New File
if my.process:
checkin_process = my.process
else:
# Dont' specify, the user can choose later in check-in widget
checkin_process = ''
button.add_behavior( {
'type': 'click_up',
'search_key': search_key,
'process': checkin_process,
'context': my.context,
'cbjs_action': '''
var class_name = 'tactic.ui.widget.CheckinWdg';
var applet = spt.Applet.get();
spt.app_busy.show("Choose file(s) to check in")
var current_dir = null;
var is_sandbox = false;
var refresh = false
var values = spt.checkin.browse_folder(current_dir, is_sandbox, refresh);
if (!values) {
spt.app_busy.hide();
return;
}
var file_paths = values.file_paths;
#.........这里部分代码省略.........
示例14: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [as 别名]
def get_display(my):
my.init_kwargs()
sobject = my.get_current_sobject()
table = Table(css='minimal')
table.add_color("color", "color")
table.add_style("font-size: 0.9em")
snapshots = my.get_snapshot(my.mode)
for snapshot in snapshots:
table.add_row()
value = my.get_input_value(sobject, snapshot)
current_version = snapshot.get_value("version")
current_context = snapshot.get_value("context")
current_revision = snapshot.get_value("revision", no_exception=True)
current_snapshot_type = snapshot.get_value("snapshot_type")
# hack hard coded type translation
if current_snapshot_type == "anim_export":
current_snapshot_type = "anim"
# ignore icon context completely
if current_context == "icon":
table.add_blank_cell()
table.add_cell("(---)")
return table
checkbox = CheckboxWdg('%s_%s' %(my.search_type, my.CB_NAME))
# this is added back in for now to work with 3.7 Fast table
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True})
checkbox.add_class('spt_latest_%s' %my.mode)
checkbox.set_option("value", value )
table.add_cell( checkbox )
load_all = False
if load_all:
checkbox.set_checked()
# add the file type icon
xml = snapshot.get_snapshot_xml()
file_name = xml.get_value("snapshot/file/@name")
icon_link = ThumbWdg.find_icon_link(file_name)
image = HtmlElement.img(icon_link)
image.add_style("width: 15px")
table.add_cell(image)
namespace = my.get_namespace(sobject, snapshot)
asset_code = my.get_asset_code()
# force asset mode = True
my.session.set_asset_mode(asset_mode=my.get_session_asset_mode())
node_name = my.get_node_name(snapshot, asset_code, namespace)
# get session info
session_context = session_version = session_revision = None
if my.session:
session_context = my.session.get_context(node_name, asset_code, current_snapshot_type)
session_version = my.session.get_version(node_name, asset_code, current_snapshot_type)
session_revision = my.session.get_revision(node_name, asset_code,current_snapshot_type)
# Maya Specific: try with namespace in front of it for referencing
referenced_name = '%s:%s' %(namespace, node_name)
if not session_context or not session_version:
session_context = my.session.get_context(referenced_name, asset_code, current_snapshot_type)
session_version = my.session.get_version(referenced_name, asset_code, current_snapshot_type)
session_revision = my.session.get_revision(referenced_name, asset_code, current_snapshot_type)
from version_wdg import CurrentVersionContextWdg, SubRefWdg
version_wdg = CurrentVersionContextWdg()
data = {'session_version': session_version, \
'session_context': session_context, \
'session_revision': session_revision, \
'current_context': current_context, \
'current_version': current_version, \
'current_revision': current_revision }
version_wdg.set_options(data)
table.add_cell(version_wdg, "no_wrap")
td = table.add_cell(HtmlElement.b("(%s)" %current_context))
td.add_tip("Snapshot code: %s" % snapshot.get_code())
#table.add_cell(snapshot.get_code() )
#if snapshot.is_current():
# current = IconWdg("current", IconWdg.CURRENT)
# table.add_cell(current)
#else:
# table.add_blank_cell()
# handle subreferences
#.........这里部分代码省略.........
示例15: get_first_row_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import b [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()
#.........这里部分代码省略.........