本文整理汇总了Python中pyasm.widget.IconButtonWdg类的典型用法代码示例。如果您正苦于以下问题:Python IconButtonWdg类的具体用法?Python IconButtonWdg怎么用?Python IconButtonWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IconButtonWdg类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_display
def get_display(my):
div = DivWdg()
sobject = my.get_current_sobject()
search_key = SearchKey.get_by_sobject(sobject)
if sobject.is_admin():
return "ADMIN"
icon = IconButtonWdg("Global Permissions", IconWdg.EDIT)
icon.add_behavior( {
"type": "click_up",
"cbjs_action": "spt.popup.get_widget(evt, bvr)",
"options": {
"class_name": "tactic.ui.panel.SecurityManagerWdg",
"title": "Permisssion Manager",
"popup_id": "Permission Manager"
},
"args": {
"search_key": search_key
}
} )
div.add(icon)
return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:security_manager_wdg.py
示例2: get_display
def get_display(my):
sobject = my.get_current_sobject()
widget_class = my.get_option("class")
if widget_class == '':
raise WidgetException("No widget class defined")
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", widget_class)
url.set_option("search_key", sobject.get_search_key())
ref = url.get_url()
iframe = Container.get("iframe")
iframe.set_width(90)
action = iframe.get_on_script(ref)
info_type = my.get_option("info_type")
button = IconButtonWdg("%s info" % info_type, IconWdg.INFO)
button.add_event("onclick", "%s" % (action) )
button.add_style("margin: 3px 5px")
return button
开发者ID:0-T-0,项目名称:TACTIC,代码行数:26,代码来源:frame_info_wdg.py
示例3: get_display
def get_display(my):
my.view = my.kwargs.get('view')
if not my.view:
my.view = 'publish'
widget = Widget()
sobject = my.get_current_sobject()
search_type = sobject.get_search_type()
search_id = sobject.get_id()
if my.get_option('preview') != 'false':
my.thumb.set_current_index(my.get_current_index())
widget.add(my.thumb)
publish_link = PublishLinkWdg(search_type,search_id, config_base=my.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
开发者ID:funic,项目名称:TACTIC,代码行数:33,代码来源:table_element_wdg.py
示例4: get_display
def get_display(my):
widget = Widget()
thumb = super(ThumbPublishWdg, my).get_display()
widget.add(thumb)
sobject = my.get_current_sobject()
search_type = sobject.get_search_type()
search_id = sobject.get_id()
publish_link = PublishLinkWdg(search_type,search_id)
div = DivWdg(publish_link)
div.set_style('clear: left; padding-top: 6px')
widget.add(div)
# build an iframe to show publish browsing
browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
iframe = WebContainer.get_iframe()
iframe.set_width(100)
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", "pyasm.prod.web.PublishBrowserWdg")
url.set_option("search_type", search_type)
url.set_option("search_id", search_id)
script = iframe.get_on_script(url.to_string())
browse_link.add_event("onclick", script)
div.add(browse_link)
div.set_style('padding-top: 6px')
return widget
开发者ID:0-T-0,项目名称:TACTIC,代码行数:32,代码来源:prod_table_element_wdg.py
示例5: get_display
def get_display(my):
web = WebContainer.get_web()
if not my.view:
view = web.get_form_value("filter|view")
# create popup
create_popup = PopupWdg("create_action")
create_popup.set_auto_hide(False)
create_popup.add("Enter name of view: ")
create_popup.add(TextWdg("create_view_name"))
# create_popup.add( HtmlElement.br(2) )
# create_popup.add( "Copy from template: " )
# template_select = SelectWdg("copy_from_template")
# template_select.add_empty_option("-- None --")
# template_select.set_option("values", "list|summary|task")
# create_popup.add( template_select )
create_popup.add(HtmlElement.br(2, clear="all"))
from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg
create_icon = ProdIconButtonWdg("Create")
ajax = AjaxCmd()
ajax.register_cmd("pyasm.widget.CustomCreateViewCbk")
ajax.add_element_name("create_view_name")
ajax.add_element_name("auto_create_edit")
ajax.set_option("search_type", my.search_type)
ajax.set_option("project", Project.get_project_code())
if my.view:
ajax.set_option("template_view", my.view)
create_icon.add_event(
"onclick",
"%s;%s"
% (ajax.get_on_script(), "toggle_display('create_action');setTimeout('document.form.submit()',1000)"),
)
cancel_icon = ProdIconButtonWdg("Cancel")
cancel_icon.add_event("onclick", "toggle_display('create_action')")
span = SpanWdg()
span.add(create_icon)
span.add(cancel_icon)
create_popup.add(span)
create_popup.add(HtmlElement.br())
# add the create button
create = IconButtonWdg("Create View", IconWdg.SAVE, True)
create.add_event("onclick", "%s" % create_popup.get_on_script())
# lay it all out
widget = Widget()
widget.add(create_popup)
# Browser does not have create
# widget.add(create)
return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:56,代码来源:custom_view_app_wdg.py
示例6: init
def init(my):
my.layer = LayerWdg(my.xpos, my.ypos, my.display)
if not my.width:
my.shadowbox = ShadowBoxWdg(my.shad_name)
else:
my.shadowbox = ShadowBoxWdg(my.shad_name, my.width)
# do not enable it for the Login page
web = WebContainer.get_web()
if my.shad_name and not web.is_IE():
BaseAppServer.add_onload_script("Move.drag('%s','%s')" \
%(my.shadowbox.get_name(), my.iframe_name))
div = DivWdg()
from pyasm.widget import IconButtonWdg
move_button = IconWdg(name='move me', icon=IconWdg.NAV)
move_button.set_id("%s_handle" % (my.shad_name))
move_button.add_class('move')
move_button.add_style('float: left')
move_button.add_style('padding: 2px 0 0 6px')
if not web.is_IE():
div.add(move_button)
mbutton = IconButtonWdg(name='close window', icon=IconWdg.KILL)
mbutton.set_class("moduleKillBtn")
mbutton.add_event("onclick", my.layer.get_off_script() )
div.add(mbutton)
if my.nav_links:
back_link = HtmlElement.href("<<", "javascript:history.back()")
back_link.add_style("font-size", "1.4em")
for_link = HtmlElement.href(">>", "javascript:history.forward()")
for_link.add_style("font-size", "1.4em")
div.add(SpanWdg(back_link, css='med'))
div.add(SpanWdg(for_link, css='med'))
my.shadowbox.set_header(div)
# add button and title_wdg to shadow box
if my.title_wdg:
title_wdg = DivWdg()
title_wdg.set_class("moduleTitle")
title_wdg.add(my.title_wdg)
my.shadowbox.set_title_wdg(title_wdg)
my.layer.add(my.shadowbox)
my._add_widget(my.layer)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:55,代码来源:shadowbox_wdg.py
示例7: get_create_view_wdg
def get_create_view_wdg(my, search_type):
# create popup
create_popup = PopupWdg("create_action")
create_popup.set_auto_hide(False)
create_popup.add("Enter name of view: ")
create_popup.add(TextWdg("create_view_name"))
# create_popup.add( HtmlElement.br(2) )
# create_popup.add( "Copy from template: " )
# template_select = SelectWdg("copy_from_template")
# template_select.add_empty_option("-- None --")
# template_select.set_option("values", "list|summary|task")
# create_popup.add( template_select )
create_popup.add(HtmlElement.br(2))
create_popup.add(CheckboxWdg("auto_create_edit", label="Auto Create Edit View"))
create_popup.add(HtmlElement.br(2, clear="all"))
from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg
create_icon = ProdIconButtonWdg("Create")
ajax = AjaxCmd()
ajax.register_cmd("pyasm.widget.CustomCreateViewCbk")
ajax.add_element_name("create_view_name")
ajax.add_element_name("auto_create_edit")
ajax.set_option("search_type", search_type)
ajax.set_option("project", Project.get_project_code())
div = ajax.generate_div()
div.set_post_ajax_script("document.form.submit()")
create_icon.add_event("onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action')"))
cancel_icon = ProdIconButtonWdg("Cancel")
cancel_icon.add_event("onclick", "toggle_display('create_action')")
span = SpanWdg()
span.add(create_icon)
span.add(cancel_icon)
create_popup.add(span)
create_popup.add(HtmlElement.br())
# add the create button
create = IconButtonWdg("Create View", IconWdg.SAVE, True)
create.add_event("onclick", "%s" % create_popup.get_on_script())
# lay it all out
widget = Widget()
widget.add(create_popup)
widget.add(create)
widget.add(div)
return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:50,代码来源:custom_view_app_wdg.py
示例8: get_display
def get_display(my):
# add the add property button
iframe = WebContainer.get_iframe()
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", "pyasm.widget.CustomAddPropertyWdg")
url.set_option("search_type", my.search_type)
url.set_option("view", my.view)
action = iframe.get_on_script(url.to_string() )
add = IconButtonWdg("Add Property", IconWdg.INSERT, True)
add.add_event("oncontextmenu", "%s;return false" % action )
add.add_event("onclick", "%s" % action )
widget = Widget()
widget.add(add)
return widget
开发者ID:0-T-0,项目名称:TACTIC,代码行数:16,代码来源:custom_view_wdg.py
示例9: get_display
def get_display(my):
sobject = my.get_current_sobject()
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", my.get_annotate_wdg_class() )
url.set_option("search_type", sobject.get_search_type() )
url.set_option("search_id", sobject.get_id() )
button = IconButtonWdg("Annotate", IconWdg.DETAILS, False)
button.add_event("onclick", \
"document.location='%s'" % url.to_string() )
widget = Widget()
widget.add(button)
return widget
开发者ID:0-T-0,项目名称:TACTIC,代码行数:16,代码来源:annotate_wdg.py
示例10: get_open_wdg
def get_open_wdg( sobject, file_type=None):
''' given a snapshot. open the sandbox in explorer '''
span = SpanWdg()
# explore button
dir = sobject.get_client_lib_dir(file_type=file_type)
open_button = IconButtonWdg( "Explore: %s" % dir, IconWdg.LOAD, False)
open_button.add_event("onclick", "Applet.open_explorer('%s')" % dir)
open_button.add_class('small')
span.add(open_button)
#dir = sobject.get_sandbox_dir()
#copy_button = IconButtonWdg( "Copy to sandbox: %s" % dir, IconWdg.DOWNLOAD, False)
#span.add(copy_button)
return span
开发者ID:mincau,项目名称:TACTIC,代码行数:17,代码来源:composite_wdg.py
示例11: get_values_script
def get_values_script(self):
save_button = IconButtonWdg("Save Settings", IconWdg.SAVE)
save_button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
get_values = function() {
var top = bvr.src_el.getParent(".spt_list_top");
var elements = bvr.src_el.getElements(".spt_list_items");
var data = [];
for (var i=0; i<elements.length; i++) {
var values = spt.api.get_input_values(elements[i]);
data.push(values)
}
return data;
}
'''
} )
content_div.add(save_button)
开发者ID:mincau,项目名称:TACTIC,代码行数:18,代码来源:dynamic_list_wdg.py
示例12: _add_publish_link
def _add_publish_link(self, main_div):
publish_link = PublishLinkWdg(self.sobject.get_search_type(), self.sobject.get_id())
div = DivWdg(publish_link)
div.add_style('padding-top','5px')
main_div.add(div)
# build an iframe to show publish browsing
search_type = self.sobject.get_search_type()
search_id = self.sobject.get_id()
from pyasm.widget import IconButtonWdg, IconWdg
browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
iframe = WebContainer.get_iframe()
iframe.set_width(100)
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", "pyasm.prod.web.PublishBrowserWdg")
url.set_option("search_type", search_type)
url.set_option("search_id", search_id)
script = iframe.get_on_script(url.to_string())
browse_link.add_event("onclick", script)
div.add(browse_link)
div.set_style('padding-top: 6px')
开发者ID:mincau,项目名称:TACTIC,代码行数:24,代码来源:asset_info_wdg.py
示例13: get_display
def get_display(my):
web = WebContainer.get_web()
naming_util = NamingUtil()
if not my.widget_name:
my.widget_name = my.get_name()
# get the sobject required by this input
sobject = my.get_current_sobject()
if not sobject:
sobject = Search.get_by_id(my.search_type, my.search_id)
if my.new_sample_name:
my.new_sample_name.replace("//", "/")
else:
my.new_sample_name = sobject.get_value(my.widget_name)
widget = DivWdg()
widget.set_id("naming")
widget.add_style("display: block")
# set the sample text
div = DivWdg()
div.add("Sample name: <i>%s</i>" % my.new_sample_name)
div.add(HtmlElement.br(2))
new_sample_wdg = ProdIconButtonWdg("Set New Sample")
new_sample_wdg.add_event("onclick", "toggle_display('generate')")
div.add(new_sample_wdg)
generate = DivWdg()
generate.add(HtmlElement.br())
generate.set_id("generate")
generate.add_style("display: none")
sample_text = TextWdg("new_sample_name")
sample_text.set_option("size", "30")
# sample_text.set_persist_on_submit()
# if my.new_sample_name:
# sample_text.set_value(my.new_sample_name)
generate.add(sample_text)
button = IconButtonWdg("Generate", IconWdg.REFRESH, long=True)
on_script = my.setup_ajax("naming")
button.add_event("onclick", on_script)
generate.add(button)
generate.add(HtmlElement.br(2))
div.add(generate)
widget.add(div)
hidden = TextWdg(my.widget_name)
value = my.naming
hidden.set_value(my.new_sample_name)
widget.add(my.widget_name)
widget.add(hidden)
# get all of the parts
# TODO: not sure if this should be dictated by the sample name
# break up the name into parts
import re
if my.new_sample_name:
tmp = my.new_sample_name.strip("/")
parts = re.split("[\\/._]", tmp)
print "parts: ", parts
else:
return widget
# if there is a naming, then populate that
if my.edit_search_type:
options = naming_util.get_options(my.edit_search_type)
else:
options = naming_util.get_options(sobject.get_value("search_type"))
table = Table()
type_values = []
padding_values = []
for idx, part in enumerate(parts):
table.add_row()
table.add_cell(part)
type_select = SelectWdg("type_%s" % idx)
type_select.add_empty_option("-- Explicit --")
type_select.set_persist_on_submit()
type_select.set_option("values", "|".join(options))
type_values.append(type_select.get_value())
td = table.add_cell(type_select)
widget.add(table)
return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:93,代码来源:naming_wdg.py
示例14: get_display
def get_display(my):
web = WebContainer.get_web()
widget = DivWdg()
widget.add_class("spt_search_limit_top")
#widget.add_style("border", "solid 1px blue")
widget.add_color("background", "background")
widget.add_color("color", "color")
widget.add_style("padding: 5px")
hidden = HiddenWdg("prefix", my.prefix)
widget.add(hidden)
if not my.search and not my.sobjects:
widget.add("No search or sobjects found")
return widget
# my.count should have been set in alter_search()
# which can be called explicitly thru this instance, my.
if not my.count:
my.count = my.search.get_count(no_exception=True)
# if my.sobjects exist thru inheriting from parent widgets
# or explicitly set, (this is not mandatory though)
if my.sobjects and len(my.sobjects) < my.search_limit:
limit = len(my.sobjects)
elif my.search and my.count < my.search_limit:
# this is only true if the total result of the search is
# less than the limit and so this wdg will not display
limit = my.count
else:
limit = my.search_limit
if not limit:
limit = 50
my.search_limit = limit
if my.refresh:
prev = SpanWdg( IconButtonWdg("Prev", IconWdg.LEFT, False ) )
prev.add_style("margin-left: 8px")
prev.add_style("margin-right: 6px")
prev.add_style("margin-top: -2px")
next = IconButtonWdg("Next", IconWdg.RIGHT, False, icon_pos="right" )
next.add_style("margin-left: 6px")
prev.add_behavior( {
'type': 'click_up',
'cbjs_action': my.refresh_script
} )
next.add_behavior( {
'type': 'click_up',
'cbjs_action': my.refresh_script
} )
else: # the old code pre 2.5
prev = IconButtonWdg("Prev", IconWdg.LEFT, False )
hidden_name = my.prev_hidden_name
hidden = HiddenWdg(hidden_name,"")
prev.add(hidden)
prev.add_event('onclick'," spt.api.Utility.get_input(document,'%s').value ='Prev';%s"\
%(hidden_name, my.refresh_script))
next = IconButtonWdg("Next", IconWdg.RIGHT, False, icon_pos="right" )
hidden_name = my.next_hidden_name
hidden = HiddenWdg(hidden_name,"")
next.add(hidden)
next.add_event('onclick',"spt.api.Utility.get_input(document,'%s').value ='Next';%s" \
%(hidden_name, my.refresh_script))
showing_wdg = DivWdg()
widget.add(showing_wdg)
showing_wdg.add_style("padding: 10px")
showing_wdg.add_style("margin: 10px")
showing_wdg.add_color("background", "background", -5)
showing_wdg.add_border()
label_span = SpanWdg("Showing: ")
showing_wdg.add(label_span)
showing_wdg.add( prev )
# this min calculation is used so that if my.sobjects is not set
# above for the calculation of the limit, which will make the last
# set of range numbers too big
left_bound = my.current_offset+1
if not limit:
# prevent error in ItemsNavigatorWdg if a search encounters query error
limit = 50
my.search_limit = limit
right_bound = min(my.current_offset+limit, my.count)
if left_bound > right_bound:
left_bound = 1
current_value = "%d - %d" % (left_bound, right_bound)
if my.style == my.SIMPLE:
showing_wdg.add( current_value )
#.........这里部分代码省略.........
开发者ID:hellios78,项目名称:TACTIC,代码行数:101,代码来源:search_limit_wdg.py
示例15: get_display
def get_display(my):
my.set_option('icon', "CONTENTS")
sobject = my.get_current_sobject()
search_type = sobject.get_search_type()
context = my.get_option("context")
if not context:
context = "publish"
process = my.get_option("process")
if not process:
process = "publish"
if sobject.get_base_search_type() == "sthpw/snapshot":
snapshot = sobject
sobject = snapshot.get_parent()
if sobject:
search_type = sobject.get_search_type()
else:
top = DivWdg()
return top
else:
if process:
snapshot = Snapshot.get_latest_by_sobject(sobject, process=process)
else:
snapshot = Snapshot.get_latest_by_sobject(sobject, context=context)
if not snapshot:
top = DivWdg()
return top
top = DivWdg()
icon = IconButtonWdg( "Show Metadata", eval( "IconWdg.%s" % my.get_option('icon') ) )
top.add(icon)
top.add_style("text-align: center")
lib_path = snapshot.get_lib_path_by_type("main")
basename = os.path.basename(lib_path)
dirname = os.path.dirname(lib_path)
my.behavior['basename'] = basename
my.behavior['dirname'] = dirname
my.behavior['search_type'] = search_type
cbjs_action = '''
var class_name = 'tactic.ui.tools.repo_browser_wdg.RepoBrowserContentWdg';
var kwargs = {
basename: '%(basename)s',
dirname: '%(dirname)s',
search_type: '%(search_type)s'
};
//spt.tab.set_main_body_tab();
//spt.tab.add_new("Detail", "Detail", class_name, kwargs);
spt.panel.load_popup("Detail", class_name, kwargs);
''' % (my.behavior)
my.behavior['type'] = 'click_up'
my.behavior['cbjs_action'] = cbjs_action
icon.add_behavior(my.behavior)
return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:76,代码来源:metadata_element_wdg.py
示例16: get_tool_bar
def get_tool_bar(my):
widget = DivWdg()
widget.add_style("width: 250px")
refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
refresh.add_behavior(
{
"type": "click_up",
"cbjs_action": """
var top = bvr.src_el.getParent(".spt_panel");
spt.panel.refresh(top);
""",
}
)
widget.add(refresh)
widget.add(" ")
trash_div = SpanWdg()
# reset some global variables on load
trash_div.add_behavior(
{"type": "load", "cbjs_action": "spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}"}
)
trash_div.set_id("trash_me")
trash_div.add(IconWdg("Trash", IconWdg.TRASH))
trash_div.add_class("hand")
trash_div.add_class("spt_side_bar_trash")
trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
bvr = {"type": "click_up", "cbjs_action": "alert('Drag and drop link or folder here to remove it.')"}
trash_div.add_behavior(bvr)
widget.add(trash_div)
save_div = SpanWdg(css="med hand spt_side_bar_trash")
save_div.add(IconWdg("Save Ordering", IconWdg.SAVE))
bvr = {
"type": "click_up",
"search_type": my.search_type,
"view": my.view,
"cbjs_action": """
if (confirm("Save ordering of this view [" + bvr.view + "] ?") ) {
var top = bvr.src_el.getParent(".spt_view_manager_top");
var list_top = top.getElement(".spt_menu_item_list");
var server = TacticServerStub.get();
server.start({"title": "Updating views"});
var is_personal = false;
spt.app_busy.show("Saving", "Saving view ["+bvr.view+"]");
spt.side_bar.save_view(bvr.search_type, bvr.view, is_personal, list_top);
server.finish();
spt.app_busy.hide();
}
""",
}
save_div.add_behavior(bvr)
widget.add(save_div)
gear = my.get_gear_menu()
gear.add_style("float: right")
widget.add(gear)
return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:71,代码来源:view_manager_wdg.py
示例17: get_display
def get_display(my):
sobject = my.get_current_sobject()
search_key = SearchKey.build_by_sobject(sobject)
display = DivWdg()
display.add_style("position: relative")
display.add_class("spt_button_top")
BASE = "/context/themes2/default/"
over_div = DivWdg()
display.add(over_div)
over_div.add_class("spt_button_over")
over_img = "<img src='%s/MainButton_over.png'/>" % BASE
over_div.add(over_img)
over_div.add_style("position: absolute")
over_div.add_style("top: -9px")
over_div.add_style("left: 0px")
over_div.add_style("display: none")
click_div = DivWdg()
display.add(click_div)
click_div.add_class("spt_button_click")
click_img = "<img src='%s/MainButton_click.png'/>" % BASE
click_div.add(click_img)
click_div.add_style("position: absolute")
click_div.add_style("top: -9px")
click_div.add_style("left: 0px")
click_div.add_style("display: none")
if my.get_option("align") == "left":
display.add_style("text-align: left")
else:
display.add_style("text-align: center")
icon = my.get_option("icon")
if not icon:
icon = "create"
icon_tip = my.get_option("icon_tip")
if not icon_tip:
icon_tip = my.get_option("hint")
if not icon_tip:
icon_tip = ""
enable = my.get_option("enable")
if enable:
result = ExpressionParser().eval(enable, sobject)
if not result:
return " "
if not my.script_obj and not my.script:
icon_wdg = IconButtonWdg("No Script Found", IconWdg.ERROR)
else:
try:
icon_link = eval("IconWdg.%s" % icon.upper())
except Exception, e:
print "WARNING: ", str(e)
icon_link = IconWdg.ERROR
icon_wdg = IconButtonWdg(icon_tip, icon_link)
if not sobject.is_insert():
icon_wdg.add_class("hand")
# icon_wdg.add_behavior(my.behavior)
icon_wdg.add_class("spt_button_%s" % my.name)
开发者ID:hellios78,项目名称:TACTIC,代码行数:64,代码来源:button_wdg.py
示例18: get_buttons_wdg
def get_buttons_wdg(my):
buttons_div = DivWdg()
buttons_div.add_style("margin-left: 20px")
buttons_div.add_style("margin-right: 20px")
# add brush size
text_note_wdg = DivWdg()
text_note_wdg.add("<b>Text Note</b>")
buttons_div.add(text_note_wdg)
text_note = TextAreaWdg("spt_text_note")
text_note.add_style("width: 400px")
text_note.add_class("spt_text_note")
buttons_div.add(text_note)
from pyasm.widget import IconButtonWdg, IconWdg
save_button = IconButtonWdg("Export", IconWdg.SAVE)
save_button.add_style("float: right")
buttons_div.add(save_button)
script = '''
try {
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
spt.app_busy.show("Exporting Visual Note", " ")
var data = getFlashMovie("visual_notes_wdg").visual_notes_export();
var applet = spt.Applet.get();
var server = TacticServerStub.get();
//server.start();
var search_key = bvr.kwargs.search_key;
var txt_path = "c:/sthpw/sandbox/temp/visual_notes/visual_notes_temp.txt"
var jpg_path = "c:/sthpw/sandbox/temp/visual_notes/visual_notes_temp.jpg"
applet.create_file(txt_path, data);
applet.decodeFileToFile(txt_path, jpg_path);
var top_el = bvr.src_el.getParent(".spt_visual_notes_top");
var context = bvr.kwargs.context;
var snapshot = server.simple_checkin(search_key, context, jpg_path);
//var note_context = context + "|note";
var note_context = context;
var note = top_el.getElement(".spt_text_note").value;
var note_sobj = server.insert("sthpw/note", { note: note, context: note_context}, {parent_key: search_key} );
server.connect_sobjects( snapshot, note_sobj);
//server.finish("Visual Notes");
spt.app_busy.hide();
alert("Visual note added for [" + context + "]");
}
catch(err) {
spt.app_busy.hide();
alert(err);
}
'''
save_button.add_behavior( {
'type': 'click_up',
'cbjs_action': script,
'kwargs': {
'search_key': my.search_key,
'context': my.note_context
}
})
return buttons_div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:80,代码来源:visual_notes_wdg.py
示例19: get_display
def get_display(self):
current = self.get_current_sobject()
if current.is_insert():
widget = Widget()
parent_key = self.get_option('parent_key')
if parent_key:
parent = SearchKey.get_by_search_key(parent_key)
if parent:
widget.add(SpanWdg(parent.get_code()))
else:
# use the project as the parent
parent = Project.get()
widget.add(SpanWdg("Project: %s" % parent.get_code()))
#raise TacticException('Task creation aborted since parent is undetermined. Please check the configuration that generates this table.')
text = HiddenWdg(self.get_input_name())
text.set_option('size','40')
text.set_value(parent_key)
widget.add(text)
return widget
else:
search_type = current.get_value('search_type')
if not search_type:
return "No parent type"
widget = Widget()
parent = current.get_parent()
if parent:
widget.add(parent.get_code())
return widget
# What is this look up code for?
text = TextWdg(self.get_input_name())
behavior = {
'type': 'keyboard',
'kbd_handler_name': 'DgTableMultiLineTextEdit'
}
text.add_behavior(behavior)
widget.add(text)
icon = IconButtonWdg("Look up", IconWdg.ZOOM)
icon.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var options = {
title: '%s',
class_name: 'tactic.ui.panel.ViewPanelWdg'
};
var args = {
search_type: '%s',
view: 'list'
};
spt.popup.get_widget( {}, {options: options, args: args} );
''' % (search_type, search_type)
} )
widget.add(icon)
return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:68,代码来源:task_input_wdg.py
示例20: get_action_wdg
def get_action_wdg(self):
main_div = DivWdg(css="filter_box center_content")
div = DivWdg()
main_div.add(self.get_view_select())
main_div.add(div)
div.add_style('height', '16px')
div.add_style('margin', '3px 0 3px 0')
search_type = self.get_search_type()
div.add(HtmlElement.b("Action: "))
add_button = IconButtonWdg(self.ADD_BUTTON, IconWdg.ADD, long=True)
behavior = {
'type': 'click_up',
'mouse_btn': 'LMB',
'cbfn_action': 'spt.sobject_planner.action',
'action': 'add',
'search_type': search_type
}
add_button.add_behavior(behavior)
retire_button = IconButtonWdg("Retire Instance",\
IconWdg.RETIRE, long=True)
behavior = {
'type': 'click_up',
'mouse_btn': 'LMB',
'cbfn_action': 'spt.sobject_planner.action',
'action': 'retire',
'search_type': search_type
}
retire_button.add_behavior(behavior)
delete_button = IconButtonWdg("Delete Instance",\
IconWdg.DELETE, long=True)
behavior = {
'type': 'click_up',
'mouse_btn': 'LMB',
'cbfn_action': 'spt.sobject_planner.action',
'action': 'delete',
'search_type': search_type
}
delete_button.add_behavior(behavior)
div.add(add_button)
div.add(retire_button)
div.add(delete_button)
'''
# add test popup
from tactic.ui.container import PopupWdg
from tactic.ui.panel import TableLayoutWdg
popup = PopupWdg(id="planner", allow_page_activity=True)
content = DivWdg()
#content.add_style("height: 500px")
#content.add_style("overflow: scroll")
search_type = self.get_search_type()
layout = TableLayoutWdg(search_type=search_type, view="planner_left")
search = Search(search_type)
layout.set_sobjects( search.get_sobjects() )
content.add(layout)
popup.add("Assets", "title")
popup.add(content, "content")
popup_button = IconButtonWdg("Popup",\
IconWdg.DELETE, long=True)
popup_button.add_event("onclick", "$('planner').setStyle('display','')")
main_div.add(popup)
main_
|
请发表评论