本文整理汇总了Python中pyasm.search.Search.get_columns方法的典型用法代码示例。如果您正苦于以下问题:Python Search.get_columns方法的具体用法?Python Search.get_columns怎么用?Python Search.get_columns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.Search
的用法示例。
在下文中一共展示了Search.get_columns方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_columns [as 别名]
def get_display(my):
return ''
search_types = 'MMS/discipline.MMS/product_type'.split(".")
top = DivWdg()
parents = None
for search_type in search_types:
if not parents:
search = Search(search_type)
sobjects = search.get_sobjects()
columns = search.get_columns()
column = columns[1]
select = SelectWdg(search_type)
select.set_option("values", [x.get_id() for x in sobjects] )
select.set_option("labels", [x.get_value(column) for x in sobjects] )
top.add(select)
else:
for parent in parents:
search = Search(search_type)
search.add_relationship_filter(parent)
sobjects = search.get_sobjects()
if not sobjects:
continue
columns = search.get_columns()
column = columns[1]
values = [x.get_id() for x in sobjects]
labels = [x.get_value(column) for x in sobjects]
select = SelectWdg(search_type)
select.add_attr("spt_input_key", parent.get_id() )
select.set_option("values", values )
select.set_option("labels", labels )
top.add(select)
parents = sobjects
return top
示例2: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_columns [as 别名]
#.........这里部分代码省略.........
table.add_row_cell(HtmlElement.br())
tr = table.add_row()
tr.add_style('border-bottom: 1px groove #777')
td = table.add_cell(master_cb)
label = HtmlElement.i('toggle all')
label.add_style('color: #888')
table.add_cell(label)
col1 = table.add_col()
col1.add_style('width: 35px')
col2 = table.add_col()
if not my.search_type or not my.view:
return table
# use overriding element names and derived titles if available
config = WidgetConfigView.get_by_search_type(my.search_type, my.view)
if my.element_names and config:
filtered_columns = my.element_names
titles = []
for name in my.element_names:
title = config.get_element_title(name)
titles.append(title)
else:
# excluding FunctionalTableElement
filtered_columns = []
titles = []
if not config:
columns = search.get_columns()
filtered_columns = columns
titles = ['n/a'] * len(filtered_columns)
else:
columns = config.get_element_names()
filtered_columns = columns
titles = config.get_element_titles()
"""
# commented out until it is decided 2.5 widgets will
# use this class to differentiate between reg and functional element
from pyasm.widget import FunctionalTableElement
for column in columns:
widget = config.get_display_widget(column)
if isinstance(widget, FunctionalTableElement):
continue
filtered_columns.append(column)
"""
for idx, column in enumerate(filtered_columns):
table.add_row()
cb = CheckboxWdg(cb_name)
cb.set_option('value', column)
cb.set_checked()
table.add_cell(cb)
title = titles[idx]
table.add_cell('<b>%s</b> (%s) '%(title, column))
示例3: get_tables_wdg
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_columns [as 别名]
def get_tables_wdg(self):
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 as e:
div.add("Could not connect")
div.add_style("padding: 30px")
div.add("<br/>"*2)
div.add(str(e))
return div
# Bind project to this resource
database_text = TextWdg("database")
div.add("Database: ")
div.add(database_text)
div.add("<br/>"*2)
project_text = TextWdg("project")
div.add("Project Code: ")
div.add(project_text)
div.add("<br/>")
div.add("<hr/>")
# connect and introspect the tables in this database
tables = connect.get_tables()
table = Table()
div.add(table)
table.set_max_width()
for table_name in tables:
table.add_row()
search_type = "table/%s?project=%s" % (table_name, project_code)
td = table.add_cell()
icon = IconWdg("View Table", IconWdg.FOLDER_GO)
td.add(icon)
icon.add_behavior( {
'type': 'click_up',
'search_type': search_type,
'cbjs_action': '''
var class_name = 'tactic.ui.panel.ViewPanelWdg';
var kwargs = {
search_type: bvr.search_type
}
spt.panel.load_popup("table", class_name, kwargs);
'''
} )
td = table.add_cell()
td.add(table_name)
td = table.add_cell()
search = Search(search_type)
count = search.get_count()
td.add(" %s item/s" % count)
columns = search.get_columns()
td = table.add_cell()
td.add(columns)
# search_type
td = table.add_cell()
text = TextWdg("search_type")
td.add(text)
new_search_type = "%s/%s" % (project_code, table_name)
text.set_value(new_search_type)
register_div = DivWdg()
div.add(register_div)
register_div.add_style("padding: 20px")
#.........这里部分代码省略.........