本文整理汇总了Python中pyasm.web.DivWdg.add_style方法的典型用法代码示例。如果您正苦于以下问题:Python DivWdg.add_style方法的具体用法?Python DivWdg.add_style怎么用?Python DivWdg.add_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.DivWdg
的用法示例。
在下文中一共展示了DivWdg.add_style方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tools_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_tools_wdg(my):
div = DivWdg()
div.set_name("Tools")
div.add_style("padding: 10px")
div.add("This tool will export out a version of the project")
button = ActionButtonWdg(title="Export")
div.add(button)
button.add_behavior( {
'type': 'click_up',
'server': my.server_code,
'cbjs_action': '''
var class_name = 'tactic.ui.sync.SyncCreateTemplateCmd';
var kwargs = {
server: bvr.server
}
spt.app_busy.show("Exporting project ...");
var server = TacticServerStub.get();
server.execute_cmd(class_name, kwargs);
spt.app_busy.hide();
spt.panel.refresh(bvr.src_el);
'''
} )
return div
示例2: generate_div
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def generate_div(self):
''' this is meant to be called to get the container div for the
ajax widget '''
div = DivWdg()
div.set_id(self.display_id)
div.add_style("display: block")
return div
示例3: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [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
示例4: get_category_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_category_wdg(self, paths, title=None, tags={}):
div = DivWdg()
if not paths:
paths = []
base_dir = self.kwargs.get("base_dir")
if not title:
title = "Paths"
count = len(paths)
div.add("%s (%s)<hr/>" % (title, count) )
if not paths:
div.add("-- None --<br/>")
paths_div = DivWdg()
div.add(paths_div)
paths_div.add_style("max-height: 500px")
paths_div.add_style("overflow-y: auto")
paths_div.add_style("overflow-x: auto")
for path in paths:
path_div = DivWdg()
paths_div.add(path_div)
rel_path = path.replace("%s/" % base_dir, "")
path_div.add(rel_path)
if tags:
path_tags = tags.get(path)
path_div.add( " "*10)
path_div.add(path_tags['sobject'])
return div
示例5: get_section_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_section_wdg(my, view, editable=True, default=False):
title = ""
if editable:
edit_mode = "edit"
else:
edit_mode = "read"
kwargs = {
"title": title,
"config_search_type": my.search_type,
"view": view,
"width": "300",
"mode": edit_mode,
"default": str(default),
}
if view in ["definition", "custom_definition"]:
kwargs["recurse"] = "false"
from view_section_wdg import ViewSectionWdg
section_wdg = ViewSectionWdg(**kwargs)
class_path = Common.get_full_class_name(section_wdg)
section_div = DivWdg(css="spt_panel")
section_div.add_style("display: block")
section_div.set_attr("spt_class_name", class_path)
for name, value in kwargs.items():
if name == "config":
continue
section_div.set_attr("spt_%s" % name, value)
section_div.add(section_wdg)
return section_div
示例6: get_header_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_header_wdg(my):
outer = DivWdg()
div = DivWdg()
outer.add(div)
div.add_color("background", "background3")
div.add_style("padding: 5px")
div.add_border()
table = Table()
table.add_style("margin-left: auto")
table.add_style("margin-right: auto")
table.add_color("color", "color")
table.add_style("font-size: 1.5em")
table.add_style("font-weight: bold")
table.add_row()
# add the month navigators
date_str = "%s, %s" % (my.MONTHS[my.month - 1], my.year)
month_wdg = DivWdg()
month_wdg.add_style("width: 150px")
month_wdg.add(date_str)
prev_month_wdg = my.get_prev_month_wdg()
next_month_wdg = my.get_next_month_wdg()
table.add_cell(prev_month_wdg)
td = table.add_cell(month_wdg)
td.add_style("text-align: center")
table.add_cell(next_month_wdg)
div.add(table)
return outer
示例7: get_tables_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_tables_wdg(my):
div = DivWdg()
div.set_name("Tables")
div.add("In order to fully register a database, you must bind it to a TACTIC project")
div.add("<br/>")
project_code = "mongodb"
database = "test_database"
db_resource = DbResource(
server='localhost',
vendor='MongoDb',
database=database
)
try:
connect = DbContainer.get(db_resource)
except Exception, e:
div.add("Could not connect")
div.add_style("padding: 30px")
div.add("<br/>"*2)
div.add(str(e))
return div
示例8: get_save_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_save_wdg(my):
# add the popup
popup = PopupWdg(id="save_search_wdg")
popup.add("Save Search", "title")
div = DivWdg()
div.add("Save current search as: ")
text = TextWdg("save_search_text")
text.set_id("save_search_text")
div.add(text)
save_button = ButtonWdg("Save Search")
behavior = {"type": "click", "mouse_btn": "LMB", "cbjs_action": "spt.dg_table.save_search_cbk(evt, bvr);"}
save_button.add_behavior(behavior)
cancel_button = ButtonWdg("Cancel")
cancel_button.add_event("onclick", "$('save_search_wdg').style.display = 'none'")
div.add(HtmlElement.hr())
button_div = DivWdg()
button_div.add_style("text-align: center")
button_div.add(save_button)
button_div.add(" ")
button_div.add(cancel_button)
div.add(button_div)
popup.add(div, "content")
return popup
示例9: IframePlainWdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
class IframePlainWdg(IframeWdg):
''' a plain iframe to be opened within an iframe '''
def init(self):
self.img_span_name = self.generate_unique_id('loadingplain')
self.name = "iframeplain_%s" % (self.generate_unique_id())
self.iframe = HtmlElement.iframe()
self.iframe.set_id(self.name)
self.iframe.set_attr('name',self.name)
self.div = DivWdg(css='iframe_plain')
self.div.add_style('display','none')
self.div.set_id("iframeplain_cont_%s" % (self.generate_unique_id()))
self.div.add(self.iframe)
self.add(self.div)
self.add(self._get_loading_span())
def get_on_script(self, src, dynamic_element=[]):
'''A script to display the iframe. this is not called on init'''
scripts = []
cont_on_script = "toggle_display('%s')" %self.div.get_id()
iframe_script = "IframeLoader_display('%s','%s','%s','%s')" % \
(self.img_span_name, self.name, src, '||'.join(dynamic_element))
scripts.append(iframe_script)
scripts.append(cont_on_script)
resize_iframe = IframeWdg.get_resize_script(self.name, self.width)
scripts.append(resize_iframe)
return ";".join(scripts)
def get_off_script(self):
return "toggle_display('%s')" %self.div.get_id()
示例10: get_section_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_section_wdg(my, sobject):
parent_key = SearchKey.get_by_sobject(sobject)
section_id = "wow"
title = ""
view = "children"
target_id = "sobject_relation"
kwargs = {
'section_id': section_id,
'title': title,
'view': view,
'target_id': target_id,
'width': '125',
'parent_key': parent_key
}
section_div = DivWdg()
section_div.add_style("display: block")
section_div.set_id(section_id)
section_div.set_attr('spt_class_name', "tactic.ui.panel.ChildrenBookmarkMenuWdg")
for name, value in kwargs.items():
if name == "config":
continue
section_div.set_attr("spt_%s" % name, value)
section_wdg = SObjectChildrenMenuWdg(**kwargs)
section_div.add(section_wdg)
return section_div
示例11: get_schedule_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_schedule_wdg(my):
div = DivWdg()
div.add_style("width: 500px")
div.add_style("height: 500px")
div.add("Click on a user to display their schedule")
return div
示例12: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_display(self):
top = self.top
height = self.get_option('height')
if not height:
height = 300
inner = DivWdg()
top.add(inner)
inner.add_style("overflow-y: auto")
inner.add_style("overflow-x: hidden")
inner.add_style("width: 100%")
inner.add_style("max-height: %s" % height)
inner.add_style("margin-right: -3px")
sobject = self.get_current_sobject()
column = self.get_option("column")
if not column:
column = self.get_name()
if sobject:
html = sobject.get_json_value( column ) or ""
else:
html = ""
inner.add(html)
return top
示例13: get_group_bottom_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_group_bottom_wdg(self, sobjects):
summary = self.get_option("total_summary")
if not summary:
return None
# parse the expression
self.vars = self.get_vars()
expression, title = self.get_expression(summary)
try:
result = Search.eval(expression, sobjects=sobjects, vars=self.vars)
except Exception as e:
print("WARNING: ", e.message)
result = "Calculation Error"
title = ''
"""
widget_type = self.get_option("type")
if widget_type in ['date','time']:
name = self.get_name()
if not SObject.is_day_column(name):
result = SPTDate.convert_to_local(result)
result= str(result)
"""
format = self.get_option('format')
formatted_result = self.get_format_value( result, format )
div = DivWdg()
div.add(str(formatted_result))
div.add_style("text-align: right")
return div, result
示例14: get_save_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_save_wdg(self):
div = DivWdg()
div.add("Save current search as: ")
text = TextWdg("save_search_text")
text.set_id("save_search_text")
div.add(text)
save_button = ButtonWdg("Save Search")
behavior = {
'cbjs_action': 'spt.table.save_search();'
}
save_button.add_behavior( behavior )
cancel_button = ButtonWdg("Cancel")
cancel_button.add_event("onclick", "$('save_search_wdg').style.display = 'none'")
div.add(HtmlElement.hr())
button_div = DivWdg()
button_div.add_style("text-align: center")
button_div.add(save_button)
button_div.add(" ")
button_div.add(cancel_button)
div.add(button_div)
return div
示例15: get_section_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_style [as 别名]
def get_section_wdg(self, view, title='', editable=True, default=False):
'''editable really means draggable'''
if not title:
title = view
target_id = "sobject_relation"
if editable:
edit_mode = 'edit'
else:
edit_mode = 'read'
kwargs = {
'title': title,
'view': view,
'target_id': target_id,
'width': '300',
'prefix': 'manage_side_bar',
'mode': edit_mode,
'default': str(default),
'config_search_type': self.search_type
}
if view == "database_definition":
kwargs['recurse'] = "false"
id = "ManageSearchTypeMenuWdg_" + view
section_div = DivWdg(id=id, css='spt_panel')
section_div.add_style("display: block")
section_div.set_attr('spt_class_name', "tactic.ui.panel.ManageSearchTypeMenuWdg")
for name, value in kwargs.items():
if name == "config":
continue
section_div.set_attr("spt_%s" % name, value)
section_wdg = ManageSearchTypeMenuWdg(**kwargs)
section_div.add(section_wdg)
return section_div