本文整理汇总了Python中stoqlib.gui.search.searchslave.SearchSlave.get_search_filters方法的典型用法代码示例。如果您正苦于以下问题:Python SearchSlave.get_search_filters方法的具体用法?Python SearchSlave.get_search_filters怎么用?Python SearchSlave.get_search_filters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.gui.search.searchslave.SearchSlave
的用法示例。
在下文中一共展示了SearchSlave.get_search_filters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SearchDialog
# 需要导入模块: from stoqlib.gui.search.searchslave import SearchSlave [as 别名]
# 或者: from stoqlib.gui.search.searchslave.SearchSlave import get_search_filters [as 别名]
#.........这里部分代码省略.........
def set_details_button_sensitive(self, value):
self._details_slave.details_button.set_sensitive(value)
def set_print_button_sensitive(self, value):
self._details_slave.print_button.set_sensitive(value)
def get_selection(self):
mode = self.results.get_selection_mode()
if mode == gtk.SELECTION_BROWSE:
return self.results.get_selected()
return self.results.get_selected_rows()
def confirm(self, retval=None):
"""Confirms the dialog
:param retval: optional parameter which will be selected when the
dialog is closed
"""
if retval is None:
retval = self.get_selection()
self.retval = retval
self.search.save_columns()
# FIXME: This should chain up so the "confirm" signal gets emitted
self.close()
def cancel(self, *args):
self.retval = []
self.search.save_columns()
# FIXME: This should chain up so the "cancel" signal gets emitted
self.close()
def print_report(self):
print_report(self.report_class, self.results, list(self.results),
filters=self.search.get_search_filters())
# FIXME: This should be on BasePersonSearch
def birthday_search(self, state):
""" Returns a birthday query suitable for search filters.
This should be assigned on search_column when you want to filter for
birth day. e.g.:
SearchColumn('birth_date', search_column=self.birthday_search)
"""
if isinstance(state, DateQueryState):
if state.date:
return Individual.get_birthday_query(state.date)
elif isinstance(state, DateIntervalQueryState):
if state.start and state.end:
return Individual.get_birthday_query(state.start, state.end)
else:
raise AssertionError
# FIXME: -> remove/use
# TODO: Check if we can remove
def set_searchbar_label(self, label):
search_filter = self.search.get_primary_filter()
search_filter.set_label(label)
def set_searchbar_search_string(self, string):
if string == self.get_searchbar_search_string():
return
search_filter = self.search.get_primary_filter()
search_filter.entry.set_text(string)
def get_searchbar_search_string(self):
search_filter = self.search.get_primary_filter()
示例2: ShellApp
# 需要导入模块: from stoqlib.gui.search.searchslave import SearchSlave [as 别名]
# 或者: from stoqlib.gui.search.searchslave.SearchSlave import get_search_filters [as 别名]
#.........这里部分代码省略.........
#
# Public API
#
def add_ui_actions(self, ui_string, actions, name='Actions',
action_type='normal', filename=None):
return self.window.add_ui_actions(ui_string=ui_string,
actions=actions,
name=name,
action_type=action_type,
filename=filename,
instance=self)
def add_tool_menu_actions(self, actions):
return self.window.add_tool_menu_actions(actions=actions)
def add_columns(self, columns):
"""Add some columns to the default ones.
Note that this method must be called during the setup of this search,
which right now is only possible for those who capture the
`<stoqlib.gui.events.ApplicationSetupSearchEvent>`
"""
self.columns.extend(columns)
def set_help_section(self, label, section):
self.window.set_help_section(label=label,
section=section)
def get_statusbar_message_area(self):
return self.window.statusbar.message_area
def print_report(self, report_class, *args, **kwargs):
filters = self.search.get_search_filters()
if filters:
kwargs['filters'] = filters
print_report(report_class, *args, **kwargs)
def set_sensitive(self, widgets, value):
"""Set the *widgets* sensitivity based on *value*
If a sensitive group was registered for any widget,
it's validation function will be tested and, if ``False``
is returned, it will be set insensitive, ignoring *value*
:param widgets: a list of widgets
:param value: either `True` or `False`
"""
# FIXME: Maybe this should ne done on kiwi?
for widget in widgets:
sensitive = value
for validator in self._sensitive_group.get(widget, []):
if not validator[0](*validator[1]):
sensitive = False
break
widget.set_sensitive(sensitive)
def register_sensitive_group(self, widgets, validation_func, *args):
"""Register widgets on a sensitive group.
Everytime :obj:`.set_sensitive()` is called, if there is any
validation function for a given widget on sensitive group,
then that will be used to decide if it gets sensitive or