本文整理汇总了Python中tactic.ui.widget.IconButtonWdg类的典型用法代码示例。如果您正苦于以下问题:Python IconButtonWdg类的具体用法?Python IconButtonWdg怎么用?Python IconButtonWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IconButtonWdg类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_display
def get_display(my):
top = my.top
if not HelpWdg.exists():
return top
alias = my.kwargs.get("alias")
description = my.kwargs.get("description")
if not description:
description = "Show Help"
if my.kwargs.get("use_icon"):
#help_button = SingleButtonWdg(title='Help', icon=IconWdg.HELP_BUTTON, show_arrow=False)
help_button = IconButtonWdg(title='Help', icon=IconWdg.HELP_BUTTON, show_arrow=False)
else:
help_button = ActionButtonWdg(title="?", tip=description, size='small')
top.add(help_button)
if not my.cbjs_action:
my.cbjs_action = '''
spt.help.set_top();
spt.help.load_alias(bvr.alias);
'''
help_button.add_behavior( {
'type': 'click_up',
'alias': alias,
'cbjs_action': my.cbjs_action
} )
return top
开发者ID:pombredanne,项目名称:TACTIC,代码行数:33,代码来源:help_wdg.py
示例2: get_section_wdg
def get_section_wdg(my, title, description, image, behavior):
section_wdg = DivWdg()
section_wdg.set_round_corners()
section_wdg.add_border()
section_wdg.add_class("spt_report_top")
section_wdg.add_style("width: 200px")
section_wdg.add_style("height: 100px")
section_wdg.add_style("overflow: hidden")
section_wdg.add_style("margin: 10px")
section_wdg.set_box_shadow("0px 0px 10px")
title_wdg = DivWdg()
section_wdg.add(title_wdg)
title_wdg.add(title)
title_wdg.add_style("height: 20px")
title_wdg.add_style("padding: 3px")
title_wdg.add_style("margin-top: 3px")
title_wdg.add_style("font-weight: bold")
title_wdg.add_gradient("background", "background")
button = IconButtonWdg(title="Options", icon=IconWdg.ARROWHEAD_DARK_DOWN)
title_wdg.add(button)
button.add_style("float: right")
# set up menus
menu = my.get_menu()
SmartMenu.add_smart_menu_set( button, { 'MENU_ITEM': menu } )
SmartMenu.assign_as_local_activator( button, "MENU_ITEM", True )
section_wdg.add_color("background", "background")
#section_wdg.add_gradient("background", "background", 0, -3)
section_wdg.add_behavior( {
'type': 'hover',
'add_color_modifier': -5,
'cb_set_prefix': 'spt.mouse.table_layout_hover',
} )
desc_div = DivWdg()
desc_div.add(description)
desc_div.add_style("padding: 5px 10px 10px 5px")
div = DivWdg()
section_wdg.add(div)
div.add_style("padding: 3px")
div.add_style("margin: 5px")
div.add_style("width: 65px")
div.add_style("height: 50px")
div.add_style("float: left")
div.add(image)
section_wdg.add(desc_div)
div.add_style("overflow: hidden")
section_wdg.add_behavior( behavior )
section_wdg.add_class("hand")
return section_wdg
开发者ID:0-T-0,项目名称:TACTIC,代码行数:60,代码来源:reports_wdg.py
示例3: get_display
def get_display(my):
sobject = my.get_current_sobject()
my.search_key = SearchKey.get_by_sobject(sobject)
div = DivWdg()
div.add_class("hand")
title = "Show Item Details"
if my.widget:
widget = my.widget
else:
widget = IconButtonWdg(title=title, icon=IconWdg.ZOOM)
code = sobject.get_code()
name = sobject.get_value("name", no_exception=True)
if not name:
name = code
widget.add_behavior( {
'type': 'click_up',
'search_key': my.search_key,
'code': code,
'name': name,
'cbjs_action': '''
spt.tab.set_main_body_tab();
var class_name = 'tactic.ui.tools.TaskDetailPanelWdg';
var kwargs = {
search_key: bvr.search_key,
};
var mode = '';
var layout = bvr.src_el.getParent(".spt_tool_top");
if (layout != null) {
mode = 'tool'
}
if (mode == 'tool') {
spt.app_busy.show("Loading ...");
var layout = bvr.src_el.getParent(".spt_tool_top");
var element = layout.getElement(".spt_tool_content");
spt.panel.load(element, class_name, kwargs);
spt.app_busy.hide();
}
else {
var element_name = "detail_"+bvr.code;
var title = "Detail ["+bvr.name+"]";
spt.tab.add_new(element_name, title, class_name, kwargs);
}
'''
} )
div.add(widget)
return div
开发者ID:pombredanne,项目名称:TACTIC,代码行数:59,代码来源:sobject_detail_wdg.py
示例4: get_category_wdg
def get_category_wdg(my, category, mode="new"):
subscriptions = my.get_subscriptions(category, mode)
if not subscriptions:
return
div = DivWdg()
div.add_style("width: 100%")
title_div = DivWdg()
div.add(title_div)
title_div.add_style("padding: 10px")
title_div.add_border()
title_div.add_color("background", "background3")
title = category or "Subscriptions"
title_div.add("%s " % title)
summary_div = SpanWdg()
title_div.add(summary_div)
summary_div.add_style("font-size: 0.8em")
summary_div.add_style("opacity: 0.5")
search_keys = [x.get_search_key() for x in subscriptions]
button = ActionButtonWdg(title="Clear All")
div.add(button)
button.add_behavior( {
'type': 'click_up',
'search_keys': search_keys,
'cbjs_action': '''
var server = TacticServerStub.get();
for (var i = 0; i < bvr.search_keys.length; i++) {
var search_key = bvr.search_keys[i];
server.update(search_key, {'last_cleared':'NOW'});
spt.panel.refresh(bvr.src_el);
}
'''
} )
# types of subscriptions
table = Table()
table.add_style('width: 100%')
table.add_border()
table.add_color("background", "background3")
div.add(table)
ss = []
for subscription in subscriptions:
table.add_row()
td = table.add_cell()
message_code = subscription.get_value("message_code")
search = Search("sthpw/message")
search.add_filter("code", message_code)
message = search.get_sobject()
# show the thumb
if not message:
if mode == "all":
td = table.add_cell(FormatMessageWdg.get_preview_wdg(subscription))
td = table.add_cell()
td.add("No Messages")
continue
size = 60
msg_element = FormatMessageWdg(subscription=subscription, short_format='true')
# this is optional
msg_element.set_sobject(message)
description = msg_element.get_buffer_display()
#td = table.add_cell()
history_icon = IconButtonWdg(title="Subscription History", icon=IconWdg.HISTORY)
#td.add(icon)
message_code = subscription.get_value("message_code")
history_icon.add_behavior( {
'type': 'click_up',
'message_code': message_code,
'cbjs_action': '''
var class_name = 'tactic.ui.panel.FastTableLayoutWdg';
var message_code = bvr.message_code;
var kwargs = {
search_type: 'sthpw/message_log',
show_shelf: false,
expression: "@SOBJECT(sthpw/message_log['message_code','"+message_code+"'])",
view: 'history'
};
spt.tab.set_main_body_tab();
spt.tab.add_new("Message History", "Message History", class_name, kwargs);
'''
} )
#.........这里部分代码省略.........
开发者ID:hellios78,项目名称:TACTIC,代码行数:101,代码来源:message_wdg.py
示例5: get_display
def get_display(my):
top = DivWdg()
top.add_border()
top.add_style("padding: 10px")
top.add_color("color", "color")
top.add_gradient("background", "background", 0, -5)
#top.add_style("height: 550px")
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|hide", {} );
'''
} )
project = Project.get()
title = TitleWdg(title='Client Home')
top.add(title)
shelf = DivWdg()
top.add(shelf)
shelf.add_style("margin-left: -8px")
shelf.add_style("width: 130px")
security = Environment.get_security()
view_side_bar = security.check_access("builtin", "view_side_bar", "allow", default='allow')
if view_side_bar:
button_div = DivWdg()
shelf.add(button_div)
button_div.add_style("float: left")
button_div.add_style("margin-top: -3px")
button = IconButtonWdg(title="Side Bar", icon=IconWdg.ARROW_LEFT)
button_div.add(button)
shelf.add("Toggle Side Bar")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|toggle");
'''
} )
shelf.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|toggle");
'''
} )
shelf.add_class("hand")
else:
shelf.add(" ")
search_wdg = DivWdg()
search_wdg.add_class("spt_main_top")
top.add(search_wdg)
search_wdg.add_style("padding: 10px")
search_wdg.add_style("margin: 10px auto")
search_wdg.add_style("width: 430px")
search_wdg.add("Search: ")
search_wdg.add(" "*3)
custom_cbk = {}
custom_cbk['enter'] = '''
var top = bvr.src_el.getParent(".spt_main_top");
var search_el = top.getElement(".spt_main_search");
var keywords = search_el.value;
if (keywords != '') {
var class_name = 'tactic.ui.panel.ViewPanelWdg';
var kwargs = {
'search_type': 'sthpw/sobject_list',
'view': 'table',
'keywords': keywords,
'simple_search_view': 'simple_search',
//'show_shelf': false,
}
spt.tab.set_main_body_tab();
spt.tab.add_new("Search Results", "Search Results", class_name, kwargs);
}
'''
from tactic.ui.input import TextInputWdg, LookAheadTextInputWdg
#text = TextInputWdg(name="search")
text = LookAheadTextInputWdg(name="search", custom_cbk=custom_cbk)
#text = TextWdg("search")
text.add_class("spt_main_search")
text.add_style("width: 290px")
search_wdg.add(text)
search_wdg.add_style("font-weight: bold")
search_wdg.add_style("font-size: 16px")
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:101,代码来源:client_wdg.py
示例6: get_display
def get_display(my):
top = DivWdg()
top.add_border()
top.add_style("padding: 10px")
top.add_color("color", "color")
top.add_gradient("background", "background", 0, -5)
#top.add_style("height: 550px")
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|hide_now", {} );
'''
} )
project = Project.get()
title = DivWdg()
title.add("Project Startup and Configuration")
title.add_style("font-size: 18px")
title.add_style("font-weight: bold")
title.add_style("text-align: center")
title.add_style("padding: 10px")
title.add_style("margin: -10px -10px 10px -10px")
top.add(title)
title.add_gradient("background", "background3", 5, -10)
shelf = DivWdg()
top.add(shelf)
shelf.add_style("margin-left: -8px")
shelf.add_style("width: 130px")
button_div = DivWdg()
shelf.add(button_div)
button_div.add_style("float: left")
button_div.add_style("margin-top: -3px")
security = Environment.get_security()
view_side_bar = security.check_access("builtin", "view_side_bar", "allow", default='allow')
if view_side_bar:
button = IconButtonWdg(title="Side Bar", icon=IconWdg.ARROW_LEFT)
button_div.add(button)
shelf.add("Toggle Side Bar")
shelf.add_attr("title", "Toggle Side Bar (or press '1')")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|toggle");
'''
} )
shelf.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|toggle");
'''
} )
shelf.add_class("hand")
else:
shelf.add(" ")
search_wdg = Table()
top.add(search_wdg)
search_wdg.add_row()
search_wdg.add_class("spt_main_top")
search_wdg.add_style("padding: 10px")
search_wdg.add_style("margin: 20px auto")
search_wdg.add_style("width: 430px")
td = search_wdg.add_cell("Search: ")
td.add_style("vertical-align: top")
td.add_style("padding-top: 8px")
custom_cbk = {}
custom_cbk['enter'] = '''
var top = bvr.src_el.getParent(".spt_main_top");
var search_el = top.getElement(".spt_main_search");
var keywords = search_el.value;
if (keywords != '') {
var class_name = 'tactic.ui.panel.ViewPanelWdg';
var kwargs = {
'search_type': 'sthpw/sobject_list',
'view': 'result_list',
'keywords': keywords,
'simple_search_view': 'simple_filter',
//'show_shelf': false,
}
spt.tab.set_main_body_tab();
spt.tab.add_new("Search Results", "Search Results", class_name, kwargs);
}
'''
from tactic.ui.input import TextInputWdg, LookAheadTextInputWdg
#.........这里部分代码省略.........
开发者ID:asmboom,项目名称:TACTIC,代码行数:101,代码来源:main_wdg.py
示例7: get_display
#.........这里部分代码省略.........
var top = bvr.src_el.getParent(".spt_changelist_content");
top.setAttribute("spt_changelist", changelist);
spt.app_busy.show("Loading Changelists Information");
spt.changelist.load(bvr.src_el, changelist);
spt.app_busy.hide();
'''
} )
for c in changelists:
num_items = len(c.get("info"))
name = c.get("change")
tr = table.add_row()
tr.add_class("spt_changelist_item")
radio = RadioWdg("changelist")
radio.add_class("spt_changelist_radio")
table.add_cell(radio)
radio.set_option("value", name)
if name == changelist:
radio.set_checked()
table.add_cell(name)
table.add_cell(c.get("desc"))
table.add_cell(num_items)
table.add_cell(c.get("status"))
if num_items:
icon = IconButtonWdg(title="View", icon=IconWdg.ZOOM)
icon.add_behavior( {
'type': 'click_up',
'changelist': c.get("change"),
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_changelist_content");
top.setAttribute("spt_changelist", bvr.changelist);
spt.app_busy.show("Loading Changelist");
spt.changelist.load(bvr.src_el, bvr.changelist);
spt.app_busy.hide();
'''
} )
else:
icon = ''
table.add_cell(icon)
if not num_items and name != 'default':
icon = IconButtonWdg(title="Delete Changelist", icon=IconWdg.DELETE)
else:
icon = ""
table.add_cell(icon)
inner.add("<hr/>")
files = my.kwargs.get("files")
开发者ID:0-T-0,项目名称:TACTIC,代码行数:67,代码来源:changelist_wdg.py
示例8: get_display
def get_display(self):
self.doc_mode = self.kwargs.get("doc_mode")
path = self.kwargs.get("path")
self.search_type = self.kwargs.get("search_type")
self.last_path = None
doc_key = self.kwargs.get("doc_key")
if doc_key:
self.doc = Search.get_by_search_key(doc_key)
snapshot = Snapshot.get_latest_by_sobject(self.doc)
if snapshot:
self.last_path = snapshot.get_lib_path_by_type('main')
path = self.doc.get_value("link")
# TEST TEST TEST
if not path:
#path = "/home/apache/pdf/mongodb.txt"
#path = "/home/apache/assets/google_docs.html"
#path = "/home/apache/pdf/star_wars.txt"
path = "https://docs.google.com/document/d/1AC_YR8X8wbKsshkJ1h8EjZuFIr41guvqXq3_PXgaqJ0/pub?embedded=true"
path = "https://docs.google.com/document/d/1WPUmXYoSkR2cz0NcyM2vqQYO6OGZW8BAiDL31YEj--M/pub"
#path = "https://docs.google.com/spreadsheet/pub?key=0Al0xl-XktnaNdExraEE4QkxVQXhaOFh1SHIxZmZMQ0E&single=true&gid=0&output=html"
path = "/home/apache/tactic/doc/alias.json"
if not self.search_type:
self.search_type = "test3/shot"
self.column = "description"
top = self.top
top.add_class("spt_document_top")
self.set_as_panel(top)
#table = Table()
table = ResizableTableWdg()
top.add(table)
table.add_row()
table.set_max_width()
left_td = table.add_cell()
left_td.add_style("vertical-align: top")
title = DivWdg()
left_td.add(title)
title.add_style("padding: 10px")
title.add_color("background", "background3")
button = IconButtonWdg(title="Refresh", icon=IconWdg.REFRESH)
title.add(button)
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.app_busy.show("Reloading Document");
var top = bvr.src_el.getParent(".spt_document_top");
spt.panel.refresh(top);
spt.app_busy.hide();
'''
} )
button.add_style("float: left")
button = IconButtonWdg(title="Save", icon=IconWdg.SAVE)
title.add(button)
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
'''
} )
button.add_style("float: left")
if not self.doc_mode:
self.doc_mode = "text"
select = SelectWdg("doc_mode")
select.set_option("values", "text|formatted")
title.add(select)
select.set_value(self.doc_mode)
select.add_behavior( {
'type': 'change',
'cbjs_action': '''
spt.app_busy.show("Reloading Document");
var top = bvr.src_el.getParent(".spt_document_top");
var value = bvr.src_el.value;
top.setAttribute("spt_doc_mode", value);
spt.panel.refresh(top);
spt.app_busy.hide();
'''
} )
title.add("<br clear='all'/>")
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:101,代码来源:doc_tool_wdg.py
示例9: get_display
#.........这里部分代码省略.........
td.add(text)
text.set_value( self.get_value("filter") )
text.add_style("width: 400px")
text.add_style("padding: 2px")
text.add_style("-moz-border-radius: 5px")
tr = table.add_row()
td = table.add_cell()
td.add("Ignore: ")
td = table.add_cell()
text = TextWdg("ignore")
td.add(text)
text.set_value( self.get_value("ignore") )
text.set_value(ignore)
text.add_style("width: 400px")
text.add_style("padding: 2px")
text.add_style("-moz-border-radius: 5px")
table.add_row()
td = table.add_cell()
td.add("Validation script: ")
td.add_style("vertical-align: top")
td.add_style("padding-top: 5px")
td = table.add_cell()
text = TextInputWdg(name="validation_script")
text.set_value( self.get_value("validation_script") )
text.add_style("width: 400px")
td.add(text)
icon = IconButtonWdg(title='Edit Validation Script', icon=IconWdg.EDIT)
icon.add_style("float: right")
td.add(icon)
icon.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.named_events.fire_event("show_script_editor");
var top = bvr.src_el.getParent(".spt_ingestion_top");
var values = spt.api.Utility.get_input_values(top, null, false);
var kwargs = {
script_path: values.validation_script
}
setTimeout( function() {
spt.js_edit.display_script_cbk(evt, kwargs)
}, 500 );
'''
} )
table.close_tbody()
# add the script path
tbody = table.add_tbody()
tbody.add_class("spt_scan_script")
if scan_type != 'script':
tbody.add_style("display: none")
开发者ID:mincau,项目名称:TACTIC,代码行数:65,代码来源:ingestion_wdg.py
示例10: get_display
def get_display(my):
sobject = my.get_current_sobject()
use_parent = my.get_option("use_parent")
use_parent = use_parent in ["true", True]
# if use_parent in ['true', True]:
# sobject = sobject.get_parent()
# if not sobject:
# return DivWdg()
my.search_key = SearchKey.get_by_sobject(sobject)
div = DivWdg()
div.add_class("hand")
div.add_style("width: 26px")
div.add_style("margin-left: auto")
div.add_style("margin-right: auto")
target_id = "main_body"
title = "Show Item Details"
if my.widget:
widget = my.widget
else:
widget = IconButtonWdg(title=title, icon="BS_SEARCH")
code = sobject.get_code()
name = sobject.get_value("name", no_exception=True)
if not name:
name = code
tab_element_names = my.kwargs.get("tab_element_names") or ""
detail_view = my.kwargs.get("detail_view") or ""
widget.add_behavior(
{
"type": "click_up",
"search_key": my.search_key,
"use_parent": use_parent,
"tab_element_names": tab_element_names,
"detail_view": detail_view,
"show_task_process": my.show_task_process,
"code": code,
"name": name,
"cbjs_action": """
spt.tab.set_main_body_tab();
var class_name = 'tactic.ui.tools.SObjectDetailWdg';
var kwargs = {
search_key: bvr.search_key,
use_parent: bvr.use_parent,
tab_element_names: bvr.tab_element_names,
show_task_process: bvr.show_task_process,
detail_view: bvr.detail_view
};
var mode = '';
var layout = bvr.src_el.getParent(".spt_tool_top");
if (layout != null) {
mode = 'tool'
}
if (mode == 'tool') {
spt.app_busy.show("Loading ...");
var layout = bvr.src_el.getParent(".spt_tool_top");
var element = layout.getElement(".spt_tool_content");
spt.panel.load(element, class_name, kwargs);
spt.app_busy.hide();
}
else {
var element_name = "detail_"+bvr.code;
var title = "Detail ["+bvr.name+"]";
spt.tab.add_new(element_name, title, class_name, kwargs);
}
""",
}
)
# link_wdg = my.get_link_wdg(target_id, title, widget)
# div.add( link_wdg )
div.add(widget)
return div
开发者ID:yes7rose,项目名称:TACTIC,代码行数:83,代码来源:sobject_detail_wdg.py
示例11: get_display
#.........这里部分代码省略.........
'bvr_match_class': 'spt_branch_item',
'bgcolor': bgcolor,
'cbjs_action': '''
bvr.src_el.setStyle("background-color", bvr.bgcolor);
'''
} )
table.add_relay_behavior( {
'type': 'mouseout',
'bvr_match_class': 'spt_branch_item',
'cbjs_action': '''
bvr.src_el.setStyle("background-color", '');
'''
} )
table.add_relay_behavior( {
'type': 'mouseup',
'bvr_match_class': "spt_branch_radio",
'cbjs_action': '''
var value = bvr.src_el.value;
spt.app_busy.show("Setting current branch to " + value);
var server = TacticServerStub.get();
server.set_widget_setting("current_branch", value);
var top = bvr.src_el.getParent(".spt_checkin_top");
top.removeAttribute("spt_sandbox_dir");
spt.panel.refresh(top);
spt.app_busy.hide();
'''
} )
for c in branches:
name = c.get("branch")
tr = table.add_row()
tr.add_class("spt_branch_item")
radio = RadioWdg("branch")
radio.add_class("spt_branch_radio")
table.add_cell(radio)
radio.set_option("value", name)
if name == branch:
radio.set_checked()
table.add_cell(name)
table.add_cell(c.get("Options"))
table.add_cell(c.get("Owner"))
icon = IconButtonWdg(title="Check-out", icon=IconWdg.CHECK_OUT_SM)
table.add_cell(icon)
icon.add_behavior( {
'type': 'click_up',
'branch': c.get("branch"),
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_branch_content");
top.setAttribute("spt_brange", bvr.branch);
spt.app_busy.show("Checking out branch ["+bvr.branch+"]");
spt.scm.checkout("new_project/"+bvr.branch);
spt.app_busy.hide();
'''
} )
inner.add("<hr/>")
if my.kwargs.get("branches") == None:
inner.add_behavior( {
'type': 'load',
'location': location,
'sync_dir': sync_dir,
'cbjs_action': '''
spt.branch = {}
spt.branch.load = function(el) {
var branches = spt.scm.run("get_branches",[]);
var class_name = 'tactic.ui.checkin.branch_wdg.BranchWdg';
var kwargs = {
branches: branches,
}
var top = el.getParent(".spt_branch_content");
spt.panel.load(top, class_name, kwargs);
}
spt.branch.load(bvr.src_el);
''' } )
return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:101,代码来源:branch_wdg.py
示例12: get_display
def get_display(my):
sobject = my.get_current_sobject()
use_parent = my.get_option("use_parent")
use_parent = use_parent in ['true', True]
#if use_parent in ['true', True]:
# sobject = sobject.get_parent()
# if not sobject:
# return DivWdg()
my.search_key = SearchKey.get_by_sobject(sobject)
div = DivWdg()
div.add_class("hand")
target_id = "main_body"
mode = my.get_option("mode")
#mode = "link"
title = "Show Item Details"
if my.widget:
widget = my.widget
elif mode == "link":
widget = HtmlElement.href()
column = my.get_option("link_column")
if not column:
column = "code"
widget.add( sobject.get_value(column) )
widget.add_style('text-decoration: underline')
else:
#widget = IconButtonWdg(title=title, icon=IconWdg.ZOOM)
widget = IconButtonWdg(title=title, icon="BS_SEARCH")
div.add_style("width: 26px")
div.add_style("margin-left: auto")
div.add_style("margin-right: auto")
code = sobject.get_code()
name = sobject.get_value("name", no_exception=True)
if not name:
name = code
search_type_obj = sobject.get_search_type_obj()
title = search_type_obj.get_title()
if not title:
title = "Detail"
title = _(title)
tab_element_names = my.kwargs.get("tab_element_names") or ""
detail_view = my.kwargs.get("detail_view") or ""
widget.add_behavior( {
'type': 'click_up',
'search_key': my.search_key,
'use_parent': use_parent,
'tab_element_names': tab_element_names,
'detail_view': detail_view,
'show_task_process': my.show_task_process,
'code': code,
'name': name,
'label': title,
'cbjs_action': '''
spt.tab.set_main_body_tab();
var class_name = 'tactic.ui.tools.SObjectDetailWdg';
var kwargs = {
search_key: bvr.search_key,
use_parent: bvr.use_parent,
tab_element_names: bvr.tab_element_names,
show_task_process: bvr.show_task_process,
detail_view: bvr.detail_view
};
var mode = '';
var layout = bvr.src_el.getParent(".spt_tool_top");
if (layout != null) {
mode = 'tool'
}
if (mode == 'tool') {
spt.app_busy.show("Loading ...");
var layout = bvr.src_el.getParent(".spt_tool_top");
var element = layout.getElement(".spt_tool_content");
spt.panel.load(element, class_name, kwargs);
spt.app_busy.hide();
}
else {
var element_name = "detail_"+bvr.code;
var title = bvr.label + " ["+bvr.name+"]";
spt.tab.add_new(element_name, title, class_name, kwargs);
}
'''
} )
#link_wdg = my.get_link_wdg(target_id, title, widget)
#div.add( link_wdg )
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:101,代码来源:sobject_detail_wdg.py
示例13: get_collection_wdg
def get_collection_wdg(my):
div = DivWdg()
div.add_style("margin: 15px 0px")
title_div = DivWdg("Collection Manager")
div.add(title_div)
div.add_class("spt_collection_left")
title_div.add_style("font-size: 1.2em")
title_div.add_style("font-weight: bold")
div.add("<hr/>")
# Shelf
shelf_div = DivWdg()
div.add(shelf_div)
shelf_div.add_style("float: right")
shelf_div.add_style("margin-bottom: 15px")
#button = IconButtonWdg(title='Delete Selected Collection', icon="BS_TRASH")
#shelf_div.add(button)
#button.add_style("display: inline-block")
#button.add_style("width: auto")
button = IconButtonWdg(title='Add New Collection', icon="BS_PLUS")
shelf_div.add(button)
button.add_style("display: inline-block")
button.add_style("vertical-align: top")
insert_view = "edit_collection"
button.add_behavior( {
'type': 'click_up',
'insert_view': insert_view,
'search_type': my.search_type,
'cbjs_action': '''
kwargs = {
search_type: bvr.search_type,
mode: 'insert',
view: bvr.insert_view,
save_event: bvr.event_name,
show_header: false,
num_columns: 2,
default: {
_is_collection: true
}
};
var popup = spt.panel.load_popup('Add New Collection', 'tactic.ui.panel.EditWdg', kwargs);
'''
} )
text_div = DivWdg()
shelf_div.add(text_div)
custom_cbk = {}
custom_cbk['enter'] = '''
var top = bvr.src_el.getParent(".spt_collection_left");
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";
}
}
'''
filters = []
filters.append(("_is_collection",True))
filters.append(("status","Verified"))
text = LookAheadTextInputWdg(
search_type = "workflow/asset",
column="name",
width="100%",
height="30px",
hint_text="Enter terms to filter collections...",
value_column="name",
filters=filters,
custom_cbk=custom_cbk,
is_collection=True
)
text.add_class("spt_main_search")
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:101,代码来源:collection_wdg.py
示例14: get_display
def get_display(my):
top = my.top
top.add_class("spt_switcher_top")
'''
This supports supports two menu definitions:
menu - specifies a view for SideBarWdg which will be ingected as menu
config_xml - specifies menu entries. For example:
<display class="tactic.ui.widget.LayoutSwitcherWdg">
<!-- config_xml -->
<config>
<!-- Menu item 1 -->
<element name="my_tasks_default" title="My Tasks">
<display class="tactic.ui.panel.ViewPanelWdg">
<search_type>sthpw/task</search_type>
<show_shelf>false</show_shelf>
<view>my_tasks_default</view>
<target>spt_my_tasks_table_top</target>
</display>
</element>
<!-- Menu item 2 -->
<element ... >
<display ... >
<target ... />
</display>
</element>
</config>
</display>
target - specifies target div to load views when using "menu" kwarg
use_href - updates address bar hash (this is TODO)
'''
menu = my.kwargs.get("menu")
config_xml = my.kwargs.get("config_xml")
target = my.kwargs.get("target")
# TODO: use_href to go to specific layout switcher view
# use_href = my.kwrags.get("use_href")
# Layout switcher button displays menu and assumes right hand position of screen
activator = IconButtonWdg( name="Layout Switcher", icon="BS_TH_LIST")
top.add(activator)
activator.add_class("spt_switcher_activator")
activator.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var activator = bvr.src_el;
var top = activator.getParent(".spt_switcher_top");
var menu = top.getElement(".spt_switcher_menu");
if (top.hasClass("spt_selected")) {
top.removeClass("spt_selected");
menu.setStyle("display", "none");
} else {
top.addClass("spt_selected");
menu.setStyle("display", "");
var pos = activator.getPosition();
var button_size = activator.getSize();
var menu_size = menu.getSize();
var offset = {
x: button_size.x - menu_size.x,
y: button_size.y
}
menu.position({position: 'upperleft', relativeTo: activator, offset: offset});
var pointer = menu.getElement(".spt_popup_pointer");
pointer.setStyle("margin-left", menu_size.x - button_size.x);
}
'''
} )
# menu_wdg
menu_wdg = DivWdg()
top.add(menu_wdg)
menu_wdg.add_class("spt_switcher_menu")
menu_wdg.add_style("display: none")
menu_wdg.add_style("margin-top", "15px")
menu_wdg.add_style("position", "absolute")
menu_wdg.add_style("z-index", "10")
menu_wdg.add_behavior( {
'type': 'mouseleave',
'cbjs_action': '''
var menu = bvr.src_el;
var top = menu.getParent(".spt_switcher_top");
top.removeClass("spt_selected");
menu.setStyle("display", "none")
'''
} )
# Pointer under activator
pointer_wdg = DivWdg()
menu_wdg.add(pointer_wdg)
pointer_wdg.add('''
<div class="spt_first_arrow_div"> </div>
<div class="spt_second_arrow_div"> </div>
''')
pointer_wdg.add_class("spt_popup_pointer")
#.........这里部分代码省略.........
开发者ID:asmboom,项目名称:TACTIC,代码行数:101,代码来源:layout_switcher_wdg.py
示例15: IconWdg
if sobject.is_insert():
button = IconWdg("No Path Found", IconWdg.CROSS, long=False)
else:
try:
if mode == "sandbox":
sobject_dir = my.get_base_dir(sobject)
elif mode in ["client_repo", "repository"]:
sobject_dir = my.get_client_repo_dir(sobject)
sobject_lib_dir = my.get_lib_dir(sobject)
sobject_dir = sobject_dir.strip()
sobject_dir = Common.process_unicode_string(sobject_dir)
except TacticException, e:
print "WARNING: ", str(e)
button = IconWdg("No Path Found", IconWdg.CROSS, long=False)
else:
button = IconButtonWdg(title="Explore: %s" % sobject_dir, icon=IconWdg.LOAD)
if sobject_dir == sobject_lib_dir:
button.add_behavior(
{
"type": "click_up",
"cbjs_action": "spt.alert('You are not allowed to browse directories on a web server.');",
}
)
else:
button.add_behavior(
{
"type": "click_up",
"cbjs_action": """var applet = spt.Applet.get(); applet.makedirs('%s'); applet.open_explorer('%s');"""
% (sobject_dir, sobject_dir),
}
)
开发者ID:hellios78,项目名称:TACTIC,代码行数:31,代码来源:explorer_wdg.py
|
请发表评论