本文整理汇总了Python中pyasm.search.Search.set_limit方法的典型用法代码示例。如果您正苦于以下问题:Python Search.set_limit方法的具体用法?Python Search.set_limit怎么用?Python Search.set_limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.Search
的用法示例。
在下文中一共展示了Search.set_limit方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import set_limit [as 别名]
def get_display(self):
sobject = self.get_current_sobject()
sobject = sobject.get_parent()
if not sobject:
return Widget()
# get all of the sobject_logs
search = Search("sthpw/sobject_log")
search.add_sobject_filter(sobject)
logs = search.get_sobjects()
search = Search("sthpw/transaction_log")
search.add_filters("id", [x.get_value("transaction_log_id") for x in logs] )
search.set_limit(200)
logs = search.get_sobjects()
from layout_wdg import TableWdg
widget = Widget()
table = TableWdg("sthpw/transaction_log")
table.add_class("minimal")
table.set_header_flag(False)
table.set_show_property(False)
table.set_no_results_wdg( " " )
table.set_sobjects(logs)
widget.add(table)
return widget
示例2: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import set_limit [as 别名]
def get_display(my):
widget = Widget()
# get all of the sources, add reverse timestamp order
search = Search("prod/texture_source")
search.add_order_by("timestamp")
search.set_limit(10)
sources = search.get_sobjects()
if sources:
widget.add(HtmlElement.b("Predefined Sources:"))
widget.add(HtmlElement.br())
for source in sources:
search_key = source.get_search_key()
checkbox = CheckboxWdg("predefined_source")
checkbox.set_option("value",search_key)
widget.add(checkbox)
widget.add(source.get_value("code"))
widget.add(SpanWdg(">>", css='med'))
widget.add(source.get_value("description"))
widget.add("<br/>")
# or add a new one
widget.add(HtmlElement.b("New Source:"))
upload_wdg = SimpleUploadWdg("add_source")
widget.add(upload_wdg)
return widget
示例3: _test_result
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import set_limit [as 别名]
def _test_result(self):
search = Search('sthpw/notification_log')
search.add_order_by('timestamp desc')
search.set_limit(7)
note = search.get_sobjects()
message=[]
for i in range(6):
temp_value = note[i].get_value('subject')
message.append(temp_value)
self.assertEquals("TACTIC Unittest 001: a new item has been added.", message[0])
self.assertEquals("TACTIC Unittest 002: an item has been updated.", message[1])
self.assertEquals("TACTIC Unittest 003: New notes added.", message[2])
self.assertEquals("TACTIC Unittest 004: New task assigned.", message[3])
self.assertEquals("TACTIC Unittest 005: task status has been changed.", message[4])
self.assertEquals("TACTIC Unittest 006: Files are checked in.", message[5])
示例4: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import set_limit [as 别名]
#.........这里部分代码省略.........
td.add_style("border-right: solid 1px")
# notes
title = DivWdg()
title.add_class("maq_search_bar")
x = DivWdg("[x]")
x.add_style("float: right")
title.add(x)
title.add("Notes")
td.add(title)
discussion_wdg = DiscussionWdg()
discussion_wdg.preprocess()
discussion_wdg.set_sobject(sobject)
td.add(discussion_wdg)
td = table.add_cell()
td.add_style("vertical-align: top")
td.add_style("padding-left: 5px")
td.add_style("border-right: solid 1px")
# tasks
title = DivWdg()
title.add_class("maq_search_bar")
x = DivWdg("[x]")
x.add_style("float: right")
title.add(x)
title.add("Custom Properties")
td.add(title)
search = Search("prod/custom_property")
search.add_filter("search_type", "sample3d/book")
sobjects = search.get_sobjects()
table = TableLayoutWdg(search_type="prod/custom_property", view='table')
table.set_sobjects(sobjects)
td.add(table)
div.add(HtmlElement.hr())
div.add(HtmlElement.br(clear="all"))
title_wdg = DivWdg()
title_wdg.add_class("maq_search_bar")
x = DivWdg("[x]")
x.add_style("float: right")
title_wdg.add(x)
#title_wdg.add_style("font-size: 1.5em")
title_wdg.add("Detail" )
div.add(title_wdg)
div.add(HtmlElement.br())
# TEST getting schema
search_type = sobject.get_base_search_type()
schema = Schema.get_by_sobject(sobject)
# add a second table
table = Table()
table.set_max_width()
# show the snapshots for this sobject
search_type = "sthpw/snapshot"
search = Search(search_type)
search.add_sobject_filter(sobject)
search.set_limit(50)
sobjects = search.get_sobjects()
table.add_row()
nav_td = table.add_cell()
nav_td.add_style("width: 100px")
nav_td.add_style("vertical-align: top")
#section_wdg = my.get_section_wdg(sobject)
#nav_td.add( section_wdg )
#from tactic.ui.panel import ManageViewPanelWdg
#defined = ManageViewPanelWdg()
from tactic.ui.panel import ManageViewWdg
defined = ManageViewWdg()
nav_td.add(defined)
#content_wdg = TableLayoutWdg(search_type=search_type, view='table')
#content_wdg.set_sobjects(sobjects)
#content_td = table.add_cell()
#content_td.set_id("sobject_relation")
#content_td.add_style("display: table-cell")
#content_td.add_style("vertical-align: top")
#content_td.add(content_wdg)
div.add(table)
return div
示例5: DivWdg
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import set_limit [as 别名]
widget.add("<h3>Example View [%s]</h3>" % view)
# add a general filter
filter_div = DivWdg()
for i in range(0, 1):
filter = GeneralFilterWdg()
filter.set_columns_from_search_type(search_type)
filter_div.add("Filter: ")
filter_div.add(filter)
# filter_div.add(IconWdg("Remove Filter", IconWdg.RETIRE))
filter_div.add(HtmlElement.br(2))
widget.add(filter_div)
search = Search(search_type)
search.set_limit(5)
filter.alter_search(search)
if not handler:
if view in ["edit", "insert"]:
table = EditWdg(search_type, view)
else:
table = TableWdg(search_type, view)
else:
table = eval("%s(search_type,view)" % handler)
# table.alter_search(search)
sobjects = search.get_sobjects()
if not sobjects and view in ["edit", "insert"]:
sobjects = [SObjectFactory.create(search_type)]
示例6: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import set_limit [as 别名]
#.........这里部分代码省略.........
# tasks
td = table.add_cell()
td.add_style("vertical-align: top")
td.add_style("padding-left: 5px")
td.add_style("border-right: solid 1px")
title = DivWdg()
title.add_class("maq_search_bar")
#x = DivWdg("[x]")
#x.add_style("float: right")
#title.add(x)
title.add("Tasks")
td.add(title)
task_wdg = SObjectTaskTableElement()
task_wdg.set_sobject(sobject)
td.add(task_wdg)
td.add_style('cell-padding','10')
# discussion
td = table.add_cell()
#td.add_style("min-width: 300px")
#td.add_style("width: 600px")
td.add_style("vertical-align: top")
td.add_style("padding-left: 5px")
td.add_style("border-right: solid 1px")
title = DivWdg()
title.add_class("maq_search_bar")
#x = DivWdg("[x]")
#x.add_style("float: right")
#title.add(x)
title.add("Notes")
td.add(title)
discussion_wdg = DiscussionWdg()
discussion_wdg.preprocess()
discussion_wdg.set_sobject(sobject)
td.add(discussion_wdg)
note_panel = discussion_wdg.get_note_menu()
td.add(note_panel)
div.add(table)
div.add(HtmlElement.hr())
div.add(HtmlElement.br(clear="all"))
title_wdg = DivWdg()
title_wdg.add_class("maq_search_bar")
#x = DivWdg("[x]")
#x.add_style("float: right")
#title_wdg.add(x)
#title_wdg.add_style("font-size: 1.5em")
title_wdg.add("Detail" )
div.add(title_wdg)
div.add(HtmlElement.br())
# TEST getting schema
search_type = sobject.get_base_search_type()
schema = Schema.get_by_sobject(sobject)
child_types = schema.get_child_types(search_type)
# add a second table
table = Table()
table.set_max_width()
# show the snapshots for this sobject
search_type = "sthpw/snapshot"
search = Search(search_type)
search.add_sobject_filter(sobject)
search.set_limit(25)
sobjects = search.get_sobjects()
table.add_row()
nav_td = table.add_cell()
nav_td.add_style("width: 100px")
nav_td.add_style("vertical-align: top")
section_wdg = my.get_section_wdg(sobject)
nav_td.add( section_wdg )
parent_key = SearchKey.get_by_sobject(sobject)
content_wdg = ViewPanelWdg(search_type=search_type, element_name='Snapshots', \
title='Snapshots', view='table', parent_key=parent_key, do_search=True)
#content_wdg.set_sobjects(sobjects)
content_td = table.add_cell()
content_td.set_id("sobject_relation")
content_td.add_style("display: table-cell")
content_td.add_style("vertical-align: top")
content_td.add_style("padding-left: 10px")
content_td.add(content_wdg)
div.add(table)
return div
示例7: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import set_limit [as 别名]
#.........这里部分代码省略.........
view_select.add_event("onchange", "document.form.submit()")
view_select.set_persist_on_submit()
#view_select.set_persistence()
span = SpanWdg(css="med")
span.add("Defined Views: ")
span.add(view_select)
div.add(span)
div.add( self.get_create_view_wdg(search_type))
div.add( HtmlElement.br(2) )
div.add( self.get_new_tab_wdg() )
widget.add(div)
search = Search("sthpw/widget_config")
#search.add_user_filter()
search.add_filter("search_type", search_type)
search.add_where("view != 'definition' and view != 'custom'")
#search.add_column("view")
widget_configs = search.get_sobjects()
if widget_configs:
view_select.set_sobjects_for_options(widget_configs,"view","view")
view = view_select.get_value()
if not view:
view = "custom"
#return widget
# get the selected widget config
for widget_config in widget_configs:
if widget_config.get_value("view") == view:
break
else:
return widget
# get the handler: a little HACKY.
config_xml = widget_config.get_xml_value("config")
handler = config_xml.get_value("config/%s/@handler" % view)
if not search_type:
return widget
widget.add(HtmlElement.br())
span = SpanWdg()
custom_view = CustomViewWdg(search_type)
span.add(custom_view)
span.add_style("float: right")
widget.add(span)
widget.add( HtmlElement.br() )
widget.add("<h3>Example View [%s]</h3>" % view)
# add a general filter
filter_div = DivWdg()
for i in range(0,1):
filter = GeneralFilterWdg()
filter.set_columns_from_search_type(search_type)
filter_div.add("Filter: ")
filter_div.add(filter)
#filter_div.add(IconWdg("Remove Filter", IconWdg.RETIRE))
filter_div.add( HtmlElement.br(2) )
widget.add(filter_div)
search = Search(search_type)
search.set_limit(5)
filter.alter_search(search)
if not handler:
if view in ["edit","insert"]:
table = EditWdg(search_type, view)
else:
table = TableWdg(search_type, view)
else:
table = eval("%s(search_type,view)" % handler)
#table.alter_search(search)
sobjects = search.get_sobjects()
if not sobjects and view in ["edit","insert"]:
sobjects = [SObjectFactory.create(search_type)]
table.set_sobjects(sobjects)
widget.add(table)
# show the custom properties
widget.add("<h3>Custom Properties [%s]</h3>" % search_type)
search = Search("prod/custom_property")
search.add_filter("search_type", search_type)
# This is actually reading the sthpw/custom_property conf file, weird
table = TableWdg("prod/custom_property")
table.set_search_limit(5)
table.set_sobjects(search.get_sobjects() )
widget.add(table)
return widget