本文整理汇总了Python中pyasm.widget.CheckboxWdg.add_class方法的典型用法代码示例。如果您正苦于以下问题:Python CheckboxWdg.add_class方法的具体用法?Python CheckboxWdg.add_class怎么用?Python CheckboxWdg.add_class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.CheckboxWdg
的用法示例。
在下文中一共展示了CheckboxWdg.add_class方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_class [as 别名]
def get_display(my):
my.sobject = my.kwargs.get("sobject")
search_key = my.sobject.get_search_key()
top = DivWdg()
top.add_class("spt_checkin_publish")
top.add_style("padding: 10px")
margin_top = '60px'
top.add_style("margin-top", margin_top)
top.add_style("position: relative")
current_changelist = WidgetSettings.get_value_by_key("current_changelist")
current_branch = WidgetSettings.get_value_by_key("current_branch")
current_workspace = WidgetSettings.get_value_by_key("current_workspace")
top.add("Branch: %s<br/>" % current_branch)
top.add("Changelist: %s<br/>" % current_changelist)
top.add("Workspace: %s<br/>" % current_workspace)
top.add("<br/>")
checked_out_div = DivWdg()
checkbox = CheckboxWdg("editable")
top.add(checked_out_div)
checkbox.add_class("spt_checkin_editable")
checked_out_div.add(checkbox)
checked_out_div.add("Leave files editable")
top.add("<br/>")
top.add("Publish Description<br/>")
text = TextAreaWdg("description")
# this needs to be set or it will stick out to the right
text.add_style("width: 220px")
text.add_class("spt_checkin_description")
top.add(text)
# add as a note
note_div = DivWdg()
top.add(note_div)
note_div.add_class("spt_add_note")
checkbox = CheckboxWdg("add_note")
web = WebContainer.get_web()
browser = web.get_browser()
if browser in ['Qt']:
checkbox.add_style("margin-top: -4px")
checkbox.add_style("margin-right: 3px")
note_div.add_style("margin-top: 3px")
checkbox.add_class("spt_checkin_add_note")
note_div.add(checkbox)
note_div.add("Also add as note")
top.add("<br/><br/>")
button = ActionButtonWdg(title="Check-in", icon=IconWdg.PUBLISH, size='medium')
top.add(button)
my.repo_type = 'perforce'
if my.repo_type == 'perforce':
# the depot is set per project (unless overridden)
project = my.sobject.get_project()
depot = project.get_value("location", no_exception=True)
if not depot:
depot = project.get_code()
asset_dir = Environment.get_asset_dir()
sandbox_dir = Environment.get_sandbox_dir()
changelist = WidgetSettings.get_value_by_key("current_changelist")
button.add_behavior( {
'type': 'click_up',
'depot': depot,
'changelist': changelist,
'sandbox_dir': sandbox_dir,
'search_key': search_key,
'cbjs_action': '''
var paths = spt.checkin.get_selected_paths();
spt.app_busy.show("Checking in "+paths.length+" file/s into Perforce");
var top = bvr.src_el.getParent(".spt_checkin_top");
var description = top.getElement(".spt_checkin_description").value;
var add_note = top.getElement(".spt_checkin_add_note").value;
var editable = top.getElement(".spt_checkin_editable").value;
if (editable == 'on') {
editable = true;
}
else {
editable = false;
}
#.........这里部分代码省略.........
示例2: get_title
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_class [as 别名]
def get_title(my, sobject):
div = DivWdg()
div.add_class("spt_tile_title")
div.add_color("background", "background3")
div.add_style("padding: 5px")
div.add_style("height: 16px")
detail_div = DivWdg()
div.add(detail_div)
detail_div.add_class("spt_tile_detail")
detail_div.add_style("float: right")
detail_div.add_style("margin-top: -2px")
detail = IconButtonWdg(title="Detail", icon=IconWdg.ZOOM)
detail_div.add(detail)
header_div = DivWdg()
header_div.add_class("spt_tile_select")
header_div.add_class("hand")
div.add(header_div)
header_div.add_class("SPT_DTS")
header_div.add_style("overflow-x: hidden")
from pyasm.widget import CheckboxWdg
checkbox = CheckboxWdg("select")
checkbox.add_class("spt_tile_checkbox")
title = sobject.get_name()
if not title:
title = sobject.get_code()
table = Table()
header_div.add(table)
header_div.add_style("position: relative")
table.add_cell(checkbox)
title_div = DivWdg()
td = table.add_cell(title_div)
title_div.add(title)
title_div.add_style("height: 15px")
title_div.add_style("left: 25px")
title_div.add_style("top: 3px")
title_div.add_style("position: absolute")
title_div.add_attr("title", title)
#title_div.add_style("white-space", "nowrap")
#td.add_style("overflow: hidden")
title_div.add("<br clear='all'/>")
description = sobject.get_value("description", no_exception=True)
if description:
div.add_attr("title", sobject.get_code())
return div
示例3: handle_dir_or_item
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_class [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)
#.........这里部分代码省略.........
示例4: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_class [as 别名]
def get_display(my):
search_type = my.kwargs.get("search_type")
search = Search(search_type)
if not search.column_exists("_is_collection"):
return my.top
search.add_filter("_is_collection", True)
collections = search.get_sobjects()
top = my.top
top.add_class("spt_dialog")
button = IconButtonWdg(title='Add to Collection', icon="BS_TH_LARGE", show_arrow=True)
top.add(button)
detail_wdg = DivWdg()
top.add(detail_wdg)
dialog = DialogWdg()
top.add(dialog)
dialog.set_as_activator(button, offset={'x':-25,'y': 0})
dialog.add_title("Collections")
dialog.add("<div style='margin: 10px'><b>Add selected items to a collection</b></div>")
add_div = DivWdg()
dialog.add(add_div)
icon = IconWdg(name="Add new collection", icon="BS_PLUS")
icon.add_style("opacity: 0.6")
icon.add_style("padding-right: 3px")
add_div.add(icon)
add_div.add("Create new Collection")
add_div.add_style("text-align: center")
add_div.add_style("background-color: #EEEEEE")
add_div.add_style("padding: 5px")
add_div.add_style("height: 20px")
add_div.add_class("hand")
insert_view = "edit_collection"
add_div.add_behavior( {
'type': 'click_up',
'insert_view': insert_view,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_table_top");
var table = top.getElement(".spt_table");
var search_type = top.getAttribute("spt_search_type");
// Hide the dialog when popup loads.
var dialog_top = bvr.src_el.getParent(".spt_dialog_top");
dialog_top.style.visibility = "hidden";
kwargs = {
search_type: search_type,
mode: "insert",
view: bvr.insert_view,
save_event: bvr.event_name,
show_header: false,
'num_columns': 2,
default: {
_is_collection: true
}
};
spt.panel.load_popup("Add New Collection", "tactic.ui.panel.EditWdg", kwargs);
'''
} )
content_div = DivWdg()
dialog.add(content_div)
content_div.add_style("width: 270px")
content_div.add_style("padding: 5px")
content_div.add_style("padding-bottom: 0px")
custom_cbk = {}
custom_cbk['enter'] = '''
var top = bvr.src_el.getParent(".spt_dialog");
var input = top.getElement(".spt_main_search");
var search_value = input.value.toLowerCase();
var collections = top.getElements(".spt_collection_div");
var num_result = 0;
for (i = 0; i < collections.length; i++) {
// Access the Collection title (without number count)
var collection_title = collections[i].attributes[0].value.toLowerCase();
if (collection_title.indexOf(search_value) != '-1') {
collections[i].style.display = "block";
num_result += 1;
}
else {
collections[i].style.display = "none";
}
}
// if no search results, display all
if (num_result == 0) {
for (i = 0; i < collections.length; i++) {
collections[i].style.display = "block";
}
#.........这里部分代码省略.........
示例5: get_title
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_class [as 别名]
def get_title(my, sobject):
div = DivWdg()
div.add_class("spt_tile_title")
div.add_color("background", "background3")
div.add_style("padding: 5px")
div.add_style("height: 20px")
if sobject.get_base_search_type() not in ["sthpw/snapshot"]:
detail_div = DivWdg()
div.add(detail_div)
detail_div.add_class("spt_tile_detail")
detail_div.add_style("float: right")
detail_div.add_style("margin-top: -2px")
#detail = IconButtonWdg(title="Detail", icon=IconWdg.ZOOM)
detail = IconButtonWdg(title="Detail", icon="BS_SEARCH")
detail_div.add(detail)
header_div = DivWdg()
header_div.add_class("spt_tile_select")
#header_div.add_attr("title",'[ draggable ]')
div.add(header_div)
header_div.add_class("SPT_DTS")
header_div.add_style("overflow-x: hidden")
header_div.add_style("overflow-y: hidden")
from pyasm.widget import CheckboxWdg
checkbox = CheckboxWdg("select")
checkbox.add_class("spt_tile_checkbox")
# to prevent clicking on the checkbox directly and not turning on the yellow border
#checkbox.add_attr("disabled","disabled")
title_expr = my.kwargs.get("title_expr")
if title_expr:
title = Search.eval(title_expr, sobject, single=True)
elif sobject.get_base_search_type() == "sthpw/snapshot":
title = sobject.get_value("context")
else:
title = sobject.get_value("name", no_exception=True)
if not title:
title = sobject.get_value("code", no_exception=True)
table = Table()
header_div.add(table)
header_div.add_style("position: relative")
table.add_cell(checkbox)
title_div = DivWdg()
td = table.add_cell(title_div)
title_div.add(title)
title_div.add_style("height: 15px")
title_div.add_style("left: 25px")
title_div.add_style("top: 3px")
title_div.add_style("position: absolute")
title_div.add_attr("title", title)
#title_div.add_style("white-space", "nowrap")
#td.add_style("overflow: hidden")
title_div.add("<br clear='all'/>")
title_div.add_class("hand")
description = sobject.get_value("description", no_exception=True)
if description:
div.add_attr("title", sobject.get_code())
return div
示例6: get_bottom_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_class [as 别名]
def get_bottom_wdg(my):
if my.get_option('mode') =='input':
return
web = WebContainer.get_web()
if web.get_selected_app() not in ['XSI','Maya']:
return
div = DivWdg(css='spt_outdated_ref')
refs = my.session.get_data().get_nodes("session/node/ref")
snap_codes = []
snap_contexts = []
sobjects = []
session_data_dict = {}
asset_codes = []
current_snapshots = []
node_names = []
session_versions = []
for ref in refs:
snap_code = Xml.get_attribute(ref, "asset_snapshot_code")
node_name = Xml.get_attribute(ref, "name")
version = Xml.get_attribute(ref, "asset_snapshot_version")
asset_code = Xml.get_attribute(ref, "asset_code")
if snap_code in snap_codes:
continue
snap_codes.append(snap_code)
snap_contexts.append(Xml.get_attribute(ref, "asset_snapshot_context"))
asset_codes.append(asset_code)
session_data_dict[snap_code] = version, node_name
# must search one by one
warnings=[]
for idx, snap_code in enumerate(snap_codes):
snapshot = Snapshot.get_by_code(snap_code)
if not snapshot:
continue
search_type = snapshot.get_value('search_type')
search_id = snapshot.get_value('search_id')
sk = SearchKey.build_search_key(search_type, search_id, column='id')
current_snapshot = Snapshot.get_snapshot(search_type, search_id, context=snap_contexts[idx], version=0)
if not current_snapshot:
warnings.append("Current version for [%s] context [%s] not found" %(sk, snap_contexts[idx]))
continue
session_version, node_name = session_data_dict.get(snap_code)
if session_version and int(current_snapshot.get_version()) > int(session_version):
current_snapshots.append(current_snapshot)
sobjects.append(current_snapshot.get_sobject())
node_names.append(node_name)
session_versions.append(int(session_version))
title = DivWdg('Outdated References')
title.add_style('text-decoration','underline')
div.add(title)
# draw the nodes to be udpated
for idx, current_snap in enumerate(current_snapshots):
cb = CheckboxWdg(my.REF_CB_NAME)
cb.add_class('spt_ref')
cb.add_style('display: none')
sobj = sobjects[idx]
node_name = node_names[idx]
session_version = session_versions[idx]
snapshot = current_snap
cb_value = my.get_input_value(sobj, snapshot)
items = cb_value.split('|')
items[-1] = node_name
cb_value = '|'.join(items)
cb.set_option('value', cb_value)
div.add(cb)
div.add('%0.1d. %s v%0.3d -> v%0.3d\n' \
%(idx+1, node_name, session_version, snapshot.get_version()))
div.add(HtmlElement.br())
for warning in warnings:
div.add(SpanWdg(warning, css='warning'))
div.add(HtmlElement.br())
if current_snapshots:
# add the button
prefix = my.search_type
#input_name = '%s_%s' %(my.search_type, my.CB_NAME)
update_button = ProdIconButtonWdg("Update all references")
update_button.add_behavior({'type': "click_up",\
'cbjs_action': '''var cousins = bvr.src_el.getParent('.spt_outdated_ref').getElements('.spt_ref');
cousins.each( function(x) {x.checked=true;}); py_replace_reference(bvr, '%s','%s')'''
% (prefix, my.REF_CB_NAME)})
div.add( SpanWdg(update_button, css='small'))
div.add(HtmlElement.br(2))
return div
示例7: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_class [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
#.........这里部分代码省略.........
示例8: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_class [as 别名]
def get_display(self):
search_type = self.kwargs.get("search_type")
search = Search(search_type)
if not search.column_exists("_is_collection"):
return self.top
search.add_filter("_is_collection", True)
collections = search.get_sobjects()
dialog = DivWdg()
self.set_as_panel(dialog)
dialog.add_class('spt_col_dialog_top')
title_div = DivWdg()
title_div.add_style('margin: 10px')
title_div.add(HtmlElement.b("Add selected items to collection(s)"))
dialog.add(title_div)
add_div = DivWdg()
dialog.add(add_div)
icon = IconWdg(name="Add new collection", icon="BS_PLUS")
icon.add_style("opacity: 0.6")
icon.add_style("padding-right: 3px")
add_div.add(icon)
add_div.add("Create new Collection")
add_div.add_style("text-align: center")
add_div.add_style("background-color: #EEEEEE")
add_div.add_style("padding: 5px")
add_div.add_style("height: 20px")
add_div.add_class("hand")
insert_view = "edit_collection"
add_div.add_behavior( {
'type': 'listen',
'event_name': 'refresh_col_dialog',
'cbjs_action': '''
var dialog_content = bvr.src_el.getParent('.spt_col_dialog_top');
spt.panel.refresh(dialog_content);
'''})
add_div.add_behavior( {
'type': 'click_up',
'insert_view': insert_view,
'event_name': 'refresh_col_dialog',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_table_top");
var table = top.getElement(".spt_table");
var search_type = top.getAttribute("spt_search_type");
// Hide the dialog when popup loads.
var dialog_top = bvr.src_el.getParent(".spt_dialog_top");
dialog_top.style.visibility = "hidden";
kwargs = {
search_type: search_type,
mode: "insert",
view: bvr.insert_view,
save_event: bvr.event_name,
show_header: false,
'num_columns': 2,
default: {
_is_collection: true
}
};
spt.panel.load_popup("Create New Collection", "tactic.ui.panel.EditWdg", kwargs);
'''
} )
content_div = DivWdg()
dialog.add(content_div)
content_div.add_style("width: 270px")
content_div.add_style("padding: 5px")
content_div.add_style("padding-bottom: 0px")
custom_cbk = {}
custom_cbk['enter'] = '''
var top = bvr.src_el.getParent(".spt_dialog");
var input = top.getElement(".spt_main_search");
var search_value = input.value.toLowerCase();
var collections = top.getElements(".spt_collection_div");
var num_result = 0;
var no_results_el = top.getElement(".spt_no_results");
for (i = 0; i < collections.length; i++) {
// Access the Collection title (without number count)
var collection_title = collections[i].getElement(".spt_collection_checkbox").getAttribute("collection_name").toLowerCase();
if (collection_title.indexOf(search_value) != '-1') {
collections[i].style.display = "block";
num_result += 1;
}
else {
collections[i].style.display = "none";
}
#.........这里部分代码省略.........