Esempio n. 1
0
    def __init__(self,
                 store,
                 hide_footer=True,
                 hide_toolbar=False,
                 hide_cost_column=False,
                 hide_price_column=False,
                 double_click_confirm=False):
        """
        :param store: a store
        :param hide_footer: do I have to hide the dialog footer?
        :param hide_toolbar: do I have to hide the dialog toolbar?
        :param hide_cost_column: if it's True, no need to show the
                                 column 'cost'
        :param hide_price_column: if it's True no need to show the
                                  column 'price'
        """
        # We only want to display data as a tree for ProductSearch, but
        # not setting 'tree = True' on the class definition as it has too many
        # subclasses for us to manually set to False on each one
        if self.__class__ is ProductSearch:
            self.result_view_class = _ProductSearchResultTreeView
            self.tree = True

        self.hide_cost_column = hide_cost_column
        self.hide_price_column = hide_price_column
        SellableSearch.__init__(self,
                                store,
                                hide_footer=hide_footer,
                                hide_toolbar=hide_toolbar,
                                double_click_confirm=double_click_confirm)
        if self.has_print_price_button:
            self._setup_print_slave()
        else:
            self._print_slave = None
Esempio n. 2
0
    def __init__(self, store, hide_footer=True, hide_toolbar=False,
                 hide_cost_column=False, hide_price_column=False,
                 double_click_confirm=False):
        """
        :param store: a store
        :param hide_footer: do I have to hide the dialog footer?
        :param hide_toolbar: do I have to hide the dialog toolbar?
        :param hide_cost_column: if it's True, no need to show the
                                 column 'cost'
        :param hide_price_column: if it's True no need to show the
                                  column 'price'
        """
        # We only want to display data as a tree for ProductSearch, but
        # not setting 'tree = True' on the class definition as it has too many
        # subclasses for us to manually set to False on each one
        if self.__class__ is ProductSearch:
            self.tree = True

        self.hide_cost_column = hide_cost_column
        self.hide_price_column = hide_price_column
        SellableSearch.__init__(self, store, hide_footer=hide_footer,
                                hide_toolbar=hide_toolbar,
                                double_click_confirm=double_click_confirm)
        if self.has_print_price_button:
            self._setup_print_slave()
        else:
            self._print_slave = None
Esempio n. 3
0
 def __init__(self, store, hide_footer=True, hide_toolbar=False,
              double_click_confirm=False,
              hide_cost_column=False, hide_price_column=False):
     self.hide_cost_column = hide_cost_column
     self.hide_price_column = hide_price_column
     SellableSearch.__init__(self, store, hide_footer=hide_footer,
                             hide_toolbar=hide_toolbar,
                             double_click_confirm=double_click_confirm)
     self._setup_print_slave()
Esempio n. 4
0
 def __init__(self,
              store,
              hide_footer=True,
              hide_toolbar=False,
              double_click_confirm=False,
              hide_cost_column=False,
              hide_price_column=False):
     self.hide_cost_column = hide_cost_column
     self.hide_price_column = hide_price_column
     SellableSearch.__init__(self,
                             store,
                             hide_footer=hide_footer,
                             hide_toolbar=hide_toolbar,
                             double_click_confirm=double_click_confirm)
     self._setup_print_slave()
Esempio n. 5
0
    def testCreate(self, set_message):
        sellable = self.create_sellable()
        self.create_storable(product=sellable.product)
        sale_item = TemporarySaleItem(sellable=sellable, quantity=1)

        search = SellableSearch(self.store, sale_items=[sale_item], quantity=1)

        self.assertRaises(TypeError, SellableSearch, self.store,
                          sale_items=[sale_item],
                          selection_mode=gtk.SELECTION_MULTIPLE)
        self.assertRaises(TypeError, SellableSearch, self.store,
                          sale_items=[sale_item], quantity=None)

        search = SellableSearch(self.store, info_message='test')
        set_message.assert_called_once_with('test')

        search = SellableSearch(self.store, search_str='cal')
        self.check_search(search, 'sellable-string-filter')
Esempio n. 6
0
 def __init__(self, store, hide_footer=True, hide_toolbar=False,
              hide_cost_column=False, hide_price_column=False,
              double_click_confirm=False):
     """
     :param store: a store
     :param hide_footer: do I have to hide the dialog footer?
     :param hide_toolbar: do I have to hide the dialog toolbar?
     :param hide_cost_column: if it's True, no need to show the
                              column 'cost'
     :param hide_price_column: if it's True no need to show the
                               column 'price'
     """
     self.hide_cost_column = hide_cost_column
     self.hide_price_column = hide_price_column
     SellableSearch.__init__(self, store, hide_footer=hide_footer,
                             hide_toolbar=hide_toolbar,
                             double_click_confirm=double_click_confirm)
     if self.has_print_price_button:
         self._setup_print_slave()
     else:
         self._print_slave = None
Esempio n. 7
0
 def __init__(self, store, hide_footer=True, hide_toolbar=False,
              hide_cost_column=False, hide_price_column=False,
              double_click_confirm=False):
     """
     :param store: a store
     :param hide_footer: do I have to hide the dialog footer?
     :param hide_toolbar: do I have to hide the dialog toolbar?
     :param hide_cost_column: if it's True, no need to show the
                              column 'cost'
     :param hide_price_column: if it's True no need to show the
                               column 'price'
     """
     self.hide_cost_column = hide_cost_column
     self.hide_price_column = hide_price_column
     SellableSearch.__init__(self, store, hide_footer=hide_footer,
                             hide_toolbar=hide_toolbar,
                             double_click_confirm=double_click_confirm)
     if self.has_print_price_button:
         self._setup_print_slave()
     else:
         self._print_slave = None
Esempio n. 8
0
 def _show_search(self):
     search = SellableSearch(self.store)
     search.search.refresh()
     search.results.select(search.results[0])
     return search