Пример #1
0
 def row_activate(self, obj):
     """See :class:`SearchDialog.row_activate`
     """
     if self.double_click_confirm:
         SearchDialog.row_activate(self, obj)
     elif self.accept_edit_data:
         self._edit(obj)
Пример #2
0
    def __init__(self, store, editor_class=None, interface=None,
                 search_spec=None, hide_footer=True,
                 title='', selection_mode=None,
                 hide_toolbar=False, double_click_confirm=False):
        """
        Create a new SearchEditor object.
        :param store:
        :param table:
        :param editor_class:
        :param interface: The interface which we need to apply to the objects in
          kiwi list to get adapter for the editor.
        :param search_spec:
        :param hide_footer:
        :param title:
        :param selection_mode:
        :param hide_toolbar:
        :param double_click_confirm: If double click a item in the list should
          automatically confirm. Double click confirms takes precedence over
          editor_class (ie, if double_click_confirmis is True, it will
          confirm the dialog, instead of opening the editor).
        """

        if selection_mode is None:
            selection_mode = gtk.SELECTION_BROWSE
        self.interface = interface
        self._read_only = False
        self._message_bar = None

        SearchDialog.__init__(self, store, search_spec,
                              hide_footer=hide_footer, title=title,
                              selection_mode=selection_mode,
                              double_click_confirm=double_click_confirm)

        self._setup_slaves()
        if hide_toolbar:
            self.accept_edit_data = False
            self._toolbar.get_toplevel().hide()
        else:
            if not (self.has_new_button or self.has_edit_button):
                raise ValueError("You must set hide_footer=False instead "
                                 "of disable these two attributes.")

            editor_class = editor_class or self.editor_class
            if not editor_class:
                raise ValueError('An editor_class argument is required')
            if not issubclass(editor_class, BaseEditor):
                raise TypeError("editor_class must be a BaseEditor subclass")
            self.editor_class = editor_class

            self.accept_edit_data = self.has_edit_button
            if not self.has_new_button:
                self.hide_new_button()
            if not self.has_edit_button:
                self.hide_edit_button()
        self._selected = None
        self.update_widgets()

        self.set_edit_button_sensitive(False)
        self.results.connect('selection-changed', self._on_selection_changed)
        self._check_permissions()
Пример #3
0
 def __init__(self, store):
     self._fields = self.get_fields(store)
     SearchDialog.__init__(self, store, hide_footer=False)
     self.set_ok_label(_('Save'))
     self.ok_button.set_sensitive(True)
     self.mass_editor = MassEditorWidget(store, self._fields, self.results)
     self.search.vbox.pack_start(self.mass_editor, False, False, 0)
     self.search.vbox.reorder_child(self.mass_editor, 1)
     self.mass_editor.show_all()
Пример #4
0
 def __init__(self, store):
     SearchDialog.__init__(self, store)
     self._setup_widgets()
Пример #5
0
 def __init__(self, store):
     SearchDialog.__init__(self, store)
     self.results.connect('selection-changed', self._on_selection_changed)
     self._setup_button_slave()
 def __init__(self, store, client=None):
     """
     :param client: the client which salaries will be searched
     """
     self.client = client
     SearchDialog.__init__(self, store)
Пример #7
0
 def __init__(self, store, storable):
     self._storable = storable
     dialog_title = _("Stock of %s") % storable.product.description
     SearchDialog.__init__(self, store, title=dialog_title)
     self.search.refresh()
Пример #8
0
 def __init__(self, store):
     SearchDialog.__init__(self, store)
     self._setup_widgets()
Пример #9
0
 def __init__(self, store):
     SearchDialog.__init__(self, store, self.search_table,
                           title=self.title)
     self.set_details_button_sensitive(False)
     self.results.connect('selection-changed', self.on_selection_changed)
Пример #10
0
    def __init__(self, store, editor_class=None, interface=None,
                 search_spec=None, hide_footer=True,
                 title='', selection_mode=None,
                 hide_toolbar=False, double_click_confirm=False,
                 initial_string=''):
        """
        Create a new SearchEditor object.
        :param store:
        :param search_spec:
        :param editor_class:
        :param interface: The interface which we need to apply to the objects in
          kiwi list to get adapter for the editor.
        :param search_spec:
        :param hide_footer:
        :param title:
        :param selection_mode:
        :param hide_toolbar:
        :param double_click_confirm: If double click a item in the list should
          automatically confirm. Double click confirms takes precedence over
          editor_class (ie, if double_click_confirmis is True, it will
          confirm the dialog, instead of opening the editor).
        :param initial_string: The string that should be initialy filtered
        """

        if selection_mode is None:
            selection_mode = gtk.SELECTION_BROWSE
        self.interface = interface
        self._read_only = False
        self._message_bar = None

        SearchDialog.__init__(self, store, search_spec,
                              hide_footer=hide_footer, title=title,
                              selection_mode=selection_mode,
                              double_click_confirm=double_click_confirm,
                              initial_string=initial_string)

        self._setup_slaves()
        if hide_toolbar:
            self.accept_edit_data = False
            self._toolbar.get_toplevel().hide()
        else:
            if not (self.has_new_button or self.has_edit_button):
                raise ValueError("You must set hide_footer=False instead "
                                 "of disable these two attributes.")

            editor_class = editor_class or self.editor_class
            if not editor_class:
                raise ValueError('An editor_class argument is required')
            if not issubclass(editor_class, BaseEditor):
                raise TypeError("editor_class must be a BaseEditor subclass")
            self.editor_class = editor_class

            self.accept_edit_data = self.has_edit_button
            if not self.has_new_button:
                self.hide_new_button()
            if not self.has_edit_button:
                self.hide_edit_button()
        self._selected = None
        self.update_widgets()

        self.set_edit_button_sensitive(False)
        self.results.connect('selection-changed', self._on_selection_changed)
        self._check_permissions()
Пример #11
0
 def __init__(self, store, client=None):
     """
     :param client: the client which salaries will be searched
     """
     self.client = client
     SearchDialog.__init__(self, store)
Пример #12
0
 def __init__(self, store, storable):
     self._storable = storable
     dialog_title = _("Stock of %s") % storable.product.description
     SearchDialog.__init__(self, store, title=dialog_title)
     self.search.refresh()
Пример #13
0
 def __init__(self, store):
     SearchDialog.__init__(self, store)
     self.results.connect('selection-changed', self._on_selection_changed)
     self._setup_button_slave()
Пример #14
0
 def __init__(self, store):
     SearchDialog.__init__(self, store, self.search_table, title=self.title)
     self.set_details_button_sensitive(False)
     self.results.connect('selection-changed', self.on_selection_changed)