本文整理汇总了Python中stoqlib.gui.search.searchslave.SearchSlave.clear方法的典型用法代码示例。如果您正苦于以下问题:Python SearchSlave.clear方法的具体用法?Python SearchSlave.clear怎么用?Python SearchSlave.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.gui.search.searchslave.SearchSlave
的用法示例。
在下文中一共展示了SearchSlave.clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ShellApp
# 需要导入模块: from stoqlib.gui.search.searchslave import SearchSlave [as 别名]
# 或者: from stoqlib.gui.search.searchslave.SearchSlave import clear [as 别名]
#.........这里部分代码省略.........
insensitive.
:param widgets: a list of widgets
:param validation_func: a function for validation. It should
return either ``True`` or ``False``.
:param args: args that will be passed to *validation_func*
"""
assert callable(validation_func)
for widget in widgets:
validators = self._sensitive_group.setdefault(widget, set())
validators.add((validation_func, args))
def run_dialog(self, dialog_class, *args, **kwargs):
""" Encapsuled method for running dialogs. """
return run_dialog(dialog_class, self, *args, **kwargs)
@cached_function()
def has_open_inventory(self):
return Inventory.has_open(self.store,
api.get_current_branch(self.store))
def check_open_inventory(self):
"""Checks if there is an open inventory.
In the case there is one, will call set_open_inventory (subclasses
should implement it).
Returns True if there is an open inventory. False otherwise
"""
inventory_bar = getattr(self, 'inventory_bar', None)
if self.has_open_inventory():
if inventory_bar:
inventory_bar.show()
else:
self._display_open_inventory_message()
self.set_open_inventory()
return True
elif inventory_bar:
inventory_bar.hide()
return False
# FIXME: Most of these should be removed and access the search API
# directly, eg, self.search.clear() etc
def add_filter(self, search_filter, position=SearchFilterPosition.BOTTOM,
columns=None, callback=None):
"""
See :class:`SearchSlave.add_filter`
"""
self.search.add_filter(search_filter, position, columns, callback)
def set_text_field_columns(self, columns):
"""
See :class:`SearchSlave.set_text_field_columns`
"""
self.search.set_text_field_columns(columns)
def refresh(self, rollback=True):
"""
See :class:`stoqlib.gui.search.searchslave.SearchSlave.refresh`
"""
# Since the store here is actually a transaction and the items
# on it can be changed from another station, do a rollback so
# the items get reloaded, avoiding cache problems
# Note that this gets mocked on tests to not do the rollback
if rollback:
self.store.rollback(close=False)
self.search.refresh()
def clear(self):
"""
See :class:`stoqlib.gui.search.searchslave.SearchSlave.clear`
"""
self.search.clear()
def select_result(self, result):
"""Select the object in the result list
If the object is not in the list (filtered out, for instance), no error
is thrown and nothing is selected
"""
try:
self.results.select(result)
except ValueError:
pass
#
# Callbacks
#
def on_search__search_completed(self, search, results, states):
self.search_completed(results, states)
has_results = len(results)
for widget in [self.window.Print,
self.window.ExportSpreadSheet]:
widget.set_sensitive(has_results)
self.search.save_filter_settings('app-ui', self.app_name)