本文整理汇总了Python中pyasm.web.HtmlElement.li方法的典型用法代码示例。如果您正苦于以下问题:Python HtmlElement.li方法的具体用法?Python HtmlElement.li怎么用?Python HtmlElement.li使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.HtmlElement
的用法示例。
在下文中一共展示了HtmlElement.li方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_folder_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_folder_wdg(my, element_name, config, options, base_path, current_path, info, personal, use_same_config):
li = HtmlElement.li()
li.add_class("spt_side_bar_link")
li.add_class("main_li")
title = my._get_title(config, element_name)
title_wdg = DivWdg()
title_wdg.add_class("menu_header")
li.add(title_wdg)
title_wdg.add(title)
ul = HtmlElement.ul()
li.add(ul)
ul.add_class("spt_side_bar_section")
ul.add_class("sub_ul")
# then get view name from options in order to read a new
# config and recurse ...
options_view_name = options.get('view')
if options_view_name:
if use_same_config:
xml = config.get_xml()
sub_config = WidgetConfig.get(xml=xml)
sub_config.set_view(options_view_name)
else:
sub_config = my.get_config( my.config_search_type, options_view_name, default=my.default, personal=personal)
info['level'] += 1
my.generate_section( sub_config, ul, info, base_path=current_path, personal=personal, use_same_config=use_same_config )
info['level'] -= 1
return li
示例2: get_out_files_list
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_out_files_list(task_data_code, task_sobject_search_key):
out_files_list = get_task_data_out_files(task_data_code)
div_wdg = DivWdg()
if out_files_list:
out_files_unordered_html_list = HtmlElement.ul()
for out_file in out_files_list:
file_li = HtmlElement.li()
file_li.add('{0} ({1})'.format(out_file.get('file_path'), out_file.get('classification').title()))
file_edit_button = ButtonNewWdg(title='Edit File', icon='EDIT')
file_edit_button.add_behavior(
obu.get_load_popup_widget_with_reload_behavior(
'Edit File', 'widgets.EditFileWdg', out_file.get_search_key(),
'Task', 'widgets.TaskInspectWdg', task_sobject_search_key
)
)
file_edit_button.add_style('display', 'inline-block')
file_li.add(file_edit_button)
out_files_unordered_html_list.add(file_li)
div_wdg.add(out_files_unordered_html_list)
else:
div_wdg.add('No output files exist for this task')
return div_wdg
示例3: get_files_list
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_files_list(self):
outer_div = DivWdg()
file_in_package_sobjects = get_file_in_package_sobjects_by_package_code(self.package_sobject.get_code())
file_sobjects = get_file_sobjects_from_file_in_package_sobjects(file_in_package_sobjects)
files_unordered_html_list = HtmlElement.ul()
for file_sobject, file_in_package_sobject in zip(file_sobjects, file_in_package_sobjects):
task_sobject = file_in_package_sobject.get_all_children('sthpw/task')[0]
file_li = HtmlElement.li()
file_li.add(file_sobject.get('file_path') + ' - ' + task_sobject.get('status'))
change_status_button = ButtonNewWdg(title='Change Status', icon='EDIT')
change_status_button.add_behavior(
obu.get_load_popup_widget_with_reload_behavior(
'Change Status', 'widgets.ChangeStatusWdg', task_sobject.get_search_key(),
'Package', 'widgets.PackageInspectWdg', self.package_sobject.get_search_key()
)
)
change_status_button.add_style('display', 'inline-block')
file_li.add(change_status_button)
files_unordered_html_list.add(file_li)
outer_div.add(files_unordered_html_list)
return outer_div
示例4: get_selected_department_instructions_section
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_selected_department_instructions_section(self):
department_instructions_list = HtmlElement.ul()
department_instructions_list.add_style('list-style-type', 'none')
department_instructions_sobjects = get_department_instructions_sobjects_for_instructions_template_code(
self.instructions_template_sobject.get_code())
for department_instructions_sobject in department_instructions_sobjects:
li = HtmlElement.li()
li.add(self.get_div_for_department_instructions(department_instructions_sobject))
department_instructions_list.add(li)
return department_instructions_list
示例5: get_title_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_title_wdg(my, element_name, config, options):
li = HtmlElement.li()
li.add_class("spt_side_bar_title")
li.add_class("main_title")
title = my._get_title(config, element_name)
title_wdg = DivWdg()
title_wdg.add_class("menu_header")
li.add(title_wdg)
title_wdg.add(title)
li.add_style("list-style-type: none")
li.add_style("display: block")
li.add_style("font-weight: bold")
return li
示例6: get_equipment_list
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_equipment_list(task_data_code):
equipment_sobjects_list = get_task_data_equipment(task_data_code)
div_wdg = DivWdg()
if equipment_sobjects_list:
equipment_unordered_html_list = HtmlElement.ul()
for name in [equipment_sobject.get('name') for equipment_sobject in equipment_sobjects_list]:
equipment_li = HtmlElement.li()
equipment_li.add(name)
equipment_unordered_html_list.add(equipment_li)
div_wdg.add(equipment_unordered_html_list)
else:
div_wdg.add('No equipment is assigned to this task')
return div_wdg
示例7: get_folder_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_folder_wdg(self, element_name, config, options, base_path, current_path, info, personal, use_same_config):
attributes = config.get_element_attributes(element_name)
if attributes.get("is_visible") == "false":
return
li = HtmlElement.li()
li.add_class("spt_side_bar_link")
li.add_class("main_li unselectable")
title = self._get_title(config, element_name)
title_wdg = DivWdg()
title_wdg.add_class("menu_header")
li.add(title_wdg)
title_wdg.add(title)
ul = HtmlElement.ul()
li.add(ul)
ul.add_class("spt_side_bar_section")
ul.add_class("sub_ul unselectable")
ul.add_style('cursor','pointer')
# then get view name from options in order to read a new
# config and recurse ...
options_view_name = options.get('view')
if options_view_name:
if use_same_config:
xml = config.get_xml()
sub_config = WidgetConfig.get(xml=xml)
sub_config.set_view(options_view_name)
else:
sub_config = self.get_config( self.config_search_type, options_view_name, default=self.default, personal=personal)
info['level'] += 1
self.generate_section( sub_config, ul, info, base_path=current_path, personal=personal, use_same_config=use_same_config )
info['level'] -= 1
return li
示例8: get_link_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_link_wdg(my, element_name, config, options, info):
li = HtmlElement.li()
li.add_class("spt_side_bar_link")
level = info.get("level")
if level == 1:
li.add_class("menu_header")
li.add_class("main_link")
else:
li.add_class("sub_li")
title = my._get_title(config, element_name)
attributes = config.get_element_attributes(element_name)
show_icons = my.kwargs.get("show_icons")
if show_icons in [True, 'true']:
icon = attributes.get("icon")
if not icon:
icon = "view"
icon_path = IconWdg.get_icon_path(icon.upper())
li.add(HtmlElement.img(icon_path))
li.add(" ")
link_mode = my.kwargs.get("link_mode")
if not link_mode:
use_href = my.kwargs.get("use_href")
if use_href in ['true', True]:
link_mode = 'href'
link_mode = 'tab'
target = my.kwargs.get("target")
if not target:
target = ".spt_content"
else:
if target[0] not in [".", "#"]:
target = ".%s" % target
link = "/tab/%s" % (element_name)
#link = "/link/%s" % (element_name)
li.add_attr("spt_link", link)
if link_mode == 'href':
project_code = Project.get_project_code()
#li.add("<a href='/tactic/%s/#/tab/%s'>%s</a>" % (project_code, element_name, title) )
li.add("<a>%s</a>" % title)
li.add_behavior( {
'type': 'click_up',
'bvr_repeat_interval': 3,
'title': title,
'link': link,
'target': target,
'cbjs_action': '''
var content = $(document).getElement(bvr.target);
spt.app_busy.show("Loading link "+bvr.title);
spt.panel.load_link(content, bvr.link);
spt.app_busy.hide();
'''
} )
elif link_mode == 'tab':
# find the tab below the target
li.add("<a>%s</a>" % title)
li.add_behavior( {
'type': 'click_up',
'bvr_repeat_interval': 3,
'title': title,
'link': link,
'element_name': element_name,
'target': target,
'cbjs_action': '''
var content = $(document).getElement(bvr.target);
var tab_top = null;;
// check if there even is a tab
if (spt.tab) {
tab_top = spt.tab.set_tab_top(content);
}
if (tab_top) {
setTimeout( function() {
spt.app_busy.show("Loading link "+bvr.title);
}, 0 );
var link = bvr.src_el.getAttribute("spt_link");
var class_name = 'tactic.ui.panel.HashPanelWdg';
var kwargs = {
hash: link
}
spt.tab.add_new(bvr.element_name,bvr.title,class_name,kwargs);
}
else {
spt.app_busy.show("Loading link "+bvr.title);
spt.panel.load_link(content, bvr.link);
}
spt.app_busy.hide();
'''
#.........这里部分代码省略.........
示例9: get_link_wdg
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import li [as 别名]
def get_link_wdg(self, element_name, config, options, info):
attributes = config.get_element_attributes(element_name)
if attributes.get("is_visible") == "false":
return
if options.get("popup") in [True, 'true']:
popup = True
else:
popup = False
#display_options = config.get_display_options(element_name)
#class_name = display_options.get("class_name")
#print element_name
#print display_options
#print class_name
#print "---"
li = HtmlElement.li()
li.add_class("spt_side_bar_link")
level = info.get("level")
if level == 1:
li.add_class("menu_header")
li.add_class("main_link unselectable")
else:
li.add_class("sub_li")
title = self._get_title(config, element_name)
show_icons = self.kwargs.get("show_icons")
if show_icons in [True, 'true']:
icon = attributes.get("icon")
if not icon:
icon = "view"
icon_path = IconWdg.get_icon_path(icon.upper())
li.add(HtmlElement.img(icon_path))
li.add(" ")
link_mode = self.kwargs.get("link_mode")
if not link_mode:
use_href = self.kwargs.get("use_href")
if use_href in ['true', True]:
link_mode = 'href'
link_mode = 'tab'
target = self.kwargs.get("target")
if not target:
target = ".spt_content"
else:
if target[0] in ["."]:
target = target[1:]
#link = "/link/%s" % (element_name)
link = "/tab/%s" % (element_name)
li.add_attr("spt_link", link)
if link_mode == 'href':
project_code = Project.get_project_code()
#li.add("<a href='/tactic/%s/#/tab/%s'>%s</a>" % (project_code, element_name, title) )
li.add("<a>%s</a>" % title)
li.add_behavior( {
'type': 'click_up',
'bvr_repeat_interval': 3,
'title': title,
'link': link,
'target': target,
'cbjs_action': '''
var target_class = bvr.target;
if (target_class.indexOf("#") != -1) {
var target = $(document.body).getElement(target_class);
}
else if (target_class.indexOf(".") != -1) {
var parts = target_class.split(".");
var top = bvr.src_el.getParent("."+parts[0]);
var target = top.getElement("."+parts[1]);
}
else {
var target = $(document.body).getElement("."+target_class);
}
//var content = $(document).getElement(bvr.target);
var content = target;
spt.app_busy.show("Loading link "+bvr.title);
spt.panel.load_link(content, bvr.link);
spt.app_busy.hide();
'''
} )
elif link_mode == 'tab':
# find the tab below the target
#.........这里部分代码省略.........