本文整理汇总了Python中pyasm.widget.IconWdg.add_style方法的典型用法代码示例。如果您正苦于以下问题:Python IconWdg.add_style方法的具体用法?Python IconWdg.add_style怎么用?Python IconWdg.add_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.IconWdg
的用法示例。
在下文中一共展示了IconWdg.add_style方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_header_wdg
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_header_wdg(my):
div = DivWdg()
div.add("<hr/>")
dots_div = DivWdg()
dots_div.add_style("margin-top: -12px")
div.add(dots_div)
left = 50
width = 60
for i, widget in enumerate(my.widgets):
on_dot = IconWdg("", IconWdg.DOT_GREEN)
on_dot.add_class("spt_wizard_on_dot")
off_dot = IconWdg("", IconWdg.DOT_GREY)
off_dot.add_class("spt_wizard_off_dot")
if i == 0:
off_dot.add_style("display: none")
else:
on_dot.add_style("display: none")
dot_div = DivWdg()
dots_div.add(dot_div)
dot_div.add(on_dot)
dot_div.add(off_dot)
dot_div.add_style("width: %spx" % width)
dot_div.add_style("float: left")
dot_div.add_style("margin-left: %spx" % left)
dot_div.add_style("text-align: center")
if (i+1) < len(my.widgets):
arrow_div = DivWdg()
dots_div.add(arrow_div)
arrow_div.add_style("float: left")
arrow_div.add_style("position: absolute")
arrow_div.add_style("margin-left: %spx" % ((width+left)*(i+1.2)))
arrow_div.add_style("margin-top: -3px")
arrow_div.add_style("text-align: center")
icon = IconWdg("", IconWdg.ARROWHEAD_DARK_RIGHT)
arrow_div.add(icon)
dots_div.add("<br clear='all'/>")
for widget in my.widgets:
name_div = DivWdg()
div.add(name_div)
name_div.add_style("float: left")
name_div.add_style("margin-left: %spx" % left)
name = widget.get_name()
name_div.add(name)
name_div.add_style("width: %spx" % width)
name_div.add_style("text-align: center")
div.add("<br clear='all'/>")
return div
示例2: get_item_div
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_item_div(self, sobject):
''' get the item div the sobject'''
top = DivWdg()
top.add_style("padding: 3px 2px")
top.add_class("spt_drop_item")
top.add_class("SPT_DROP_ITEM")
item_div = DivWdg()
top.add(item_div, "item_div")
item_div.add_style("text-overflow: ellipsis")
item_div.add_style("white-space: nowrap")
item_div.add_style("width: 80%")
item_div.add_attr('title','Click to remove')
item_div.add_style("display", "inline-block")
item_div.add_style("vertical-align", "top")
item_div.add_style("overflow", "hidden")
icon_div = DivWdg()
top.add(icon_div)
icon = IconWdg(icon="BS_REMOVE")
icon_div.add(icon)
icon_div.add_behavior( {
'type': 'click_up',
#'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
'cbjs_action': '''spt.drop.sobject_drop_remove(evt,bvr)'''
} )
icon.add_style("opacity: 0.3")
icon_div.add_class("hand")
icon_div.add_style("display", "inline-block")
icon_div.add_style("vertical-align", "top")
#icon_div.add_border()
#self.menu.set_over(item_div, event="mousein")
#self.menu.set_out(top, event="mouseleave")
# set this as the place for the display value to go
item_div.add_class("spt_drop_display_value")
add_icon = True
ExpressionParser.clear_cache()
if sobject:
if add_icon:
self._add_icon(sobject, item_div)
if self.display_expr:
display_value = Search.eval(self.display_expr, sobjects = sobject, single=True)
else:
display_value = sobject.get_display_value()
if isinstance(display_value, list):
display_value = display_value[0]
item_div.add( display_value )
self.values.append( SearchKey.get_by_sobject(sobject) )
return top
示例3: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(self):
self.display_expr = self.kwargs.get('display_expr')
self.values = []
instance_type = self.get_option("instance_type")
accepted_type = self.get_option("accepted_drop_type")
div = DivWdg()
div.add_class("spt_drop_element_top")
div.add_style("width: 100%")
div.add_style("min-height: 70px")
div.add_style("height: auto")
div.add_style("min-width: 100px")
div.add_style("max-height: 300px")
div.add_style("overflow-y: auto")
div.add_style("overflow-x: hidden")
self.value_wdg = HiddenWdg(self.get_name())
self.value_wdg.add_class("spt_drop_element_value")
div.add( self.value_wdg )
version = self.parent_wdg.get_layout_version()
#if version != "2":
self.add_drop_behavior(div, accepted_type)
# add the hidden div which holds containers info for the sobject
template_div = DivWdg()
template_div.add_style("display: none")
template_item = self.get_item_div(None)
# float left for the new icon beside it
item_div = template_item.get_widget('item_div')
#item_div.add_style('float: left')
template_item.add_class("spt_drop_template")
new_icon = IconWdg("New", IconWdg.NEW)
new_icon.add_style('padding-left','3px')
#TODO: insert the new_icon at add(new_icon, index=0) and make sure
# the js-side sobject_drop_action cloning align the template div properly
#template_item.add(new_icon)
template_div.add(template_item)
div.add(template_div)
content_div = DivWdg()
div.add(content_div)
content_div.add_class("spt_drop_content")
if instance_type:
instance_wdg = self.get_instance_wdg(instance_type)
content_div.add(instance_wdg)
return div
示例4: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(my):
msg = my.kwargs.get("message")
arrow_div = DivWdg()
icon = IconWdg(msg, IconWdg.ARROW_UP_LEFT_32)
icon.add_style("margin-top: -20")
icon.add_style("margin-left: -15")
icon.add_style("position: absolute")
arrow_div.add(icon)
arrow_div.add(" "*5)
arrow_div.add("<b>%s</b>" % msg)
arrow_div.add_style("position: relative")
arrow_div.add_style("margin-top: 5px")
arrow_div.add_style("margin-left: 20px")
arrow_div.add_style("float: left")
arrow_div.add_style("padding: 25px")
arrow_div.set_box_shadow("1px 1px 2px 2px")
arrow_div.set_round_corners(30)
arrow_div.add_color("background", "background")
return arrow_div
示例5: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(my):
widget = my.widget
widget.set_box_shadow()
widget.add_class("spt_dialog_top")
widget.add_class("spt_popup")
z_index = my.kwargs.get("z_index")
if not z_index:
z_index = "500"
widget.add_style("z-index: %s" % z_index)
web = WebContainer.get_web()
widget.set_id(my.name)
widget.add_attr("spt_dialog_id", my.name);
if my.kwargs.get("display") not in [True, "true"]:
widget.add_style("display: none")
widget.add_style("position: absolute")
widget.add_behavior( {
'type': 'listen',
'event_name': '%s|dialog_close' % my.name,
'cbjs_action': my.get_cancel_script()
} )
offset = my.kwargs.get("offset")
if not offset:
offset = my.offset
show_header = True
show_resize = False
drag_div = DivWdg()
if show_header:
widget.add(drag_div)
show_pointer = my.kwargs.get("show_pointer")
if show_pointer not in [False, 'false']:
from tactic.ui.container import ArrowWdg
offset_x = 15 - offset.get('x')
offset_y = offset.get("y")
arrow = ArrowWdg(
offset_x=offset_x,
offset_y=offset_y,
color=widget.get_color("background", -10)
)
arrow.add_class("spt_popup_pointer")
arrow.add_style("z-index: 10")
widget.add(arrow)
# create the 'close' button ...
close_wdg = SpanWdg()
close_wdg.add( IconWdg("Close", "BS_REMOVE") )
close_wdg.add_style("float: right")
close_wdg.add_class("hand")
close_wdg.add_style("margin: 3px 1px 3px 1px")
close_wdg.add_behavior({
'type': 'click_up',
'cbjs_action': my.get_cancel_script()
})
drag_div.add(close_wdg)
anchor_wdg = SpanWdg()
drag_div.add(anchor_wdg)
anchor_wdg.add_style("margin: 5px 5px 3px 1px")
anchor_wdg.add( IconWdg("Anchor Dialog", "BS_PUSHPIN") )
anchor_wdg.add_style("float: right")
anchor_wdg.add_class("hand")
anchor_wdg.add_behavior({
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_dialog_top");
var position = top.getStyle("position");
if (position == 'fixed') {
top.setStyle("position", "absolute");
bvr.src_el.setStyle("opacity", "1.0");
}
else {
top.setStyle("position", "fixed");
bvr.src_el.setStyle("opacity", "0.5");
}
#.........这里部分代码省略.........
示例6: handle_item_div
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def handle_item_div(my, item_div, dirname, basename):
table = Table()
item_div.add(table)
table.add_row()
table.add_style("width: 100%")
icon_string = my.get_file_icon(dirname, basename)
icon_div = DivWdg()
td = table.add_cell(icon_div)
td.add_style("width: 15px")
icon = IconWdg("%s/%s" % (dirname, basename), icon_string)
icon_div.add(icon)
icon_div.add_style("float: left")
icon_div.add_style("margin-top: -1px")
path = "%s/%s" % (dirname, basename)
status = my.path_info.get(path)
margin_left = -16
if status == 'same':
check = IconWdg( "No Changes", IconWdg.CHECK, width=12 )
elif status == 'added':
check = IconWdg( "Added", IconWdg.NEW, width=16 )
margin_left = -18
elif status == 'unversioned':
check = IconWdg( "Unversioned", IconWdg.HELP, width=12 )
elif status == 'missing':
check = IconWdg( "Missing", IconWdg.WARNING, width=12 )
elif status == 'editable':
check = IconWdg( "Editable", IconWdg.EDIT, width=12 )
elif status == 'modified':
check = IconWdg( "Modified", IconWdg.WARNING, width=12 )
else:
check = IconWdg( "Error (unknown status)", IconWdg.ERROR, width=12 )
if check:
td = table.add_cell(check)
td.add_style("width: 3px")
check.add_style("float: left")
check.add_style("margin-left: %spx" % margin_left)
check.add_style("margin-top: 4px")
item_div.add_color("color", "color", [0, 0, 50])
if status == 'missing':
item_div.add_style("opacity: 0.3")
else:
item_div.add_style("opacity: 0.8")
name_div = DivWdg()
td = table.add_cell(name_div)
name_div.add(basename)
name_div.add_style("float: left")
if status != "same":
name_div.add(" <i style='opacity: 0.5; font-size: 10px'>(%s)</i>" % status)
spath = path.replace(" ", "_")
# add the size of the file
size_div = DivWdg()
td = table.add_cell(size_div)
td.add_style("width: 60px")
size = my.sizes.get(spath)
if size is None or size == -1:
size_div.add("-")
else:
size_div.add(FormatValue().get_format_value(size, 'KB'))
size_div.add_style("margin-right: 5px")
size_div.add_style('text-align: right')
# FIXME: this still is needed right now, although really used.
my.subcontext_options = []
if not my.subcontext_options:
subcontext = TextWdg("subcontext")
subcontext = HiddenWdg("subcontext")
subcontext.add_class("spt_subcontext")
subcontext.add_style("float: right")
else:
subcontext = SelectWdg("subcontext")
subcontext = HiddenWdg("subcontext")
subcontext.set_option("show_missing", False)
subcontext.set_option("values", my.subcontext_options)
subcontext.add_empty_option("----")
#.........这里部分代码省略.........
示例7: get_import_wdg
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_import_wdg(self):
div = DivWdg()
if self.data:
div.add("<br/>"*2)
div.add("The following TACTIC share was found: ")
div.add("<br/>"*2)
data_input = TextAreaWdg("data")
data_input.add_style("display: none")
div.add(data_input)
#print "xxxx: ", self.data
data_str = jsondumps(self.data)
#data_str = data_str.replace('"', "'")
print "data: ", data_str
data_input.set_value(data_str)
table = Table()
div.add(table)
table.set_max_width()
table.add_style("margin-left: 20px")
table.add_style("margin-right: 20px")
for name, value in self.data.items():
name = Common.get_display_title(name)
table.add_row()
table.add_cell(name)
table.add_cell(value)
div.add("<br/>"*2)
div.add( self.get_versions_wdg() )
div.add("<br/>"*2)
# check to see if the project exists
project_code = self.data.get("project_code")
project_code = self.data.get("projects")
project = Project.get_by_code(project_code)
#if project:
if False:
msg_div = DivWdg()
div.add(msg_div)
msg_div.add_style("padding: 20px")
msg_div.add_color("background", "background3")
msg_div.add_color("color", "color")
msg_div.add_border()
icon = IconWdg("WARNING", IconWdg.WARNING)
msg_div.add(icon)
icon.add_style("float: left")
msg_div.add("The project with code [%s] already exists. You must remove the installed project before trying to import this one." % project_code)
return div
if self.data.get("is_encrypted") == "true":
div.add("The transactions in this share is encrypted. Please provide an encryption key to decrypt the transactions<br/><br/>")
div.add("Encryption Key: ")
text = TextWdg("encryption_key")
div.add(text)
div.add("<br/>"*2)
button = ActionButtonWdg(title="Import >>")
button.add_style("float: right")
div.add(button)
div.add("<br/>"*2)
button.add_behavior( {
'type': 'click_up',
'project_code': project_code,
'cbjs_action': '''
spt.app_busy.show("Importing Project "+bvr.project_code+"...");
var top = bvr.src_el.getParent(".spt_sync_import_top");
var values = spt.api.Utility.get_input_values(top, null, false);
var cmd = "tactic.ui.sync.SyncImportCmd";
var server = TacticServerStub.get();
server.execute_cmd(cmd, values, {}, {use_transaction: false});
spt.notify.show_message("Finished importing project");
spt.app_busy.hide();
document.location = '/tactic/'+bvr.project_code;
'''
} )
return div
示例8: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(my):
top = my.top
my.set_as_panel(top)
top.add_class("spt_delete_top")
top.add_color("background", "background")
top.add_color("color", "color")
top.add_border()
top.add_style("width: 300px")
top.add_border()
search_key = my.kwargs.get("search_key")
search_keys = my.kwargs.get("search_keys")
if search_key:
sobject = Search.get_by_search_key(search_key)
sobjects = [sobject]
search_keys = [search_key]
elif search_keys:
sobjects = Search.get_by_search_keys(search_keys)
sobject = sobjects[0]
if not sobjects:
msg = "%s not found" %search_key
return msg
search_type = sobject.get_base_search_type()
if search_type in ['sthpw/project', 'sthpw/search_object']:
msg = 'You cannot delete these items with this tool'
return msg
my.search_keys = search_keys
title = DivWdg()
top.add(title)
title.add_color("background", "background", -10)
if my.search_keys:
title.add("Delete %s Items" % len(my.search_keys))
else:
title.add("Delete Item [%s]" % (sobject.get_code()))
title.add_style("font-size: 14px")
title.add_style("font-weight: bold")
title.add_style("padding: 10px")
content = DivWdg()
top.add(content)
content.add_style("padding: 10px")
content.add("The item to be deleted has a number of dependencies as described below:<br/>", 'heading')
# find all the relationships
schema = Schema.get()
related_types = schema.get_related_search_types(search_type, direction="children")
parent_type = schema.get_parent_type(search_type)
child_types = schema.get_child_types(search_type)
# some special considerations
# FIXME: this needs to be more automatic. Should only be
# deletable children (however, that will be defined)
if search_type in ['sthpw/task','sthpw/note', 'sthpw/snapshot']:
if "sthpw/project" in related_types:
related_types.remove("sthpw/project")
if "sthpw/login" in related_types:
related_types.remove("sthpw/login")
if "config/process" in related_types:
related_types.remove("config/process")
if parent_type in related_types:
related_types.remove(parent_type)
related_types.append('sthpw/note')
related_types.append('sthpw/task')
related_types.append('sthpw/snapshot')
if 'sthpw/work_hour' not in related_types:
related_types.append('sthpw/work_hour')
items_div = DivWdg()
content.add( items_div )
items_div.add_style("padding: 10px")
valid_related_ctr = 0
for related_type in related_types:
if related_type == "*":
print "WARNING: related_type is *"
continue
if related_type == search_type:
continue
if related_type in ['sthpw/search_object','sthpw/search_type']:
continue
item_div = my.get_item_div(sobjects, related_type)
if item_div:
items_div.add(item_div)
valid_related_ctr += 1
#.........这里部分代码省略.........
示例9: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(my):
top = my.top
my.set_as_panel(top)
top.add_class("spt_delete_top")
top.add_color("background", "background")
top.add_color("color", "color")
top.add_border()
top.add_style("width: 300px")
top.add_border()
search_key = my.kwargs.get("search_key")
search_keys = my.kwargs.get("search_keys")
if search_key:
sobject = Search.get_by_search_key(search_key)
sobjects = [sobject]
search_keys = [search_key]
elif search_keys:
sobjects = Search.get_by_search_keys(search_keys)
sobject = sobjects[0]
if not sobjects:
msg = "%s not found" %search_key
return msg
search_type = sobject.get_base_search_type()
if search_type in ['sthpw/project', 'sthpw/search_object']:
msg = 'You cannot delete these items with this tool'
return msg
my.search_keys = search_keys
title = DivWdg()
top.add(title)
title.add_color("background", "background", -10)
if my.search_keys:
title.add("Delete %s Items" % len(my.search_keys))
else:
title.add("Delete Item [%s]" % (sobject.get_code()))
title.add_style("font-size: 14px")
title.add_style("font-weight: bold")
title.add_style("padding: 10px")
content = DivWdg()
top.add(content)
content.add_style("padding: 10px")
content.add("The item to be deleted has a number of dependencies as described below:<br/>", 'heading')
# find all the relationships
related_types = SearchType.get_related_types(search_type, direction='children')
items_div = DivWdg()
content.add( items_div )
items_div.add_style("padding: 10px")
valid_related_ctr = 0
for related_type in related_types:
if related_type == "*":
print "WARNING: related_type is *"
continue
if related_type == search_type:
continue
if related_type in ['sthpw/search_object','sthpw/search_type']:
continue
item_div = my.get_item_div(sobjects, related_type)
if item_div:
items_div.add(item_div)
valid_related_ctr += 1
if valid_related_ctr > 0:
icon = IconWdg("WARNING", IconWdg.WARNING)
icon.add_style("float: left")
content.add( icon )
content.add("<div><b>WARNING: By selecting the related items above, you can delete them as well when deleting this sObject.</b></div>")
content.add("<br/>"*2)
else:
# changed the heading to say no dependencies
content.add("The item to be deleted has no dependencies.<br/>", 'heading')
content.add("There are %s items to be deleted" % len(my.search_keys))
content.add("<br/>"*2)
content.add("Do you wish to continue deleting?")
content.add("<br/>"*2)
button_div = DivWdg()
button_div.add_styles('width: 300px; height: 75px')
button = ActionButtonWdg(title="Delete")
button_div.add(button)
content.add(button_div)
button.add_style("float: left")
#.........这里部分代码省略.........
示例10: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(my):
div = DivWdg()
if not Container.get_dict("JSLibraries", "spt_popup"):
div.add_style("position: fixed")
div.add_style("top: 0px")
div.add_style("left: 0px")
div.add_style("opacity: 0.4")
div.add_style("background", "#000")
div.add_style("padding: 100px")
div.add_style("height: 100%")
div.add_style("width: 100%")
div.add_class("spt_popup_background")
div.add_style("display: none")
div.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.hide(bvr.src_el);
'''
} )
Container.put("PopupWdg:background", True)
# This is the absolute outside of a popup, including the drop shadow
widget = DivWdg()
div.add(widget)
widget.add_class("spt_popup")
if not Container.get_dict("JSLibraries", "spt_popup"):
widget.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
width = my.kwargs.get("width")
if not width:
width = 10
#widget.add_behavior( {
# 'type': 'load',
# 'cbjs_action': 'bvr.src_el.makeResizable({handle:bvr.src_el.getElement(".spt_popup_resize")})'
#} )
web = WebContainer.get_web()
widget.set_id(my.name)
if my.kwargs.get("display") == "true":
pass
else:
widget.add_style("display: none")
widget.add_style("position: absolute")
widget.add_style("left: 400px")
widget.add_style("top: 100px")
widget.add_border()
widget.add_color("background", "background")
#widget.set_box_shadow(color="#000")
widget.set_box_shadow()
table = Table()
table.add_behavior( {
'type': 'load',
'width': width,
'cbjs_action': '''
bvr.src_el.setStyle("width", bvr.width)
var popup = bvr.src_el.getParent(".spt_popup");
var window_size = $(window).getSize();
var size = bvr.src_el.getSize();
var left = window_size.x/2 - size.x/2;
var top = window_size.y/2 - size.y/2;
popup.setStyle("left", left);
//popup.setStyle("top", top);
'''
} )
table.add_row()
"""
# Qt doesn't support shadows very well
if web.get_browser() == 'Qtx':
# dynamically add css files
table.add_class("css_shadow_table")
td = table.add_cell()
td.add_class("css_shadow_td css_shadow_top_left SPT_POPUP_SHADOW")
#.........这里部分代码省略.........
示例11: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(my):
top = my.top
#help_div = DivWdg()
help_div = top
#top.add(help_div)
help_div.add_class("spt_help_top")
help_div.set_id("spt_help_top")
show_title = my.kwargs.get("show_title")
if show_title in [True, 'true']:
show_title = True
else:
show_title = False
if show_title:
title_wdg = DivWdg()
help_div.add(title_wdg)
title_wdg.add_style("font-size: 12px")
title_wdg.add_style("font-weight: bold")
title_wdg.add_color("background", "background", -10)
title_wdg.add_style("padding: 3px")
#title_wdg.add_style("margin-top: 8px")
title_wdg.add_style("margin-bottom: 5px")
title_wdg.add_style("height: 26px")
title_wdg.add_style("padding: 6 0 0 6")
title_wdg.set_round_corners(corners=['TL','TR'])
icon = IconWdg("Close", IconWdg.KILL)
title_wdg.add(icon)
icon.add_style("float: right")
title_wdg.add("Help")
help_div.set_round_corners()
help_div.add_color("color", "color2")
help_div.add_color("background", "background")
help_div.add_style("overflow: hidden")
help_div.add_border()
shelf_div = DivWdg()
help_div.add(shelf_div)
shelf_div.add_style("padding: 10px")
shelf_div.add_color("background", "background", -10)
shelf_div.add_style("height: 25px")
#button = SingleButtonWdg(title="Documentation Main Page", icon=IconWdg.HOME)
button = IconButtonWdg(title="Documentation Main Page", icon="BS_HOME")
shelf_div.add(button)
button.add_style("float: left")
button.add_style("margin: 0px 10px")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.help.set_top();
spt.help.load_alias("main")
'''
} )
#button = SingleButtonWdg(title="Edit Help", icon=IconWdg.EDIT)
if my.show_add_new:
button = IconButtonWdg(title="Add New Help", icon="BS_EDIT")
shelf_div.add(button)
button.add_style("float: left")
button.add_style("margin: 0px 10px")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.tab.set_main_body_tab();
var class_name = 'tactic.ui.app.HelpEditWdg';
var element_name = spt.help.get_view();
if (!element_name) {
element_name = "default";
}
var kwargs = {
view: element_name
}
spt.tab.add_new("help_edit", "Help Edit", class_name, kwargs);
'''
} )
#button = SingleButtonWdg(title="Go Back One Page", icon=IconWdg.ARROW_LEFT)
button = IconButtonWdg(title="Go Back One Page", icon="BS_CIRCLE_ARROW_LEFT")
shelf_div.add(button)
button.add_style("float: left")
button.add_style("margin: 0px 10px")
button.add_behavior( {
#.........这里部分代码省略.........
示例12: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(my):
collection = my.kwargs.get("collection")
path = my.kwargs.get("path")
search_type = collection.get_base_search_type()
parts = search_type.split("/")
collection_type = "%s/%s_in_%s" % (parts[0], parts[1], parts[1])
search = Search(collection_type)
search.add_filter("parent_code", collection.get_value("code"))
search.add_column("search_code")
items = search.get_sobjects()
codes = [x.get_value("search_code") for x in items]
count = search.get_count()
# find the children that are actually collections
search = Search(search_type)
search.add_filter("_is_collection", True)
search.add_filters("code", codes)
has_child_collections = search.get_count() > 0
top = my.top
collection_top = top
collection_top.add_class("spt_collection_div_top")
collection_div = DivWdg()
name = collection.get_value("name")
# Adding Collection title (without the number count) as an attribute
collection_top.set_attr("collection_name", name)
collection_top.add(collection_div)
collection_top.add_class("tactic_hover")
collection_top.add_class("hand")
collection_div.add_class("spt_collection_item")
collection_div.add_attr("spt_collection_key", collection.get_search_key())
collection_div.add_attr("spt_collection_code", collection.get_code())
collection_div.add_attr("spt_collection_path", path)
# This is for Drag and Drop from a tile widget
collection_div.add_class("spt_tile_top")
collection_div.add_attr("spt_search_key", collection.get_search_key())
collection_div.add_attr("spt_search_code", collection.get_code())
collection_div.add_style("height: 20px")
collection_div.add_style("padding-top: 10px")
if has_child_collections:
icon_div = DivWdg()
icon = IconWdg(name="View Collection", icon="BS_CHEVRON_DOWN")
icon_div.add(icon)
icon.add_style("float: right")
icon.add_style("margin-top: -20px")
collection_top.add(icon_div)
icon_div.add_class("spt_collection_open")
icon_div.add_attr("spt_collection_key", collection.get_search_key())
icon_div.add_attr("spt_collection_path", path)
from tactic.ui.panel import ThumbWdg2
thumb_wdg = ThumbWdg2()
thumb_wdg.set_sobject(collection)
collection_div.add(thumb_wdg)
thumb_wdg.add_style("width: 45px")
thumb_wdg.add_style("float: left")
thumb_wdg.add_style("margin-top: -10px")
if count:
count_div = DivWdg()
collection_div.add(count_div)
#count_div.add_style("margin-top: -10px")
#count_div.add_style("margin-left: -10px")
count_div.add_style("width: 15px")
count_div.add_style("height: 15px")
count_div.add_style("font-size: 0.8em")
count_div.add_style("border-radius: 10px")
count_div.add_style("background: #DDD")
count_div.add_style("position: absolute")
count_div.add_style("text-align: center")
count_div.add_style("margin-left: 23px")
count_div.add_style("margin-top: -8px")
count_div.add_style("box-shadow: 0px 0px 3px rgba(0,0,0,0.5)")
count_div.add(count)
#count_div.add_update( {
# 'parent_key': collection.get_search_key(),
# 'expression': "@COUNT(%s)" % collection_type,
#} )
name = collection.get_value("name")
collection_div.add(name)
#.........这里部分代码省略.........
示例13: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(self):
top = self.top
self.set_as_panel(top)
top.add_class("spt_sync_import_top")
top.add_style("width: 500px")
top.add_color("background", "background")
top.add_color("color", "color")
top.add_style("padding: 20px")
inner = DivWdg()
top.add(inner)
inner.add(self.get_base_dir_wdg())
is_refresh = self.kwargs.get("is_refresh") == 'true'
base_dir = self.kwargs.get("base_dir")
if base_dir:
data = self.kwargs.get("data")
if data:
self.data = jsonloads(data)
else:
if not os.path.exists(base_dir):
msg_div = DivWdg()
inner.add("<br/>"*2)
inner.add(msg_div)
msg_div.add_style("padding: 20px 20px 30px 20px")
msg_div.add_color("background", "background3")
msg_div.add_color("color", "color")
msg_div.add_border()
icon = IconWdg("WARNING", IconWdg.WARNING)
msg_div.add(icon)
icon.add_style("float: left")
msg_div.add("<br/>")
msg_div.add("Base folder [%s] does not exist on server" % base_dir)
if is_refresh:
return inner
else:
return top
manifest_path = "%s/tactic.txt" % base_dir
f = open(manifest_path)
data = f.read()
self.data = jsonloads(data)
inner.add( self.get_import_wdg() )
else:
self.data = {}
msg_div = DivWdg()
inner.add(msg_div)
icon = IconWdg("", IconWdg.ARROW_UP)
msg_div.add(icon)
msg_div.add("Please browse or enter in a sync location")
msg_div.add_style("padding: 20px")
msg_div.add_style("margin: 30px")
msg_div.add_style("text-align: center")
msg_div.add_border()
msg_div.add_color("background", "background3")
msg_div.add_color("color", "color3")
if self.kwargs.get("is_refresh") == 'true':
return inner
else:
return top
示例14: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [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;
#.........这里部分代码省略.........
示例15: get_display
# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_style [as 别名]
def get_display(my):
my.display_expr = my.kwargs.get('display_expr')
my.values = []
instance_type = my.get_option("instance_type")
accepted_type = my.get_option("accepted_drop_type")
div = DivWdg()
div.add_class("spt_drop_element_top")
div.add_style("width: 100%")
div.add_style("height: 100%")
div.add_style("min-width: 100px")
div.add_style("max-height: 300px")
div.add_style("overflow-y: auto")
my.value_wdg = HiddenWdg(my.get_name())
my.value_wdg.add_class("spt_drop_element_value")
div.add( my.value_wdg )
version = my.parent_wdg.get_layout_version()
#if version != "2":
my.add_drop_behavior(div, accepted_type)
# add the hidden div which holds containers info for the sobject
template_div = DivWdg()
template_div.add_style("display: none")
template_item = my.get_item_div(None)
# float left for the new icon beside it
item_div = template_item.get_widget('item_div')
item_div.add_style('float: left')
template_item.add_class("spt_drop_template")
#template_item.add_style('float: left')
new_icon = IconWdg("New", IconWdg.NEW)
new_icon.add_style('padding-left','3px')
#TODO: insert the new_icon at add(new_icon, index=0) and make sure
# the js-side sobject_drop_action cloning align the template div properly
#template_item.add(" - ")
template_item.add(new_icon)
template_div.add(template_item)
div.add(template_div)
# list out the relationships
#sobject = my.get_current_sobject()
#search_type = sobject.get_base_search_type()
content_div = DivWdg()
div.add(content_div)
# shrink wrapping for FF
content_div.add_style('float: left')
content_div.add_class("spt_drop_content")
if instance_type:
instance_wdg = my.get_instance_wdg(instance_type)
content_div.add(instance_wdg)
return div