本文整理汇总了Python中pyasm.widget.CheckboxWdg.add_style方法的典型用法代码示例。如果您正苦于以下问题:Python CheckboxWdg.add_style方法的具体用法?Python CheckboxWdg.add_style怎么用?Python CheckboxWdg.add_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.CheckboxWdg
的用法示例。
在下文中一共展示了CheckboxWdg.add_style方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_item_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_style [as 别名]
def get_item_wdg(self, item, is_template=False):
item_div = DivWdg()
item_div.add_style("margin-top: 3px")
if is_template == True:
item_div.add_style("display: none")
#item_div.add_style("border: solid 1px blue")
item_div.add_class("spt_list_template_item")
else:
item_div.add_class("spt_list_item")
outer = DivWdg()
outer.add_style("float: left")
outer.add_style("text-align: left")
outer.add(item)
if self.show_enabled:
checkbox = CheckboxWdg("enabled")
checkbox.add_style("float: left")
checkbox.set_checked()
else:
checkbox = HiddenWdg("enabled")
item_div.add(checkbox)
#item_div.add(item)
item_div.add(outer)
from tactic.ui.widget import IconButtonWdg
add_wdg = DivWdg()
add_wdg.add_class("hand")
add_wdg.add_class("SPT_DTS")
#add_wdg.add("(+)")
add_wdg.add_class("spt_add")
button = IconButtonWdg(title="Add Entry", icon="BS_PLUS")
add_wdg.add(button)
add_wdg.add_style("float: left")
add_wdg.add_style("opacity: 0.5")
#add_wdg.add_style("margin: 3px")
item_div.add(add_wdg)
remove_wdg = DivWdg()
remove_wdg.add_class("hand")
remove_wdg.add_class("SPT_DTS")
#remove_wdg.add("(-)")
remove_wdg.add_class("spt_remove")
button = IconButtonWdg(title="Remove Entry", icon="BS_REMOVE")
remove_wdg.add(button)
remove_wdg.add_style("float: left")
remove_wdg.add_style("opacity: 0.5")
#remove_wdg.add_style("margin: 3px")
item_div.add(remove_wdg)
item_div.add("<br clear='all'/>")
return item_div
示例2: get_item_div
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_style [as 别名]
def get_item_div(self, sobjects, related_type):
item_div = DivWdg()
item_div.add_style("margin: 15px 10px")
sobject = sobjects[0]
checkbox = CheckboxWdg('related_types')
item_div.add(checkbox)
checkbox.add_style("vertical-align: bottom")
checkbox.set_attr("value", related_type)
if related_type in ["sthpw/snapshot", "sthpw/file"]:
checkbox.set_checked()
checked_types = self.kwargs.get("checked_types")
if checked_types == "__ALL__":
checkbox.set_checked()
item_div.add(" ")
item_div.add(related_type)
item_div.add(": ")
if related_type.startswith("@SOBJECT"):
related_sobjects = Search.eval(related_type, [sobject], list=True)
else:
try:
related_sobjects = []
for sobject in sobjects:
sobjs = sobject.get_related_sobjects(related_type)
related_sobjects.extend(sobjs)
except Exception as e:
print("WARNING: ", e)
related_sobjects = []
item_div.add("(%s)" % len(related_sobjects))
if len(related_sobjects) == 0:
item_div.add_style("opacity: 0.5")
return None
else:
# leave them unchecked for now to account for user's careless delete behavior
pass
# skip checking login by default to avoid accidental delete
#if related_type != 'sthpw/login':
# checkbox.set_checked()
return item_div
示例3: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_style [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;
}
#.........这里部分代码省略.........
示例4: handle_dir_or_item
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_style [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)
#.........这里部分代码省略.........
示例5: get_bottom_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_style [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