本文整理汇总了Python中pyasm.search.SearchType.build_search_type方法的典型用法代码示例。如果您正苦于以下问题:Python SearchType.build_search_type方法的具体用法?Python SearchType.build_search_type怎么用?Python SearchType.build_search_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.SearchType
的用法示例。
在下文中一共展示了SearchType.build_search_type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from pyasm.search import SearchType [as 别名]
# 或者: from pyasm.search.SearchType import build_search_type [as 别名]
def init(my):
my.search_type = my.kwargs.get('search_type')
# reconstruct the full search_type if it's base SType
if my.search_type.find("?") == -1:
project_code = Project.get_project_code()
my.search_type = SearchType.build_search_type(my.search_type, project_code)
my.view = my.kwargs.get('view')
my.element_names = my.kwargs.get('element_names')
my.related_view = my.kwargs.get('related_view')
my.search_class = my.kwargs.get('search_class')
my.search_view = my.kwargs.get('search_view')
my.simple_search_view = my.kwargs.get('simple_search_view')
my.mode = my.kwargs.get('mode')
my.close_cbfn = my.kwargs.get('close_cbfn')
my.input_search_keys = my.kwargs.get('selected_search_keys')
my.selected_search_keys = []
my.error_msg = ''
my.search_type_list = []
示例2: get_display
# 需要导入模块: from pyasm.search import SearchType [as 别名]
# 或者: from pyasm.search.SearchType import build_search_type [as 别名]
def get_display(my):
element_data_dict = {}
config = my.get_config()
element_names = config.get_element_names()
content_wdg = DivWdg()
if not element_names:
element_names = ['keywords']
my.set_content(content_wdg)
# this is somewhat duplicated logic from alter_search, but since this is called
# in ViewPanelWdg, it's a diff instance and needs to retrieve again
filter_data = FilterData.get()
data_list = filter_data.get_values_by_prefix(my.prefix)
for data in data_list:
handler = data.get("handler")
element_name = data.get("element_name")
if not element_name:
continue
element_data_dict[element_name] = data
elements_wdg = DivWdg()
content_wdg.add(elements_wdg)
elements_wdg.add_color("color", "color")
elements_wdg.add_style("padding-top: 10px")
elements_wdg.add_style("padding-bottom: 15px")
elements_wdg.add_color("background", "background3", 0)
elements_wdg.add_border()
if len(element_names) == 1:
elements_wdg.add_style("border-width: 0px 0px 0px 0px" )
elements_wdg.add_style("padding-right: 50px" )
else:
elements_wdg.add_style("border-width: 0px 1px 0px 0px" )
table = Table()
table.add_color("color", "color")
elements_wdg.add(table)
table.add_class("spt_simple_search_table")
num_rows = int(len(element_names)/2)+1
tot_rows = int(len(element_names)/2)+1
project_code = Project.get_project_code()
# my.search_type could be the same as my.base_search_type
full_search_type = SearchType.build_search_type(my.search_type, project_code)
visible_rows = my.kwargs.get("visible_rows")
if visible_rows:
visible_rows = int(visible_rows)
num_rows = visible_rows
else:
visible_rows = 0
titles = config.get_element_titles()
row_count = 0
for i, element_name in enumerate(element_names):
attrs = config.get_element_attributes(element_name)
if i % 2 == 0:
if visible_rows and row_count == visible_rows:
tr, td = table.add_row_cell("+ more ...")
td.add_class("hand")
td.add_class("SPT_DTS")
td.add_class("spt_toggle")
td.add_style("padding-left: 10px")
td.add_behavior( {
'type': 'click_up',
'visible_rows': visible_rows,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_simple_search_table");
var expand = true;
var rows = top.getElements(".spt_simple_search_row");
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
if (row.getStyle("display") == "none") {
row.setStyle("display", "");
}
else {
row.setStyle("display", "none");
expand = false;
}
}
var spacer = top.getElements(".spt_spacer");
var cell = top.getElement(".spt_toggle");
if (expand) {
spacer.setStyle("height", (rows.length+bvr.visible_rows)*20);
cell.innerHTML = "- less ...";
}
else {
spacer.setStyle("height", bvr.visible_rows*20);
#.........这里部分代码省略.........
示例3: get_display
# 需要导入模块: from pyasm.search import SearchType [as 别名]
# 或者: from pyasm.search.SearchType import build_search_type [as 别名]
def get_display(my):
element_data_dict = {}
config = my.get_config()
element_names = config.get_element_names()
content_wdg = DivWdg()
if not element_names:
element_names = ['keywords']
my.set_content(content_wdg)
# this is somewhat duplicated logic from alter_search, but since this is called
# in ViewPanelWdg, it's a diff instance and needs to retrieve again
filter_data = FilterData.get()
data_list = filter_data.get_values_by_prefix(my.prefix)
for data in data_list:
handler = data.get("handler")
element_name = data.get("element_name")
if not element_name:
continue
element_data_dict[element_name] = data
elements_wdg = DivWdg()
content_wdg.add(elements_wdg)
elements_wdg.add_color("color", "color")
elements_wdg.add_style("padding-top: 10px")
elements_wdg.add_style("padding-bottom: 15px")
elements_wdg.add_color("background", "background3", 0)
elements_wdg.add_border()
if len(element_names) == 1:
elements_wdg.add_style("border-width: 0px 0px 0px 0px" )
elements_wdg.add_style("padding-right: 50px" )
else:
elements_wdg.add_style("border-width: 0px 1px 0px 0px" )
table = Table()
table.add_color("color", "color")
elements_wdg.add(table)
num_rows = int(len(element_names)/2)+1
project_code = Project.get_project_code()
# my.search_type could be the same as my.base_search_type
full_search_type = SearchType.build_search_type(my.search_type, project_code)
titles = config.get_element_titles()
for i, element_name in enumerate(element_names):
attrs = config.get_element_attributes(element_name)
if i % 2 == 0:
table.add_row()
icon_td = table.add_cell()
title_td = table.add_cell()
element_td =table.add_cell()
# show the title
title_td.add_style("text-align: right")
title_td.add_style("padding-right: 5px")
title_td.add_style("min-width: 100px")
element_wdg = DivWdg()
if attrs.get('view') == 'false':
element_wdg.add_style('display: none')
element_td.add(element_wdg)
#title_td.add_style("border: solid 1px red")
#element_td.add_style("border: solid 1px blue")
#element_wdg.add_style("border: solid 1px yellow")
if i == 0 and len(element_names) > 1:
spacer = DivWdg()
spacer.add_style("border-style: solid")
spacer.add_style("border-width: 0 1 0 0")
spacer.add_style("height: %spx" % (num_rows*20))
spacer.add_style("width: 10px")
spacer.add_style("border-color: %s" % spacer.get_color("border") )
spacer.add(" ")
td = table.add_cell(spacer)
td.add_attr("rowspan", num_rows)
#element_wdg.add_color("color", "color3")
#element_wdg.add_color("background", "background3")
#element_wdg.set_round_corners()
#element_wdg.add_border()
element_wdg.add_style("padding: 4px 10px 4px 5px")
element_wdg.add_class("spt_table_search")
element_wdg.add_style("margin: 1px")
element_wdg.add_style("min-height: 20px")
element_wdg.add_style("min-width: 250px")
#.........这里部分代码省略.........
示例4: get_display
# 需要导入模块: from pyasm.search import SearchType [as 别名]
# 或者: from pyasm.search.SearchType import build_search_type [as 别名]
def get_display(self):
element_data_dict = {}
config = self.get_config()
element_names = config.get_element_names()
content_wdg = DivWdg()
content_wdg.add_class("spt_simple_search_top")
onload_js = DivWdg()
content_wdg.add(onload_js)
onload_js.add_behavior( {
'type': 'load',
'cbjs_action': self.get_onload_js()
} )
if not element_names:
element_names = ['keywords']
self.set_content(content_wdg)
# this is somewhat duplicated logic from alter_search, but since this is called
# in ViewPanelWdg, it's a diff instance and needs to retrieve again
filter_data = FilterData.get()
filter_view = self.kwargs.get("filter_view")
if filter_view:
search = Search("config/widget_config")
search.add_filter("view", filter_view)
search.add_filter("category", "search_filter")
search.add_filter("search_type", self.search_type)
filter_config = search.get_sobject()
if filter_config:
filter_xml = filter_config.get_xml_value("config")
filter_value = filter_xml.get_value("config/filter/values")
if filter_value:
data_list = jsonloads(filter_value)
else:
data_list = filter_data.get_values_by_prefix(self.prefix)
for data in data_list:
handler = data.get("handler")
element_name = data.get("element_name")
if not element_name:
continue
element_data_dict[element_name] = data
elements_wdg = DivWdg()
content_wdg.add(elements_wdg)
elements_wdg.add_color("color", "color")
elements_wdg.add_style("padding-top: 10px")
elements_wdg.add_style("padding-bottom: 15px")
#elements_wdg.add_color("background", "background3", 0)
elements_wdg.add_color("background", "background", -3)
elements_wdg.add_border()
if len(element_names) == 1:
elements_wdg.add_style("border-width: 0px 0px 0px 0px" )
elements_wdg.add_style("padding-right: 50px" )
else:
elements_wdg.add_style("border-width: 0px 0px 0px 0px" )
table = Table()
table.add_color("color", "color")
elements_wdg.add(table)
table.add_class("spt_simple_search_table")
columns = self.kwargs.get("columns")
if not columns:
columns = 2
else:
columns = int(columns)
num_rows = int(len(element_names)/columns)+1
tot_rows = int(len(element_names)/columns)+1
project_code = Project.get_project_code()
# self.search_type could be the same as self.base_search_type
full_search_type = SearchType.build_search_type(self.search_type, project_code)
visible_rows = self.kwargs.get("visible_rows")
if visible_rows:
visible_rows = int(visible_rows)
num_rows = visible_rows
else:
visible_rows = 0
titles = config.get_element_titles()
#.........这里部分代码省略.........