本文整理汇总了Python中pyasm.widget.TextWdg.add_style方法的典型用法代码示例。如果您正苦于以下问题:Python TextWdg.add_style方法的具体用法?Python TextWdg.add_style怎么用?Python TextWdg.add_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.TextWdg
的用法示例。
在下文中一共展示了TextWdg.add_style方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: txtbox
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def txtbox(my, name, val, code, old_val, width='200px', js='no'):
txt = TextWdg(name)
txt.add_attr('id', name)
txt.add_attr('code', code)
txt.add_attr('old_val', old_val)
txt.add_style('width: %s;' % width)
txt.set_value(val)
if js == 'yes':
txt.add_behavior(my.get_nums_only())
return txt
示例2: get_display
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_display(my):
assert my.load_script
widget = DivWdg()
widget.add_style('float', 'right')
load_button = TextOptionBtnWdg(label=' Load ', size='medium')
load_button.get_top_el().add_style('float', 'left')
load_button.get_top_el().set_id(my.LOAD_BUTTON_ID)
load_button.add_behavior(
{'type': "click_up",
"cbjs_action":
"setTimeout(function() {%s}, 200) "% my.load_script
})
widget.add(load_button)
arrow_button = load_button.get_option_widget()
#widget.add(arrow_button)
suffix = "ASSET_LOADER_FUNCTIONS"
menus_in = [ my.smart_menu_data ]
SmartMenu.add_smart_menu_set( arrow_button, menus_in)
SmartMenu.assign_as_local_activator(arrow_button, None, True)
#SmartMenu.attach_smart_context_menu( load_button, menus_in, False )
x_div = FloatDivWdg("x")
x_div.add_color('color','color')
x_div.add_style('margin-right: 6px')
widget.add(x_div)
multiplier = TextWdg()
multiplier.set_id("load_multiplier")
multiplier.set_option("size", "1.5")
multiplier.add_style("font-size: 0.8em")
multiplier.add_style("float: left")
multiplier.add_class("load_multiplier")
widget.add( multiplier )
return widget
示例3: get_xmlrpc_mode_wdg
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_xmlrpc_mode_wdg(self):
div = DivWdg()
div.add_style("margin-top: 15px")
div.add_style("margin-bottom: 15px")
div.add_class("spt_xmlrpc_mode")
div.add_style("display: none")
div.add("Server: ")
text = TextWdg("host")
text.add_style("width: 300px")
div.add(text)
div.add("<br/>"*2)
div.add("Each server requires an authentication that will be used to enable sending transactions to the remote server. The remote server must have this ticket defined in order to recieve the transaction.")
div.add("<br/>"*2)
div.add("Authentication Ticket: ")
text = TextWdg("auth_ticket")
text.add_style("width: 300px")
div.add(text)
return div
示例4: get_display
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_display(my):
top = my.top
my.set_as_panel(top)
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|hide")
'''
} )
top.add_style("width: 100%")
top.add_color("background", "background", -10)
top.add_style("padding-top: 10px")
top.add_style("padding-bottom: 50px")
top.add_class("spt_project_top")
inner = DivWdg()
top.add(inner)
inner.add_style("width: 700px")
inner.add_style("float: center")
inner.add_border()
inner.center()
inner.add_style("padding: 30px")
inner.add_color("background", "background")
from tactic.ui.container import WizardWdg
title = DivWdg()
title.add("Create A New Project")
wizard = WizardWdg(title=title, width="100%")
inner.add(wizard)
help_button = ActionButtonWdg(title="?", tip="Create Project Help", size='s')
title.add(help_button)
help_button.add_style("float: right")
help_button.add_style("margin-top: -20px")
help_button.add_style("margin-right: -10px")
help_button.add_behavior({
'type': 'click_up',
'cbjs_action': '''
spt.help.set_top();
spt.help.load_alias("create-new-project");
'''
})
info_page = DivWdg()
wizard.add(info_page, 'Info')
info_page.add_class("spt_project_top")
info_page.add_style("font-size: 12px")
info_page.add_color("background", "background")
info_page.add_color("color", "color")
info_page.add_style("padding: 20px")
from tactic.ui.input import TextInputWdg
info_page.add("<b>Project Title:</b> ")
text = TextWdg("project_title")
text.add_behavior( {
'type': 'blur',
'cbjs_action': '''
if (bvr.src_el.value == '') {
spt.alert("You must enter a project title");
return;
}
'''})
#text = TextInputWdg(title="project_title")
info_page.add(text)
text.add_style("width: 250px")
info_page.add(HtmlElement.br(3))
span = DivWdg()
info_page.add(span)
span.add_style("padding: 20px 20px 20px 20px")
span.add(IconWdg("INFO", IconWdg.CREATE))
span.add_color("background", "background3")
span.add("The project title can be descriptive and contain spaces and special characters.")
info_page.add("<br/><br/><hr/><br/><br/>")
text.add_behavior( {
'type': 'change',
'cbjs_action': '''
var title = bvr.src_el.value;
if (title.length > 100) {
spt.alert("Title cannot exceed 100 characters.");
return;
}
var code = spt.convert_to_alpha_numeric(title);
code = code.substring(0,30);
var top = bvr.src_el.getParent(".spt_project_top");
var code_el = top.getElement(".spt_project_code");
code_el.value = code;
'''
#.........这里部分代码省略.........
示例5: handle_item_div
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg 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("----")
#.........这里部分代码省略.........
示例6: get_set_limit_wdg
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_set_limit_wdg(my):
limit_content = DivWdg()
limit_content.add_style("font-size: 10px")
#limit_content.add_style("padding", "5px")
#limit_content.add_border()
limit_content.add("Show ")
limit_select = SelectWdg("limit_select")
limit_select.add_class("spt_search_limit_select")
limit_select.set_option("values", "10|20|50|100|200|Custom")
limit_select.add_style("font-size: 10px")
limit_content.add(limit_select)
limit_content.add(" items per page<br/>")
if my.search_limit in [10,20,50,100,200]:
limit_select.set_value(my.search_limit)
is_custom = False
else:
limit_select.set_value("Custom")
is_custom = True
limit_select.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_search_limit_top");
var value = bvr.src_el.value;
var custom = top.getElement(".spt_search_limit_custom");
if (value == 'Custom') {
custom.setStyle("display", "");
}
else {
custom.setStyle("display", "none");
}
'''
} )
custom_limit = DivWdg()
limit_content.add(custom_limit)
custom_limit.add_class("spt_search_limit_custom")
custom_limit.add("<br/>Custom: ")
text = TextWdg("custom_limit")
text.add_class("spt_search_limit_custom_text")
text.add_style("width: 50px")
if not is_custom:
custom_limit.add_style("display: none")
else:
text.set_value(my.search_limit)
custom_limit.add(text)
text.add(" items")
behavior = {
'type': 'keydown',
'cbjs_action': '''
if (evt.key=='enter') {
// register this as changed item
var value = bvr.src_el.value;
if (isNaN(value) || value.test(/[\.-]/)) {
spt.error('You have to use an integer.');
}
}
'''}
text.add_behavior(behavior)
return limit_content
示例7: get_display
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_display(my):
widget = DivWdg()
table = Table()
table.add_attr('class','client_deliverable_wdg')
table.add_row()
table2 = Table()
table2.add_style('border-spacing: 5px;')
table2.add_style('border-collapse: separate;')
table2.add_row()
c1 = table2.add_cell('Order Code:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('order_code')
tb1.add_attr('id','order_code')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['order_code'])
table2.add_cell(tb1)
c1 = table2.add_cell('PO Number:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('po_number')
tb1.add_attr('id','po_number')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['po_number'])
table2.add_cell(tb1)
c1 = table2.add_cell('Title Code:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('title_code')
tb1.add_attr('id','title_code')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['title_code'])
table2.add_cell(tb1)
c1 = table2.add_cell('Platform:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('platform')
tb1.add_attr('id','platform')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['platform'])
table2.add_cell(tb1)
c1 = table2.add_cell('Client:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('client_name')
tb1.add_attr('id','client_name')
tb1.add_attr('disabled','disabled')
tb1.set_value(my.sob['client_name'])
table2.add_cell(tb1)
table2.add_row()
table2.add_cell(table2.hr())
table2.add_row()
c1 = table2.add_cell('Title Source(s):')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('original_source_code')
tb1.add_attr('id','original_source_code')
tb1.add_attr('disabled','disabled')
tb1.add_style('width','200px')
tb1.set_value(my.sob['original_source_code'])
c2 = table2.add_cell(tb1)
c2.add_attr('colspan','2')
c1 = table2.add_cell('Title Source Barcodes(s):')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('original_source_barcode')
tb1.add_attr('id','original_source_barcode')
tb1.add_attr('disabled','disabled')
tb1.add_style('width','200px')
tb1.set_value(my.sob['original_source_barcode'])
c2 = table2.add_cell(tb1)
c2.add_attr('colspan','2')
c1 = table2.add_cell('Ancestors:')
c1.add_attr('nowrap','nowrap')
tb1 = TextWdg('ancestors')
tb1.add_attr('id','ancestors')
tb1.add_attr('disabled','disabled')
tb1.add_style('width','300px')
tb1.set_value(my.sob['ancestors'])
c2 = table2.add_cell(tb1)
c2.add_attr('colspan','3')
table2.add_row()
table2.add_cell(table2.hr())
table2.add_row()
c1 = table2.add_cell('Destination:')
c1.add_attr('nowrap','nowrap')
destination_sel = SelectWdg('destination')
destination_sel.add_attr('id','destination')
destination_sel.append_option('--Select--','')
for c in my.all_clients:
destination_sel.append_option(c.get('name'),c.get('name'))
if my.sob.get('destination') == None:
my.sob['destination'] = ''
destination_sel.set_value(my.sob.get('destination'))
table2.add_cell(destination_sel)
#.........这里部分代码省略.........
示例8: get_page_one
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_page_one(my):
info_page = DivWdg()
#info_page.add_class("spt_project_top")
info_page.add_style("font-size: 12px")
info_page.add_color("background", "background")
info_page.add_color("color", "color")
info_page.add_style("padding: 20px")
from tactic.ui.input import TextInputWdg
info_page.add("<b>Title:</b> ")
text = TextWdg("order_title")
#text = TextInputWdg(title="project_title")
info_page.add(text)
text.add_style("width: 250px")
info_page.add(HtmlElement.br(3))
span = DivWdg()
info_page.add(span)
span.add_style("padding: 20px 20px 20px 20px")
span.add(IconWdg("INFO", IconWdg.CREATE))
span.add_color("background", "background3")
span.add("The order title can be descriptive and contain spaces and special characters.")
info_page.add("<br/><br/><hr/><br/><br/>")
text.add_behavior( {
'type': 'change',
'cbjs_action': '''
var title = bvr.src_el.value;
var code = spt.convert_to_alpha_numeric(title);
var top = bvr.src_el.getParent(".twog_wizard_top");
var code_el = top.getElement(".spt_project_code");
code_el.value = code;
'''
} )
info_page.add("<b>Client Name: </b>")
text = TextWdg("client_name")
text.add_style("width: 250px")
text.add_class("spt_client_name")
info_page.add(text)
# line breaks
info_page.add(HtmlElement.br(2))
info_page.add("<b>Special code: </b>")
text = TextWdg("special code")
text.add_style("width: 250px")
# this is just meant for DOM element search covenience
text.add_class("spt_special_code")
# this behavior is go for eliminlating special symbols
#MTM this will help get rid of the stupid ascii errors
text.add_behavior( {
'type': 'blur',
'cbjs_action': '''
var value = bvr.src_el.value;
var code = spt.convert_to_alpha_numeric(value);
bvr.src_el.value = code;
'''
} )
info_page.add(text)
info_page.add(HtmlElement.br(4))
span = DivWdg()
info_page.add(span)
span.add_style("padding: 20px 20px 20px 20px")
span.add(IconWdg("INFO", IconWdg.CREATE))
span.add_color("background", "background3")
span.add("Some more info here.")
info_page.add(span)
info_page.add("<br/>")
return info_page
示例9: get_display
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_display(my):
my.search_type = my.kwargs.get('search_type')
my.element_name = my.kwargs.get('element_name')
assert my.search_type
assert my.element_name
class_name = 'tactic.ui.app.aggregate_wdg.AggregateCmd'
interval = 120
priority = None
if my.kwargs.get('is_refresh'):
user = Environment.get_user_name()
# these interval jobs need to have a specific code
code = "aggregate|%s|%s" % (my.search_type, my.element_name)
# check to see if the job exists
#job = Search.get_by_code("sthpw/queue", code)
job = None
if not job:
job = SearchType.create("sthpw/queue")
#job.set_value("code", code)
job.set_value("project_code", Project.get_project_code() )
job.set_value("class_name", class_name)
job.set_value("command", class_name)
job.set_value("serialized", str(my.kwargs) )
job.set_value("interval", 120)
job.set_value("state", 'pending')
job.set_value("queue", 'interval')
job.set_value("priority", 9999)
job.set_value("login", user)
job.commit()
my.view = my.kwargs.get('view')
if not my.view:
my.view = 'definition'
top = DivWdg()
my.set_as_panel(top)
action_div = DivWdg()
top.add(action_div)
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);
'''
} )
action_div.add(refresh)
register_div = DivWdg()
register_div.add_class("spt_queue_register")
top.add(register_div)
register_div.add_style("border: solid 1px black")
register_div.add_style("padding: 20px")
register_div.add("Register new interval aggregate")
table = Table()
table.add_style("margin: 15px")
register_div.add(table)
table.add_row()
table.add_cell("command: ")
table.add_cell(class_name)
#table.add_row()
#table.add_cell("priority: ")
#table.add_cell(priority)
table.add_row()
table.add_cell("interval: ")
td = table.add_cell("every ")
td.set_attr("title", "Recalculation interval")
text = TextWdg("interval")
text.add_style("width: 30px")
text.set_value(interval)
td.add(text)
unit_select = SelectWdg("unit")
unit_select.set_value(interval)
unit_select.set_option("values", "seconds|minutes|hours|days")
td.add(" ")
td.add(unit_select)
table.add_row()
table.add_cell("queue: ")
table.add_cell("interval")
from pyasm.widget import ProdIconButtonWdg
#.........这里部分代码省略.........
示例10: get_display
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_display(my):
web = WebContainer.get_web()
top = my.top
top.add_class("spt_ace_editor_top")
script = my.kwargs.get("custom_script")
if script:
language = script.get_value("language")
else:
language = my.kwargs.get("language")
if not language:
language = 'javascript'
code = my.kwargs.get("code")
if not code:
code = ""
show_options = my.kwargs.get("show_options")
if show_options in ['false', False]:
show_options = False
else:
show_options = True
options_div = DivWdg()
top.add(options_div)
if not show_options:
options_div.add_style("display: none")
options_div.add_color("background", "background3")
options_div.add_border()
options_div.add_style("text-align: center")
options_div.add_style("padding: 2px")
select = SelectWdg("language")
select.add_style("width: 100px")
select.add_style("display: inline")
options_div.add(select)
select.add_class("spt_language")
select.set_option("values", "javascript|python|expression|xml")
select.add_behavior( {
'type': 'change',
'editor_id': my.get_editor_id(),
'cbjs_action': '''
spt.ace_editor.set_editor(bvr.editor_id);
var value = bvr.src_el.value;
spt.ace_editor.set_language(value);
//register_change(bvr);
'''
} )
select = SelectWdg("font_size")
select.add_style("width: 100px")
select.add_style("display: inline")
options_div.add(select)
select.set_option("labels", "8 pt|9 pt|10 pt|11 pt|12 pt|14 pt|16 pt")
select.set_option("values", "8 pt|9pt|10pt|11pt|12pt|14pt|16pt")
select.set_value("10pt")
select.add_behavior( {
'type': 'click_up',
'editor_id': my.get_editor_id(),
'cbjs_action': '''
spt.ace_editor.set_editor(bvr.editor_id);
var editor = spt.ace_editor.editor;
var editor_id = spt.ace_editor.editor_id;
var value = bvr.src_el.value;
$(editor_id).setStyle("font-size", value)
//editor.resize();
'''
} )
select = SelectWdg("keybinding")
select.add_style("width: 100px")
#options_div.add(select)
select.set_option("labels", "Ace|Vim|Emacs")
select.set_option("values", "ace|vim|emacs")
select.set_value("10pt")
select.add_behavior( {
'type': 'change',
'editor_id': my.get_editor_id(),
'cbjs_action': '''
spt.ace_editor.set_editor(bvr.editor_id);
var editor = spt.ace_editor.editor;
var editor_id = spt.ace_editor.editor_id;
var vim = require("ace/keyboard/keybinding/vim").Vim;
editor.setKeyboardHandler(vim)
'''
} )
editor_div = DivWdg()
top.add(editor_div)
#.........这里部分代码省略.........
示例11: get_scale_wdg
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_scale_wdg(my):
if my.scale_called == True:
return None
my.scale_called = True
show_scale = my.kwargs.get("show_scale")
div = DivWdg()
if show_scale in [False, 'false']:
div.add_style("display: none")
div.add_style("padding: 5px")
div.add_class("spt_table_search")
hidden = HiddenWdg("prefix", "tile_layout")
div.add(hidden)
div.add_behavior( {
'type': 'load',
'scale_prefix': my.scale_prefix,
'default_scale': my.scale,
'aspect_ratio': my.aspect_ratio,
'cbjs_action': '''
spt.tile_layout = {}
spt.tile_layout.layout = null;
spt.tile_layout.set_layout = function(layout) {
if (!layout.hasClass("spt_layout")) {
layout = layout.getParent(".spt_layout");
}
spt.tile_layout.layout = layout;
return layout;
}
spt.tile_layout.get_scale = function() {
var scale_value = spt.tile_layout.layout.getElement(".spt_scale_value");
var value = scale_value.value;
value = parseInt(value);
return value;
}
spt.tile_layout.set_scale = function(scale) {
var scale_value = spt.tile_layout.layout.getElement(".spt_scale_value");
scale_value.value = scale;
var size_x = bvr.aspect_ratio[0]*scale/100;
var size_y = bvr.aspect_ratio[1]*scale/100;
//var top = bvr.src_el.getParent(".spt_tile_layout_top");
var top = spt.tile_layout.layout;
var els = top.getElements(".spt_tile_content");
for (var i = 0; i < els.length; i++) {
var el = els[i];
el.setStyle( "width", size_x);
el.setStyle( "height", size_y);
}
var container_id = "tile_layout::scale"+bvr.scale_prefix;
spt.container.set_value( container_id, scale);
}
spt.tile_layout.drag_start_x = null;
spt.tile_layout.drag_start_value = null;
spt.tile_layout.drag_setup = function(evt, bvr, mouse_411) {
spt.tile_layout.set_layout(bvr.src_el);
spt.tile_layout.drag_start_x = mouse_411.curr_x;
var src_el = spt.behavior.get_bvr_src( bvr );
if (!src_el.value) {
src_el.value = 0;
}
spt.tile_layout.drag_start_value = src_el.value;
src_el.focus();
src_el.select();
}
spt.tile_layout.drag_motion = function(evt, bvr, mouse_411) {
var start_value = spt.tile_layout.drag_start_value;
if (isNaN(parseInt(start_value))) {
return;
}
var dx = mouse_411.curr_x - spt.tile_layout.drag_start_x;
var increment = parseInt(dx / 5);
var multiplier;
if (increment < 0)
multiplier = 0.975;
else
multiplier = 1 / 0.975;
increment = Math.abs(increment);
var scale = spt.tile_layout.drag_start_value;
for (var i = 0; i < increment; i++) {
scale = scale * multiplier;
}
if (scale > 400)
scale = 400;
scale = parseInt(scale);
spt.tile_layout.set_scale(scale);
}
spt.tile_layout.setup_control = function() {
#.........这里部分代码省略.........
示例12: get_display
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_display(my):
search_type_obj = SearchType.get(my.search_type)
sobj_title = search_type_obj.get_title()
my.color_mode = my.kwargs.get("color_mode")
if not my.color_mode:
my.color_mode = "default"
top_div = my.top
top_div.add_class("spt_edit_top")
if not my.is_refresh:
my.set_as_panel(top_div)
content_div = DivWdg()
content_div.add_class("spt_edit_top")
content_div.add_class("spt_edit_form_top")
content_div.set_attr("spt_search_key", my.search_key)
if not Container.get_dict("JSLibraries", "spt_edit"):
content_div.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
layout_view = my.kwargs.get("layout_view")
if layout_view:
layout_wdg = my.get_custom_layout_wdg(layout_view)
content_div.add(layout_wdg)
return content_div
# add close listener
# NOTE: this is an absolute search, but is here for backwards
# compatibility
content_div.add_named_listener('close_EditWdg', '''
var popup = bvr.src_el.getParent( ".spt_popup" );
if (popup)
spt.popup.close(popup);
''')
attrs = my.config.get_view_attributes()
default_access = attrs.get("access")
if not default_access:
default_access = "edit"
project_code = Project.get_project_code()
security = Environment.get_security()
base_key = search_type_obj.get_base_key()
key = {
'search_type': base_key,
'project': project_code
}
access = security.check_access("sobject", key, "edit", default=default_access)
if not access:
my.is_disabled = True
else:
my.is_disabled = False
disable_wdg = None
if my.is_disabled:
# TODO: This overlay doesn't work in IE, size, position,
# and transparency all fail.
disable_wdg = DivWdg(id='edit_wdg')
disable_wdg.add_style("position: absolute")
disable_wdg.add_style("height: 90%")
disable_wdg.add_style("width: 100%")
disable_wdg.add_style("left: 0px")
#disable_wdg.add_style("bottom: 0px")
#disable_wdg.add_style("top: 0px")
disable_wdg.add_style("opacity: 0.2")
disable_wdg.add_style("background: #fff")
#disable_wdg.add_style("-moz-opacity: 0.2")
disable_wdg.add_style("filter: Alpha(opacity=20)")
disable_wdg.add("<center>EDIT DISABLED</center>")
content_div.add(disable_wdg)
attrs = my.config.get_view_attributes()
#inner doesn't get styled.
inner = DivWdg()
content_div.add(inner)
menu = my.get_header_context_menu()
menus = [menu.get_data()]
menus_in = {
'HEADER_CTX': menus,
}
SmartMenu.attach_smart_context_menu( inner, menus_in, False )
#insert the header before body into inner
#.........这里部分代码省略.........
示例13: txtbox
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def txtbox(my, name, val, width='200px'):
txt = TextWdg(name)
txt.add_attr('id',name)
txt.add_style('width: %s;' % width)
txt.set_value(val)
return txt
示例14: get_display
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_display(my):
search_type = my.kwargs.get("search_type")
view = my.kwargs.get("view")
assert search_type
assert view
# my.handle_search()
config_xml = my.kwargs.get("config_xml")
if not config_xml:
config_xml = "<config/>"
# extraneous variables inherited from TableLayoutWdg
my.edit_permission = False
top = DivWdg()
top.add_class("spt_freeform_layout_top")
my.set_as_panel(top)
top.add_color("background", "background")
top.add_color("color", "color")
top.add_style("height: 100%")
top.add_style("width: 100%")
border_color = top.get_color("border")
top.add_style("border: dashed 1px %s" % border_color)
is_refresh = my.kwargs.get("is_refresh")
config = WidgetConfig.get(view=view, xml=config_xml)
# define canvas
canvas = top
canvas.add_class("spt_freeform_canvas")
canvas.add_style("position: relative")
my.kwargs["view"] = view
element_names = config.get_element_names()
view_attrs = config.get_view_attributes()
canvas_height = view_attrs.get("height")
if not canvas_height:
canvas_height = "400px"
canvas.add_style("height: %s" % canvas_height)
canvas_width = view_attrs.get("width")
if not canvas_width:
width = "600px"
canvas.add_style("width: %s" % canvas_width)
if not my.sobjects:
search = Search(search_type)
sobject = search.get_sobject()
else:
sobject = my.sobjects[0]
dialog_id = my.kwargs.get("dialog_id")
canvas.add_behavior(
{
"type": "smart_click_up",
"search_type": search_type,
"view": view,
"bvr_match_class": "SPT_ELEMENT_SELECT",
"cbjs_action": """
var element = bvr.src_el;
var top = bvr.src_el.getParent(".spt_freeform_top");
var attr = top.getElement(".spt_freeform_attr_top");
var element_id = element.getAttribute("spt_element_id");
var attrs = element.attrs;
if (!attrs) {
attrs = {};
}
var class_name = 'tactic.ui.tools.freeform_layout_wdg.FreeFormAttrWdg';
var kwargs = {
element_id: element_id,
element_name: element.getAttribute("spt_element_name"),
display_handler: element.getAttribute("spt_display_handler"),
display_options: attrs
}
spt.panel.load(attr, class_name, kwargs);
var dialog_id = '%s';
spt.show( $(dialog_id) );
"""
% dialog_id,
}
)
canvas.add_behavior({"type": "load", "cbjs_action": my.get_onload_js()})
canvas.add_behavior(
{
"type": "load",
"cbjs_action": """
var top = bvr.src_el;
spt.freeform.init(top);
#.........这里部分代码省略.........
示例15: get_display
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_style [as 别名]
def get_display(my):
search_type_obj = SearchType.get(my.search_type)
sobj_title = search_type_obj.get_title()
my.color_mode = my.kwargs.get("color_mode")
if not my.color_mode:
my.color_mode = "default"
top_div = my.top
top_div.add_class("spt_edit_top")
if not my.is_refresh:
my.set_as_panel(top_div)
content_div = DivWdg()
content_div.add_class("spt_edit_top")
content_div.add_class("spt_edit_form_top")
content_div.set_attr("spt_search_key", my.search_key)
if not Container.get_dict("JSLibraries", "spt_edit"):
content_div.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
layout_view = my.kwargs.get("layout_view")
if layout_view:
layout_wdg = my.get_custom_layout_wdg(layout_view)
content_div.add(layout_wdg)
return content_div
# add close listener
# NOTE: this is an absolute search, but is here for backwards
# compatibility
content_div.add_named_listener('close_EditWdg', '''
var popup = bvr.src_el.getParent( ".spt_popup" );
if (popup)
spt.popup.close(popup);
''')
attrs = my.config.get_view_attributes()
default_access = attrs.get("access")
if not default_access:
default_access = "edit"
project_code = Project.get_project_code()
security = Environment.get_security()
base_key = search_type_obj.get_base_key()
key = {
'search_type': base_key,
'project': project_code
}
access = security.check_access("sobject", key, "edit", default=default_access)
if not access:
my.is_disabled = True
else:
my.is_disabled = False
disable_wdg = None
if my.is_disabled:
# TODO: This overlay doesn't work in IE, size, position,
# and transparency all fail.
disable_wdg = DivWdg(id='edit_wdg')
disable_wdg.add_style("position: absolute")
disable_wdg.add_style("height: 90%")
disable_wdg.add_style("width: 100%")
disable_wdg.add_style("left: 0px")
#disable_wdg.add_style("bottom: 0px")
#disable_wdg.add_style("top: 0px")
disable_wdg.add_style("opacity: 0.2")
disable_wdg.add_style("background: #fff")
#disable_wdg.add_style("-moz-opacity: 0.2")
disable_wdg.add_style("filter: Alpha(opacity=20)")
disable_wdg.add("<center>EDIT DISABLED</center>")
content_div.add(disable_wdg)
attrs = my.config.get_view_attributes()
inner = DivWdg()
content_div.add(inner)
menu = my.get_header_context_menu()
menus = [menu.get_data()]
menus_in = {
'HEADER_CTX': menus,
}
SmartMenu.attach_smart_context_menu( inner, menus_in, False )
#.........这里部分代码省略.........