本文整理汇总了Python中pyasm.web.DivWdg.add_styles方法的典型用法代码示例。如果您正苦于以下问题:Python DivWdg.add_styles方法的具体用法?Python DivWdg.add_styles怎么用?Python DivWdg.add_styles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.DivWdg
的用法示例。
在下文中一共展示了DivWdg.add_styles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_example_chooser_content
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_example_chooser_content(self):
choice_list_div = DivWdg()
choice_list_div.set_id("UiExampleChoiceList")
choice_list_div.add_styles( "background: #202020; color: #999999; border: 1px solid black; " \
"border-top: 0px;" )
example_wdg_classes = self._get_example_widget_classes()
choice_list_div.add( "<br/>" )
for ex_wdg_class in example_wdg_classes:
ex_wdg = ex_wdg_class()
ex_title = ex_wdg.get_example_title()
ex_desc = ex_wdg.get_example_description()
ex_class_path = Common.get_full_class_name( ex_wdg )
ex_div = DivWdg()
ex_div.add_styles( "color: #999999; padding: 8px; padding-left: 20px; cursor: pointer;" )
ex_div.add_class("SPT_DTS")
ex_div.add_behavior( {'type': 'click_up',
'cbjs_action': 'spt.ui_play.show_example("%s");' % ex_class_path } )
ex_div.add( ex_title )
choice_list_div.add( ex_div )
choice_list_div.add( "<br/>" )
return choice_list_div
示例2: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_display(my):
dd_activator = DivWdg()
if my.style:
dd_activator.add_styles( my.style )
dd_activator.add_style( "width: %spx" % my.width )
dd_activator.add_class("SPT_DTS");
if my.nudge_menu_horiz != 0:
dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz)
if my.nudge_menu_vert != 0:
dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert)
# Generate button ...
#
table = Table()
table.add_row()
table.add_styles("width: 100%; padding: 0px; margin: 0px;")
td = table.add_cell()
td.add_looks("menu border curs_default")
td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )
title_div = DivWdg()
title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
if my.icon_path:
img = HtmlElement.img()
img.set_attr("src", my.icon_path)
img.set_attr("title", my.title)
img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;")
title_div.add(img)
title_div.add_looks("menu")
else:
title_div.add(my.title)
title_div.add_looks("menu fnt_text")
td.add( title_div )
td = table.add_cell()
# -- Example of setting only some of the borders with dotted style ...
# td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
td.add_looks( "menu_btn_icon border curs_default" )
td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
"width: 15px; min-width: 15px;" \
"height: 12px; max-height: 12px;" )
arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
td.add( arrow_img )
dd_activator.add(table)
dd_activator.add( my.kwargs.get("smart_menu_set") )
dd_activator.add_class("SPT_SMENU_ACTIVATOR")
dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu',
'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } )
return dd_activator
示例3: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_display(my):
my.example_count = 0
div = DivWdg()
div.add( "<BR/>" )
ex_title_div = DivWdg()
ex_title_div.add_looks( "fnt_title_2" )
ex_title_div.add( my.get_example_title() )
div.add( ex_title_div )
div.add( "<BR/>" )
ex_desc_div = DivWdg()
ex_desc_div.add( my.get_example_description() )
ex_desc_div.add_looks( "fnt_title_5 fnt_italic" )
ex_desc_div.add_styles( "padding-left: 12px;" )
div.add( ex_desc_div )
div.add( "<BR/>" )
ex_div = my.get_example_display()
ex_div.add_styles( "margin-left: 10px;" )
div.add( ex_div )
div.add( "<BR/>" )
return div
示例4: get_action_html
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_action_html(my):
search_key = SearchKey.get_by_sobject(my.sobjects[0])
behavior_submit = {
'type': 'click_up',
'cb_fire_named_event': 'append_pressed',
'element_names': my.element_names,
'search_key': search_key,
'input_prefix': my.input_prefix
}
behavior_cancel = {
'type': 'click_up',
'cb_fire_named_event': 'preclose_edit_popup',
'cbjs_postaction': "spt.popup.destroy( spt.popup.get_popup( $('edit_popup') ) );"
}
button_list = [{'label': "%s/Close" % my.mode.capitalize(),
'bvr': behavior_submit},
{'label': "Cancel", 'bvr': behavior_cancel}]
edit_close = TextBtnSetWdg( buttons=button_list, spacing =6, size='large', \
align='center',side_padding=10)
div = DivWdg()
div.add_styles('height: 35px; margin-top: 10px;')
div.center()
div.add(edit_close)
return div
示例5: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_display(self):
"""
Get the display for this edit wdg launcher. It should appear as
the name of the sobject, bold and underlined.
:return: the sobject edit launcher widget
"""
search_type = self.kwargs.get('search_type')
sobject_code = self.get_sobject_code()
display_column = self.kwargs.get('display_column')
if not display_column:
display_column = 'code'
display_name = self.server.eval("@GET({0}['code','{1}'].{2})".format(search_type, sobject_code, display_column))
display_name = display_name[0] if display_name else sobject_code
display_mode = self.kwargs.get('display_mode')
if display_mode == 'Browser':
url = ctu.get_edit_wdg_url(search_type, sobject_code, server=self.server)
launch_behavior = self.get_browser_tab_behavior(url)
else:
launch_behavior = self.get_launch_behavior(search_type, sobject_code, display_mode)
display_text = '<b><u>{0}</u></b>'.format(display_name)
div = DivWdg(display_text)
div.add_behavior(launch_behavior)
div.add_styles({'cursor': 'pointer'})
return div
示例6: get_example_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_example_display(self):
div = DivWdg()
div.add_styles("background: black; padding: 10px; width: 400px;")
div.add( "Sandbox for Remko -- replace contents here with own UI prototypes and tests." )
return div
示例7: get_simple_div
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_simple_div(self, text, bg_color):
div = DivWdg()
if bg_color:
div.add_styles("background-color: %s; color: black; padding: 10px; border: solid 1px black;" % bg_color)
else:
div.add_styles("color: black; padding: 10px; border: solid 1px black;")
div.add( text )
return div
示例8: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_display(my):
width = my.kwargs.get("width")
if not width:
width = "100%"
height = my.kwargs.get("height")
sobject = my.get_current_sobject()
div = DivWdg()
div.add_class("spt_thumb_top")
path = my.path
if path:
img = HtmlElement.img(src=path)
else:
search_type = sobject.get_search_type_obj()
path = my.get_path_from_sobject(search_type)
if path:
img = DivWdg()
img.add_style("opacity: 0.2")
img_inner = HtmlElement.img(src=path)
img.add(img_inner)
img_inner.add_style("width: %s" % width)
if path and path.startswith("/context"):
img.add_style("padding: 10px 15%")
img.add_style("width: 70%")
elif path:
img.add_style("width: %s" % width)
if height:
img.add_style("height: %s" % height)
img.add_style('margin-left','auto')
img.add_style('margin-right','auto')
if not path:
img = DivWdg()
img.add_class("spt_image")
div.add(img)
if height or my.show_name_hover in ["True","true",True]:
div.add_style("height: 100%")
if my.show_name_hover in ["True","true",True]:
name_hover = DivWdg()
name_hover.add_class("spt_name_hover")
name_hover.add(sobject.get('name'))
name_hover.add_attr('onmouseenter',"this.setStyle('opacity',1)")
name_hover.add_attr('onmouseleave',"this.setStyle('opacity',0)")
name_hover.add_styles('opacity: 0; font-size: 16px; color: rgb(217, 217, 217); top: 0px; \
transition: opacity 0s ease-out; -webkit-transition: opacity 0s ease-out; \
height: 100%; width: 100%; position: absolute; padding-top: 20px; \
text-align: center; background-color: rgba(0, 0, 0, 0.6);')
div.add(name_hover)
return div
示例9: get_no_icon_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_no_icon_wdg(my, missing=False):
sobject = my.get_current_sobject()
if not sobject:
return ''
div = my.top
div.add_style("position: relative")
div.add_style("margin: 3px")
div.add_class("spt_thumb_top")
div.set_id( "thumb_%s" % sobject.get_search_key() )
icon_size = my.get_icon_size()
if icon_size:
div.add_style("%s: %s" % (my.aspect, icon_size) )
if missing:
img = HtmlElement.img(ThumbWdg.get_missing_image())
elif sobject.get_value("_is_collection", no_exception=True):
img = HtmlElement.img("/context/icons/mime-types/folder2.jpg")
else:
img = HtmlElement.img(ThumbWdg.get_no_image())
img.add_class("spt_image")
#from tactic.ui.table import SObjectDetailElementWdg
#detail = SObjectDetailElementWdg()
#detail.set_widget(img)
#detail.set_sobject(sobject)
#div.add(detail)
div.add(img)
div.add_class("hand")
if my.SQL_ERROR:
warning_div = DivWdg('<i>-- preprocess error --</i>')
warning_div.add_styles('position: absolute; z-index: 100; float: left; top: 0; left: 0; font-size: smaller;')
div.add_style('position: relative')
div.add(warning_div)
search_key = SearchKey.get_by_sobject(sobject)
code = sobject.get_code()
detail = my.get_option("detail")
if detail != 'false':
my.add_icon_behavior(div, sobject)
unit = None
if isinstance(icon_size, basestring):
icon_size, unit = my.split_icon_size(icon_size)
img.add_style("%s: 100%%" % my.aspect )
else:
img.add_style("%s: %s" % (my.aspect, my.get_icon_size()) )
img.add_style("min-%s: 15px" % my.aspect)
return div
示例10: get_no_icon_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_no_icon_wdg(my, missing=False):
sobject = my.get_current_sobject()
if not sobject:
return ''
div = my.top
div.add_style("position: relative")
div.add_style("margin: 3px")
div.add_class("spt_thumb_top")
div.set_id( "thumb_%s" % sobject.get_search_key() )
icon_size = my.get_icon_size()
if icon_size:
div.add_style("%s: %s" % (my.aspect, icon_size) )
if missing:
img = HtmlElement.img(ThumbWdg.get_missing_image())
else:
img = HtmlElement.img(ThumbWdg.get_no_image())
img.add_class("spt_image")
#from tactic.ui.table import SObjectDetailElementWdg
#detail = SObjectDetailElementWdg()
#detail.set_widget(img)
#detail.set_sobject(sobject)
#div.add(detail)
div.add(img)
div.add_class("hand")
if my.SQL_ERROR:
warning_div = DivWdg('<i>-- preprocess error --</i>')
warning_div.add_styles('position: absolute; z-index: 100; float: left; top: 0; left: 0; font-size: smaller;')
div.add_style('position: relative')
div.add(warning_div)
search_key = SearchKey.get_by_sobject(sobject)
code = sobject.get_code()
detail = my.get_option("detail")
if detail != 'false':
my.add_icon_behavior(div, sobject)
if type(icon_size) == types.StringType and icon_size.endswith("%"):
img.add_style("%s: 100%%" % my.aspect )
else:
img.add_style("%s: %spx" % (my.aspect, my.get_icon_size()) )
img.add_style("min-%s: 15px" % my.aspect)
return div
示例11: get_example_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_example_display(self):
div = DivWdg(id="big_box")
div.add_styles("background: black; padding: 10px; width: 400px;")
div.add( "Sandbox for Boris -- replace contents here with own UI prototypes and tests." )
from pyasm.prod.web import ProcessSelectWdg
context_select = ProcessSelectWdg( has_empty=False,\
search_type='prod/asset')
context_select.set_name('sample_context')
div.add(context_select)
return div
示例12: get_example_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_example_display(self):
div = DivWdg()
int_edit_div = DivWdg()
int_edit_div.add_styles( "width: auto; height: auto;" )
int_edit_div.add_class( "SPT_INPUT_WRAPPER" )
int_edit = HtmlElement.input()
int_edit.set_attr("type", "text")
int_edit.set_attr("value", "856")
int_edit.set_attr("name", "int_edit")
int_edit.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'IntegerTextEdit',
'validation_warning': 'You must enter a number greater than 50',
'cbjs_validation':
'''
log.debug( "Check the value: " + value );
if( parseInt( value ) <= 50 ) {
return false;
}
return true;
'''
} )
int_edit_div.add( int_edit )
int_edit_div.add( "<img class='SPT_INPUT_VALIDATION_WARNING' src='/context/icons/silk/exclamation.png' " \
"title='' style='display: none;' />" )
int_edit_div.add( " Enter a value of 50 or less to fail validation, anything over 50 to succeed" \
" -- Integer edit example (uses 'kbd_handler_name' of 'IntegerTextEdit')" )
div.add( int_edit_div )
div.add( "<br/><br/>" )
float_edit = HtmlElement.input()
float_edit.set_attr("type", "text")
float_edit.set_attr("value", "12.45")
float_edit.set_attr("name", "int_edit")
float_edit.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'FloatTextEdit' } )
div.add( float_edit )
div.add( " Float edit example (uses 'kbd_handler_name' of 'FloatTextEdit')" )
div.add( "<br/><br/>" )
textarea = HtmlElement.textarea( 10, 40, "This is a multi-line example." )
textarea.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'MultiLineTextEdit' } )
div.add( textarea )
div.add( " Multi-line edit example (uses 'kbd_handler_name' of 'MultiLineTextEdit')" )
div.add( "<br/><br/>" )
return div
示例13: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_display(self):
if self.get_example_chooser == 'true':
return self.get_example_chooser_content()
div = DivWdg()
div.set_id("UiPlaygroundPanelWdg")
title = "UI Playground"
title_wdg = DivWdg()
title_wdg.add_looks("fnt_title_2")
title_wdg.add(title)
div.add(title_wdg)
div.add(HtmlElement.hr())
div.add( '<br/>' )
click_chooser = DivWdg()
click_chooser.add_looks("fnt_text")
click_chooser.add( " UI Examples List Popup" )
click_chooser.add_class("SPT_DTS")
click_chooser.add_styles("cursor: pointer; padding: 6px; width: 130px; background-color: black;")
click_chooser.add_behavior( {'type': 'click_up',
'cbfn_action': 'spt.popup.get_widget',
'options': { 'title': 'TACTIC™ UI Examples',
'width': '400px',
'popup_id': 'UiExamplesChooserPopup',
'popup_parent_id': 'UiPlaygroundPanelWdg',
'class_name': 'tactic.ui.panel.ui_playground_panel_wdg.' \
'UiPlaygroundPanelWdg'
},
'args': { 'get_example_chooser': 'true' }
} )
div.add( click_chooser )
div.add( '<br/>' )
example_display_div = DivWdg()
example_display_div.add_styles( "padding: 10px;" )
example_display_div.set_id("UiExampleDisplayDiv")
div.add( example_display_div )
div.add( '<br/>' )
div.add( '<br/>' )
return div
示例14: get_display_single_on_load_bvr
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_display_single_on_load_bvr(self):
class_path = Common.get_full_class_name(self)
top = DivWdg()
top.add_styles("border: 1px solid black;")
count = self.kwargs.get('count')
print "count: ", count
if count:
count = int(count)
else:
count = 0
top.add('top: %s' % count)
top.add_class('my_dynamic_add_div_%s' % count)
max = 10
if count == 0:
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
var server = TacticServerStub.get();
var widget_class = '%s';
var count = 1;
var max = %s;
var main = $('main_body');
for( var c=count; c <= max; c++ ) {
spt.app_busy.show("Dynamic Loading ...", "Loading widget with count of " + c);
var div = document.createElement('div');
args = { "count": '' + c };
html = server.get_widget(widget_class, {"args": args}) + '<br/>';
spt.behavior.replace_inner_html(div, html);
main.appendChild(div);
}
spt.app_busy.hide();
''' % (class_path, max)
} )
return top
示例15: get_example_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_styles [as 别名]
def get_example_display(self):
div = DivWdg()
dinfo_list = [
{'class_name': 'SPT_GIZMO_ONE', 'bgcolor': '#669999', 'color': '#000000'},
{'class_name': 'SPT_GIZMO_TWO', 'bgcolor': '#0099CC', 'color': '#000000'},
{'class_name': 'SPT_GIZMO_THREE', 'bgcolor': '#996666', 'color': '#000000'},
{'class_name': 'SPT_GIZMO_FOUR', 'bgcolor': '#CC9966', 'color': '#000000'}
]
for dinfo in dinfo_list:
gizmo = DivWdg()
gizmo.add_class( dinfo.get('class_name') )
gizmo.add_looks( 'fnt_serif' )
gizmo.add_styles( 'background: %s; color: %s;' % (dinfo.get('bgcolor'), dinfo.get('color')) )
gizmo.add_styles( 'width: 200px; border: 1px solid black;' )
gizmo.add( dinfo.get('class_name') )
div.add( gizmo )
div.add( '<br/><br/>' )
return div