本文整理汇总了Python中pyasm.widget.ThumbWdg.set_icon_size方法的典型用法代码示例。如果您正苦于以下问题:Python ThumbWdg.set_icon_size方法的具体用法?Python ThumbWdg.set_icon_size怎么用?Python ThumbWdg.set_icon_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.ThumbWdg
的用法示例。
在下文中一共展示了ThumbWdg.set_icon_size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_logins_wdg
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def get_logins_wdg(my, logins):
logins_div = DivWdg()
for login in logins:
login_div = DivWdg()
logins_div.add(login_div)
login_div.add_style("padding: 5px")
# login_div.add_style("height: 30px")
login_div.add_style("margin: 0 5px 5px 0")
login_div.add_attr("spt_login", login.get_value("login"))
thumb_div = DivWdg()
login_div.add(thumb_div)
thumb_div.add_style("float: left")
thumb_div.add_style("margin-right: 5px")
thumb_div.add_style("padding-top: 1px")
thumb = ThumbWdg()
thumb.set_sobject(login)
thumb_div.add(thumb)
thumb.set_icon_size(15)
login_div.add(login.get_full_name())
login_div.add_behavior(
{
"type": "click_up",
"sobject_display_expr": my.sobject_display_expr,
"tab_view": my.tab_view,
"cbjs_action": """
var top = bvr.src_el.getParent(".spt_schedule_top");
var class_name = 'tactic.ui.tools.schedule_wdg.ScheduleUserToolWdg';
var login = bvr.src_el.getAttribute("spt_login")
var kwargs = {
login: login
};
if (bvr.sobject_display_expr)
kwargs['sobject_display_expr'] = bvr.sobject_display_expr;
if (bvr.tab_view)
kwargs['tab_view'] = bvr.tab_view;
var content = top.getElement(".spt_schedule_content");
spt.panel.load(content, class_name, kwargs);
""",
}
)
login_div.add_hover()
return logins_div
示例2: get_title_wdg
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def get_title_wdg(my):
if my.parent:
code = my.parent.get_value("code", no_exception=True)
name = my.parent.get_value("name", no_exception=True)
search_type_obj = my.parent.get_search_type_obj()
else:
code = my.sobject.get_value("code", no_exception=True)
name = my.sobject.get_value("name", no_exception=True)
search_type_obj = my.sobject.get_search_type_obj()
title = DivWdg()
search = Search("sthpw/snapshot")
search.add_filter("search_type", "sthpw/search_type")
search.add_filter("search_code", search_type_obj.get_value("code"))
if search.get_sobject():
thumb = ThumbWdg()
title.add(thumb)
thumb.set_icon_size(30)
thumb.set_sobject(search_type_obj)
thumb.add_style("float: left")
title.add_color("background", "background3")
title.add_style("height: 20px")
title.add_style("padding: 6px")
title.add_style("font-weight: bold")
title.add_style("font-size: 1.4em")
title.add_border()
stype_title = search_type_obj.get_value("title")
if stype_title:
title.add("%s: " % stype_title)
if name:
title.add("%s" % name)
if code:
title.add(" <i style='font-size: 0.8; opacity: 0.7'>(%s)</i>" % code)
elif code:
title.add("%s" % code)
else:
title.add("(No name)")
return title
示例3: GeneralPublishElementWdg
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
class GeneralPublishElementWdg(BaseTableElementWdg):
''' A general publish table element with the option of having a thumbnail '''
def get_arg_keys(self):
return {'view': 'a custom view other than publish'}
def preprocess(self):
if self.get_option('preview') != 'false':
self.thumb = ThumbWdg()
self.thumb.set_sobjects(self.sobjects)
self.thumb.set_icon_size(60)
# passing options from this to ThumbWdg, shouldn't have conflicts
options = self.options
self.thumb.set_options(options)
# for its own preprocess and data caching
def get_display(self):
self.view = self.kwargs.get('view')
if not self.view:
self.view = 'publish'
widget = Widget()
sobject = self.get_current_sobject()
search_type = sobject.get_search_type()
search_id = sobject.get_id()
if self.get_option('preview') != 'false':
self.thumb.set_current_index(self.get_current_index())
widget.add(self.thumb)
publish_link = PublishLinkWdg(search_type,search_id, config_base=self.view)
div = DivWdg(publish_link)
div.set_style('clear: left; padding-top: 6px')
widget.add(div)
# build a popup link to show publish browsing
browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
browse_link.add_behavior({'type': 'click_up',
'cbjs_action': 'spt.popup.get_widget(evt, bvr)',
'options': {'popup_id' : 'publish_browser',
'class_name' : 'pyasm.prod.web.PublishBrowserWdg' ,
'title': 'Publish Browser'},
'args' : { 'search_type': search_type,
'search_id' : search_id }
})
div.add(browse_link)
div.set_style('padding-top: 6px')
return widget
示例4: display_shot
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def display_shot(my, shot, widget, count, is_current=False):
thumb = ThumbWdg()
thumb.set_sobject(shot)
thumb.set_icon_size(45)
widget.add( " " * 5 * count + "L ")
widget.add(thumb)
widget.add(" ")
span = SpanWdg()
if is_current:
span.add_style("background: #eee")
span.add_style("font-weight: bold")
span.add_style("font-size: 1.1em")
span.add(shot.get_code())
span.add(" ")
span.add(shot.get_value("description"))
widget.add(span)
widget.add("<br/>")
示例5: handle_missing_instance
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def handle_missing_instance(my, table, instance, asset):
asset_code = asset.get_code()
table.add_row()
table.add_blank_cell()
# add the thumbnail
thumb = ThumbWdg()
thumb.set_name("images")
thumb.set_sobject(asset)
thumb.set_icon_size(45)
table.add_cell(thumb)
info_wdg = Widget()
info_wdg.add("<b>%s</b>" % instance)
info_wdg.add("<div style='font-size: 0.8em'>%s</div>" % asset_code )
table.add_cell(info_wdg)
table.add_blank_cell()
示例6: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
#.........这里部分代码省略.........
'kwargs': {
'search_type': 'sthpw/task',
'view': 'table'
},
}
reports.append(report_data)
"""
if category == 'list_item_reports' or not category:
search_types = Project.get().get_search_types()
for search_type in search_types:
base_key = search_type.get_base_key()
key = {'project': project.get_code(), 'code': base_key}
key2 = {'project': project.get_code(), 'code': '*'}
key3 = {'code': base_key}
key4 = {'code': '*'}
keys = [key, key2, key3, key4]
if not top.check_access("search_type", keys, "view", default="deny"):
continue
if not SearchType.column_exists(base_key, "pipeline_code"):
continue
thumb_div = DivWdg()
image = thumb_div
thumb_div.add_border()
thumb_div.set_box_shadow("1px 1px 1px 1px")
thumb_div.add_style("width: 60px")
thumb = ThumbWdg()
thumb_div.add(thumb)
thumb.set_sobject(search_type)
thumb.set_icon_size(60)
report_data = {
'title': '%s Workflow Status' % search_type.get_title(),
'description': 'Number of items in each process',
'class_name': 'tactic.ui.report.stype_report_wdg.STypeReportWdg',
'kwargs': {
'search_type': base_key
},
'image': thumb_div
}
reports.append(report_data)
report_data = {
'title': '%s Labor Cost Report' % search_type.get_title(),
'description': 'Labor Cost Breakdown for each Item',
'class_name': 'tactic.ui.panel.ViewPanelWdg',
'kwargs': {
'search_type': search_type.get_code(),
'view': "table",
'show_header': False,
'mode': 'simple',
'element_names': "preview,code,title,cost_breakdown,bid_hours,bid_cost,actual_hours,actual_cost,overbudget,variance"
},
'image': IconWdg("", IconWdg.REPORT_03)
}
reports.append(report_data)
table2 = Table()
inner.add(table2)
示例7: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
#.........这里部分代码省略.........
th.add_style("text-align: left")
th = table.add_header("Login")
th.add_style("text-align: left")
th = table.add_header("First Name")
th.add_style("text-align: left")
th = table.add_header("Last Name")
th.add_style("text-align: left")
th = table.add_header("Display Name")
th.add_style("text-align: left")
th = table.add_header("Activity")
th.add_style("text-align: left")
th = table.add_header("Groups")
th.add_style("text-align: left")
th = table.add_header("Security")
th.add_style("text-align: left")
th = table.add_header("Edit")
th.add_style("text-align: left")
for i, login in enumerate(logins):
tr = table.add_row()
tr.add_class("spt_row")
if not i or not i%2:
tr.add_color("background", "background3")
else:
tr.add_color("background", "background", -2 )
thumb = ThumbWdg()
thumb.set_sobject(login)
thumb.set_icon_size(30)
td = table.add_cell(thumb)
td = table.add_cell(login.get_value("login"))
td.add_style("padding: 3px")
td = table.add_cell(login.get_value("first_name"))
td.add_style("padding: 3px")
td = table.add_cell(login.get_value("last_name"))
td.add_style("padding: 3px")
td = table.add_cell(login.get_value("display_name"))
td.add_style("padding: 3px")
search_key = login.get_search_key()
login_code = login.get_code()
full_name = login.get_full_name()
td = table.add_cell()
button = IconButtonWdg(tip="Activity", icon=IconWdg.CALENDAR)
td.add(button)
button.add_behavior( {
'type': 'click_up',
'login_code': login_code,
'full_name': full_name,
'cbjs_action': '''
var class_name = 'tactic.ui.tools.ScheduleUserToolWdg';
var kwargs = {
login: bvr.login_code
}
var title = bvr.full_name + ' Schedule';
var top = bvr.src_el.getParent(".spt_dashboard_top");
示例8: ShotInfoWdg
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
class ShotInfoWdg(AssetInfoWdg):
'''widget to display the code, name and description in one column'''
def preprocess(self):
self.thumb = ThumbWdg()
self.thumb.set_icon_size('60')
self.thumb.set_sobjects(self.sobjects)
self.thumb.preprocess()
def get_display(self):
if not self.thumb:
self.preprocess()
self.sobject = self.get_current_sobject()
table = Table(css='embed')
table.add_color('color','color')
table.add_style("width: 300px")
table.add_row()
th = table.add_header("<i>Code: </i> <b style='font-size: 1.2em'>%s</b>" % self.sobject.get_code() )
# add status
th.add_style('text-align','left')
status_span = SpanWdg("", css='large')
th.add(status_span)
status = self.sobject.get_value("status")
if status:
status_span.add(self.sobject.get_value("status"))
table.add_row()
self.thumb.set_current_index(self.get_current_index())
thumb_td = table.add_cell(self.thumb)
row_span = 2
if self.sobject.has_value("priority"):
row_span = 3
# add priority
table.add_cell("<i>Priority: </i>")
priority = self.sobject.get_value("priority")
if not priority:
table.add_cell("None")
else:
table.add_cell(self.sobject.get_value("priority") )
# this row should be added only if priority is added
table.add_row()
thumb_td.set_attr('rowspan', row_span)
# add pipeline
table.add_cell("<i>Pipeline: </i>")
status = self.sobject.get_value("pipeline_code")
if not status:
table.add_cell("None")
else:
table.add_cell(self.sobject.get_value("pipeline_code") )
self._add_frame_range(table)
table.add_row()
td = table.add_cell( "<i>Description: </i>")
description = self.sobject.get_value("description")
expand = ExpandableTextWdg()
expand.set_id('asset_info_desc')
expand.set_value( WikiUtil().convert(description) )
expand.set_max_length(300)
td.add(expand)
main_div = DivWdg(table)
if self.get_option("publish") == "false":
return main_div
#self._add_publish_link(main_div)
return main_div
def get_simple_display(self):
sobject = self.get_current_sobject()
code = sobject.get_code()
description = sobject.get_value("description")
status = sobject.get_value("status")
return "%s, %s, %s" % (code, status, description)
def _add_frame_range(self, table):
frame_wdg = FrameRangeWdg()
frame_wdg.set_sobject(self.sobject)
table.add_row()
table.add_cell("<i>Frame Info:</i>")
table.add_cell( frame_wdg )
def _add_publish_link(self, main_div):
publish_link = PublishLinkWdg(self.sobject.get_search_type(), self.sobject.get_id())
#.........这里部分代码省略.........
示例9: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def get_display(my):
web = WebContainer.get_web()
tactic_header = Table()
tactic_header.add_row()
tactic_header.add_color("color", "color2")
# tactic logo and release info
skin = web.get_skin()
src = '/context/skins/' + skin + '/images/tactic_logo.png'
img = HtmlElement.img(src)
img.add_class('hand')
img.add_attr('title', 'Go to home page')
img.add_behavior({'type': 'click_up', 'cbjs_action': "window.location='/tactic/'"})
rel_div = DivWdg()
rel_div.add(" "*3)
rel_div.add("Release: %s" %Environment.get_release_version() )
rel_div.add_style("font-size: 9px")
# Need this to override the above color in add_looks
rel_div.add_color("color", "color2")
tactic_wdg = Table()
tactic_wdg.add_style("width: 180px")
tactic_wdg.add_row()
td = tactic_wdg.add_cell( img )
td.set_style("width:100px")
tactic_wdg.add_row()
td = tactic_wdg.add_cell( rel_div )
td.set_style("text-align: left")
td = tactic_header.add_cell( tactic_wdg )
# add the project thumb and title
project = Project.get()
if my.show_project:
thumb_div = DivWdg()
td = tactic_header.add_cell( thumb_div )
thumb_div.add_style("height: 28px")
thumb_div.add_style("overflow: hidden")
thumb_div.add_border(modifier=-10)
thumb_div.add_style("-moz-border-radius: 3px")
thumb = ThumbWdg()
thumb_div.add(thumb)
thumb.set_sobject(project)
thumb.set_icon_size("45")
td.set_style("vertical-align: top; padding-right:14px;padding-left: 3px")
td = tactic_header.add_cell( project.get_value("title") )
#td.add_looks( "fnt_title_1" )
td.add_style("font-size: 20px")
td.add_style("white-space: nowrap")
td.add_style("padding-left: 14px")
# project selection
td = tactic_header.add_cell()
project_div = DivWdg()
project_div.add_style("margin-top: -5px")
project_div.add(ProjectSelectWdg() )
td.add( project_div )
td.set_style("padding-left: 14px")
# Global Actions Gear Menu (contains links to Documentation) ...
action_bar_btn_dd = PageHeaderGearMenuWdg()
action_div = DivWdg(action_bar_btn_dd)
action_div.add_style("margin-top: -5px")
td = tactic_header.add_cell( action_div )
if PrefSetting.get_value_by_key('subscription_bar') == 'true':
from message_wdg import SubscriptionBarWdg
sub = SubscriptionBarWdg(mode='popup')
tactic_header.add_cell(sub)
# user login
# user
user = Environment.get_login()
full_name = user.get_full_name()
user_div = SpanWdg( HtmlElement.b( "%s " % full_name) , css='hand')
user_div.set_style("padding-right:10px")
# signout
login = Environment.get_security().get_login()
search_key = SearchKey.get_by_sobject(login)
span = SpanWdg()
span.add( user_div )
user_div.add_attr('spt_nudge_menu_vert', '20')
td = tactic_header.add_cell(span)
td.set_style("width:100%; text-align:right; white-space: nowrap")
#.........这里部分代码省略.........
示例10: handle_instance
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def handle_instance(my, table, instance, asset, node_name='', publish=True, allow_ref_checkin=False):
# handle the case where asset is not defined
if not asset:
table.add_row()
table.add_blank_cell()
table.add_blank_cell()
# FIXME: Maya specific
parts = instance.split(":")
instance_name = parts[0]
asset_code = parts[1]
if instance_name == asset_code:
table.add_cell(instance_name)
else:
table.add_cell(instance)
td = table.add_cell()
td.add("< %s node >" % my.session.get_node_type(instance_name))
table.add_blank_cell()
return
# get the pipeline for this asset and handlers for the pipeline
process_name = my.process_select.get_value()
handler_hidden = my.get_handler_input(asset, process_name)
pipeline = Pipeline.get_by_sobject(asset)
# TEST: switch this to using node name instead, if provided
if node_name:
instance_node = my.session.get_node(node_name)
else:
instance_node = my.session.get_node(instance)
if instance_node is None:
return
if Xml.get_attribute(instance_node,"reference") == "true":
is_ref = True
else:
is_ref = False
namespace = Xml.get_attribute(instance_node, "namespace")
if not namespace:
namespace = instance
asset_code = asset.get_code()
is_set = False
if asset.get_value('asset_type', no_exception=True) in ['set','section']:
is_set = True
tr = table.add_row()
if is_set:
tr.add_class("group")
if publish and (allow_ref_checkin or not is_ref):
checkbox = CheckboxWdg("asset_instances")
if is_set:
checkbox = CheckboxWdg("set_instances")
checkbox.set_option("value", "%s|%s|%s" % \
(namespace, asset_code, instance) )
checkbox.set_persist_on_submit()
td = table.add_cell(checkbox)
else:
td = table.add_blank_cell()
# only one will be added even if there are multiple
if handler_hidden:
td.add(handler_hidden)
# add the thumbnail
thumb = ThumbWdg()
thumb.set_name("images")
thumb.set_sobject(asset)
thumb.set_icon_size(60)
table.add_cell(thumb)
info_wdg = Widget()
info_wdg.add(HtmlElement.b(instance))
if not node_name:
node_name = '%s - %s' %(asset_code, asset.get_name())
info_div = DivWdg(node_name)
info_div.add_style('font-size: 0.8em')
info_wdg.add(info_div)
info_div.add(HtmlElement.br(2))
if pipeline:
info_div.add(pipeline.get_code())
table.add_cell(info_wdg)
# by default can't checkin references
if not allow_ref_checkin and is_ref:
#icon = IconWdg("error", IconWdg.ERROR)
#.........这里部分代码省略.........
示例11: get_chat_wdg
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def get_chat_wdg(my, key, interval=False):
div = DivWdg()
div.add_class("spt_chat_session_top")
div.add_color("background", "background")
title_wdg = DivWdg()
div.add(title_wdg)
title_wdg.add_color("background", "background3")
title_wdg.add_style("padding: 5px")
title_wdg.add_style("font-weight: bold")
title_wdg.add_border()
icon = IconButtonWdg(title="Remove Chat", icon=IconWdg.DELETE)
icon.add_style("float: right")
icon.add_style("margin-top: -5px")
title_wdg.add(icon)
icon.add_behavior( {
'type': 'click_up',
'key': key,
'cbjs_action': '''
var server = TacticServerStub.get();
var top = bvr.src_el.getParent(".spt_chat_session_top");
spt.behavior.destroy_element(top);
'''
} )
current_user = Environment.get_user_name()
logins = Search.eval("@SOBJECT(sthpw/subscription['message_code','%s'].sthpw/login)" % key)
for login in logins:
if login.get_value("login") == current_user:
continue
thumb = ThumbWdg()
thumb.set_icon_size(45)
thumb.set_sobject(login)
thumb.add_style("float: left")
thumb.add_style("margin: -5px 10px 0px -5px")
title_wdg.add(thumb)
title_wdg.add(login.get_value("display_name"))
title_wdg.add("<br clear='all'/>")
history_div = DivWdg()
div.add(history_div)
history_div.add_class("spt_chat_history")
history_div.add_style("width: auto")
history_div.add_style("height: auto")
history_div.add_style("max-height: 400px")
history_div.add_style("padding: 5px")
history_div.add_class("spt_resizable")
history_div.add_border()
history_div.add_style("overflow-y: auto")
#history_div.add_style("font-size: 0.9em")
search = Search("sthpw/message_log")
search.add_filter("message_code", key)
search.add_order_by("timestamp")
message_logs = search.get_sobjects()
last_login = None;
last_date = None;
for message_log in message_logs:
login = message_log.get("login")
message = message_log.get("message")
timestamp = message_log.get_datetime_value("timestamp")
#timestamp = timestamp.strftime("%b %d, %Y - %H:%M")
timestamp_str = timestamp.strftime("%H:%M")
date_str = timestamp.strftime("%b %d, %Y")
msg = "";
msg += "<table style='margin-top: 5px; font-size: 0.9em; width: 100%'><tr><td colspan='2'>";
if date_str != last_date:
msg += "<br/><b style='font-size: 1.0em'>"+date_str+"</b><hr/></td></tr>";
msg += "<tr><td>";
last_login = None
if login != last_login:
msg += "<b>"+login+"</b><br/>";
msg += message.replace("\n",'<br/>');
msg += "</td><td style='text-align: right; margin-bottom: 5px; width: 75px; vertical-align: top'>";
msg += timestamp_str;
msg += "</td></tr></table>";
history_div.add(msg)
last_login = login
last_date = date_str
history_div.add_behavior( {
'type': 'load',
'cbjs_action': '''
bvr.src_el.scrollTop = bvr.src_el.scrollHeight;
'''
#.........这里部分代码省略.........
示例12: get_group_wdg
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def get_group_wdg(self, prev_sobj):
if not self.is_preprocessed:
self.preprocess()
sobject = self.get_current_sobject()
ref_sobj = self.get_ref_obj(sobject)
self.current_ref_sobj = ref_sobj
if not ref_sobj:
return "Undetermined parent: [%s]" % SearchKey.get_by_sobject(sobject)
widget = DivWdg()
# add add button
#from tactic.ui.widget import TextBtnWdg, TextBtnSetWdg
#buttons_list = []
#buttons_list.append( {
# 'label': '+', 'tip': 'Add Another Item',
# 'bvr': { 'cbjs_action': "spt.dg_table.add_item_cbk(evt, bvr)" }
#} )
#add_btn = TextBtnSetWdg( float="right", buttons=buttons_list,
# spacing=6, size='small', side_padding=0 )
#widget.add(add_btn)
from tactic.ui.widget import ActionButtonWdg
button = ActionButtonWdg(title='+', tip='Add Another Item', size='small')
widget.add(button)
button.add_style("float: right")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': "spt.dg_table.add_item_cbk(evt, bvr)"
} )
label = "Attach"
label_option = self.get_option("label")
if label_option:
label = label_option
table = Table()
table.add_color("color", "color")
table.add_row()
search_key = sobject.get_search_key()
# add a thumbe widget
thumb = ThumbWdg()
thumb.set_icon_size(40)
thumb.set_sobject(ref_sobj)
thumb.set_option('latest_icon', 'true')
table.add_cell(thumb)
# add the text description
name_span = DivWdg(ref_sobj.get_code())
name_span.add_style('margin-left: 20px')
table.add_cell(name_span)
if ref_sobj.has_value("name"):
name_span.add( " - " )
name_span.add( ref_sobj.get_value("name") )
#status = ref_sobj.get_value("status", no_exception=True)
#if status:
# span = SpanWdg("(status:%s)" % ref_sobj.get_value("status"))
# table.add_cell(span)
if ref_sobj.has_value("description"):
description_wdg = ExpandableTextWdg("description")
description_wdg.set_max_length(200)
description_wdg.set_sobject(ref_sobj)
td = table.add_cell( description_wdg )
td.add_style("padding-left: 15px")
# FIXME: not sure about the layout here
#if ref_sobj.has_value("pipeline_code"):
# pipeline_code = ref_sobj.get_value("pipeline_code")
# span = SpanWdg("(pipeline:%s)" % pipeline_code )
# td = table.add_cell(span)
# td.add_style("padding-left: 15px")
widget.add(table)
return widget
示例13: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def get_display(self):
self.is_refresh = self.kwargs.get('is_refresh') =='true'
if not self.is_refresh:
top = DivWdg(css='spt_view_panel')
self.set_as_panel(top)
else:
top = Widget()
div = DivWdg(css="filter_box")
div.add("<b>Current Session</b>")
top.add(div)
# the button which initiates the introspection
button = IntrospectWdg()
#button.add_style("float", "right")
top.add(button)
top.add("<br clear='all'/>")
session = SessionContents.get()
if not session:
widget.add("<h3>No contents in session</h3>")
return widget
table = Table()
table.add_class("table")
table.add_style("width: 100%")
table.add_row()
table.add_header(" ")
table.add_header("Type")
table.add_header("Asset")
table.add_header("Node Name")
table.add_header("Node Type")
table.add_header("Reference")
table.add_header("Session")
table.add_header("Latest")
node_names = session.get_node_names()
for node_name in node_names:
table.add_row()
# snapshot_code
snapshot_code = session.get_snapshot_code(node_name, "shot")
if not snapshot_code:
snapshot_code = session.get_snapshot_code(node_name, "anim")
if not snapshot_code:
snapshot_code = session.get_snapshot_code(node_name, "asset")
snapshot = Snapshot.get_by_code(snapshot_code)
sobject = None
if snapshot:
sobject = snapshot.get_sobject()
base = sobject.get_search_type_obj().get_base_search_type()
thumb = ThumbWdg()
thumb.set_icon_size(60)
# FIXME: make this more automatic
if base == "prod/shot_instance":
thumb_sobj = sobject.get_parent("prod/asset")
thumb.set_sobject(thumb_sobj)
else:
thumb.set_sobject(sobject)
table.add_cell(thumb)
title = sobject.get_search_type_obj().get_title()
table.add_cell( title )
# TODO: this should be more automatic!
if base == "prod/shot_instance":
asset_code = sobject.get_value("asset_code")
shot_code = sobject.get_value("shot_code")
name = sobject.get_value("name")
table.add_cell("%s: %s in %s" % (name,asset_code,shot_code))
else:
code = sobject.get_code()
name = sobject.get_name()
if code == name:
table.add_cell( "%s" % (code) )
else:
table.add_cell( "%s - %s" % (code, name) )
else:
table.add_cell("<i>No snapshot</i>")
table.add_cell("---")
table.add_cell("---")
# display the node name
table.add_cell(node_name)
# display node type
table.add_cell( session.get_node_type(node_name) )
#.........这里部分代码省略.........
示例14: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
#.........这里部分代码省略.........
items_div.add("%s item/s" % count)
title_div.add(search_type_sobj.get_title())
description_div = DivWdg()
description_div.add(description)
description_div.add_style("padding: 5px")
if not description:
description_div.add("<br/>(No description)")
description_div.add_style("font-style: italic")
description_div.add_style("opacity: 0.3")
report_data = {
'title': search_type_sobj.get_title(),
'title_wdg': title_div,
'class_name': 'tactic.ui.panel.ViewPanelWdg',
'kwargs': {
'search_type': search_type,
'view': 'table',
'simple_search_view': 'simple_search'
},
'description': description_div,
'search_type': search_type_sobj
}
reports.append(report_data)
# create a bunch of panels
list_div = DivWdg()
top.add(list_div)
list_div.add_class("spt_reports_list")
table = Table()
list_div.add(table)
table.add_color("color", "color")
table.add_style("margin-bottom: 5px")
table.center()
top.add("<br clear='all'/>")
for i, report in enumerate(reports):
if i == 0 or i%4 == 0:
tr = table.add_row()
td = table.add_cell()
td.add_style("vertical-align: top")
td.add_style("padding: 3px")
class_name = report.get("class_name")
kwargs = report.get("kwargs")
title = report.get("title")
description = report.get("description")
#image = "<img src='/context/images/getting_started_schema.png'/>"
image = "<img src='/context/images/getting_started_pipeline.png'/>"
thumb_div = DivWdg()
image = thumb_div
thumb_div.add_border()
thumb_div.set_box_shadow("1px 1px 1px 1px")
thumb = ThumbWdg()
thumb_div.add(thumb)
thumb.set_sobject(report.get("search_type"))
thumb.set_icon_size(60)
behavior = {
'type': 'click_up',
'title': title,
'class_name': class_name,
'kwargs': kwargs,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_reports_top");
//spt.tab.set_main_body_tab();
spt.tab.set_tab_top(top);
var kwargs = {};
spt.tab.add_new(bvr.title, bvr.title, bvr.class_name, bvr.kwargs);
'''
}
title_wdg = report.get("title_wdg")
schema_wdg = self.get_section_wdg(title_wdg, description, image, behavior)
td.add(schema_wdg)
from tactic.ui.container import TabWdg
tab = TabWdg(show_add=False)
top.add(tab)
return top
示例15: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import set_icon_size [as 别名]
def get_display(my):
top = my.top
login = my.kwargs.get("login")
if not login or login == "$LOGIN":
login = Environment.get_user_name()
login_sobj = Login.get_by_code(login)
# top.add_style("margin-top: -2px")
# top.add_style("margin-left: -2px")
thumb_div = DivWdg()
thumb_div.add_style("float: left")
thumb_div.add_style("margin-right: 5px")
thumb_div.add_style("margin-bottom: 5px")
thumb_div.add_style("padding-top: 1px")
thumb = ThumbWdg()
thumb.set_sobject(login_sobj)
thumb_div.add(thumb)
thumb.set_icon_size(90)
thumb.set_aspect("height")
full_name = login_sobj.get_full_name()
info_wdg = DivWdg()
top.add(info_wdg)
name_wdg = DivWdg()
info_wdg.add(thumb_div)
info_wdg.add(name_wdg)
name_wdg.add(" " * 3)
name_wdg.add(full_name)
name_wdg.add_style("font-size: 1.5em")
name_wdg.add_style("font-weight: bold")
name_wdg.add_style("padding: 5px")
# name_wdg.add_style("margin-left: -10px")
name_wdg.add_color("background", "background3")
name_wdg.add_style("height: 20px")
name_wdg.add_style("margin-bottom: 0px")
name_wdg.add_border()
info_wdg.add("<br/>")
from tactic.ui.container import TabWdg
# return if the supplied tab view has a config xml
if my.tab_view:
search = Search("config/widget_config")
search.add_filter("category", "TabWdg")
search.add_filter("view", my.tab_view)
config_sobj = search.get_sobject()
if config_sobj:
config_xml = config_sobj.get_value("config")
# replace the variable $login with the login clicked
if login:
config_xml = config_xml.replace("$login", login)
tab = TabWdg(config_xml=config_xml, view=my.tab_view, show_add=False, show_remove=False)
top.add(tab)
return top
config_xml = []
config_xml.append("<config>")
config_xml.append("<tab>")
config_xml.append(
"""
<element name='activity'>
<display class='tactic.ui.widget.ActivityCalendarWdg'>
<login>%s</login>
<cell_width>100px</cell_width>
<cell_height>50px</cell_height>
<show_header>true</show_header>
<show_border>false</show_border>
</display>
</element>
"""
% login
)
config_xml.append(
"""
<element name='schedule'>
<display class='tactic.ui.widget.TaskCalendarWdg'>
<assigned>%s</assigned>
<sobject_display_expr>%s</sobject_display_expr>
<show_header>true</show_header>
<show_border>false</show_border>
</display>
</element>
"""
% (login, my.sobject_display_expr)
)
config_xml.append(
"""
<element name='tasks'>
<display class='tactic.ui.panel.FastTableLayoutWdg'>
<search_type>sthpw/task</search_type>
#.........这里部分代码省略.........