Class s.g.b.s.SearchEditor(SearchDialog):

Part of stoqlib.gui.base.search View In Hierarchy

Known subclasses: stoqlib.gui.search.categorysearch.SellableCategorySearch, stoqlib.gui.search.fiscalsearch.CfopSearch, stoqlib.gui.search.fiscalsearch.FiscalBookEntrySearch, stoqlib.gui.search.personsearch.BasePersonSearch, stoqlib.gui.search.personsearch.EmployeeRoleSearch, stoqlib.gui.search.productsearch.ProductSearch, stoqlib.gui.search.productsearch.ProductStockSearch, stoqlib.gui.search.profilesearch.UserProfileSearch, stoqlib.gui.search.purchasesearch.PurchasedItemsSearch, stoqlib.gui.search.sellablesearch.SellableSearch, stoqlib.gui.search.servicesearch.ServiceSearch, stoqlib.gui.search.stationsearch.StationSearch

Base class for a search "editor" dialog, that offers a 'new' and 'edit' button on the dialog footer. The 'new' and 'edit' buttons will call 'editor_class' sending as its parameters a new connection and the object to edit for 'edit' button.

This is also a subclass of SearchDialog and the same rules are required.

Simple example:

>>> class CarSearch(SearchEditor):
...     title = _("Car Search")
...     table = Car
...     editor_class = CarEditor
...     size = (465, 390)
...     searchbar_result_strings = _("Car"), _("Cars")
...
...     def get_columns(self):
...         return [Column('brand', _('Brand'), data_type=str, width=90),
...                 Column('description', _('Description'), data_type=str,
...                         expand=True)]

This will create a new editor called CarSearch.

Method __init__ Create a new SearchEditor object.
Method _setup_slaves Undocumented
Method set_edit_button_sensitive Control sensitivity of button edit
Method update_widgets Subclass can have an 'update_widgets', and this method will be
Method hide_edit_button Undocumented
Method hide_new_button Undocumented
Method update_edited_item Update the edited item to its proper type and select it on the
Method run Handles action to be performed when window is opened. Defaults to
Method run_dialog Undocumented
Method run_editor Undocumented
Method row_activate See SearchDialog.row_activate
Method _edit Undocumented
Method _on_toolbar__edit Undocumented
Method _on_toolbar__new Undocumented
Method get_searchlist_model Undocumented
Method get_editor_model This hook must be redefined on child when changing the type of

Inherited from SearchDialog:

Method _setup_search_table Undocumented
Method _setup_selection_mode Undocumented
Method _setup_search Undocumented
Method _setup_details_slave Undocumented
Method set_details_button_sensitive Undocumented
Method set_print_button_sensitive Undocumented
Method get_selection Undocumented
Method confirm Undocumented
Method cancel Undocumented
Method set_table Undocumented
Method set_searchbar_labels Undocumented
Method set_searchbar_search_string Undocumented
Method set_result_strings Undocumented
Method set_text_field_columns See SearchSlaveDelegate.set_text_field_columns
Method disable_search_entry See SearchSlaveDelegate.disable_search_entry
Method add_filter See SearchSlaveDelegate.add_filter
Method create_branch_filter Undocumented
Method _on_results__cell_edited Override this method on child when it's needed to perform some
Method _on_results__selection_changed Undocumented
Method _on_results__row_activated Undocumented
Method _has_rows Undocumented
Method create_filters Undocumented
Method setup_widgets Undocumented
Method get_columns Undocumented

Inherited from BasicDialog (via SearchDialog):

Method _initialize Undocumented
Method setup_keyactions Undocumented
Method hide_footer Undocumented
Method enable_ok Undocumented
Method disable_ok Undocumented
Method set_ok_label Undocumented
Method set_cancel_label Undocumented
Method justify_label Undocumented
Method set_confirm_widget Enables widget as a confirm widget, the dialog will be closed as
Method set_cancel_widget Enables widget as a cancel widget, the dialog will be closed as
Method add Undocumented
Method action_area Undocumented
Method on_ok_button__clicked Undocumented
Method on_cancel_button__clicked Undocumented

Inherited from RunnableView (via SearchDialog, BasicDialog, AbstractDialog):

Method close Handles action to be performed when window is closed.
Method destroy Undocumented
def __init__(self, conn, table=None, editor_class=None, interface=None, search_table=None, hide_footer=True, title='', selection_mode=gtk.SELECTION_BROWSE, hide_toolbar=False, double_click_confirm=False):
Create a new SearchEditor object.
Parametersconn
table
editor_class
interfaceThe interface which we need to apply to the objects in kiwi list to get adapter for the editor.
search_table
hide_footer
title
selection_mode
hide_toolbar
double_click_confirmIf double click a item in the list should automatically confirm
def _setup_slaves(self):
Undocumented
@argcheck(bool)
def set_edit_button_sensitive(self, value):
Control sensitivity of button edit
def update_widgets(self, *args):
Subclass can have an 'update_widgets', and this method will be called when a signal is emitted by 'Filter' or 'Clear' buttons and also when a list item is selected.
def hide_edit_button(self):
Undocumented
def hide_new_button(self):
Undocumented
def update_edited_item(self, model):
Update the edited item to its proper type and select it on the list results. This method must be overwritten on subclasses when editors don't return a valid instance or when returning more than one model.
def run(self, obj=None):
Handles action to be performed when window is opened. Defaults to _open(), which blocks in a mainloop. Returns the value of the retval attribute.
def run_dialog(self, editor_class, parent, *args):
Undocumented
def run_editor(self, obj):
Undocumented
def row_activate(self, obj):
See SearchDialog.row_activate
def _edit(self, obj):
Undocumented
def _on_toolbar__edit(self, toolbar):
Undocumented
def _on_toolbar__new(self, toolbar):
Undocumented
def get_searchlist_model(self, model):
Undocumented
def get_editor_model(self, model):
This hook must be redefined on child when changing the type of the model is a requirement for edit method.
API Documentation for Stoqlib, generated by pydoctor at 2009-07-14 16:00:32.