當前位置: 首頁>>代碼示例>>Python>>正文


Python SummaryLabel.update_total方法代碼示例

本文整理匯總了Python中kiwi.ui.widgets.list.SummaryLabel.update_total方法的典型用法代碼示例。如果您正苦於以下問題:Python SummaryLabel.update_total方法的具體用法?Python SummaryLabel.update_total怎麽用?Python SummaryLabel.update_total使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kiwi.ui.widgets.list.SummaryLabel的用法示例。


在下文中一共展示了SummaryLabel.update_total方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: SellableItemSlave

# 需要導入模塊: from kiwi.ui.widgets.list import SummaryLabel [as 別名]
# 或者: from kiwi.ui.widgets.list.SummaryLabel import update_total [as 別名]

#.........這裏部分代碼省略.........
        self.slave.connect('before-delete-items',
                           self._on_list_slave__before_delete_items)
        self.slave.connect('after-delete-items',
                           self._on_list_slave__after_delete_items)
        self.slave.connect('on-edit-item', self._on_list_slave__edit_item)
        self.slave.connect('on-add-item', self._on_list_slave__add_item)
        self.attach_slave('list_holder', self.slave)

    def update_visual_mode(self):
        for widget in [self.barcode, self.product_button]:
            widget.set_sensitive(False)

    #
    # Public API
    #

    def add_sellable(self, sellable):
        """Add a sellable to the current step

        This will call step.get_order_item to create the correct item for the
        current model, and this created item will be returned.
        """
        quantity = self.get_quantity()
        cost = self.cost.read()
        item = self.get_order_item(sellable, cost, quantity)
        if item is None:
            return

        if item in self.slave.klist:
            self.slave.klist.update(item)
        else:
            self.slave.klist.append(item)

        self._update_total()
        self._reset_sellable()
        return item

    def remove_items(self, items):
        """Remove items from the current :class:`IContainer`.

        Subclasses can override this if special logic is necessary.
        """
        for item in items:
            self.model.remove_item(item)

    def hide_item_addition_toolbar(self):
        self.item_table.hide()

    def hide_add_button(self):
        """Hides the add button
        """
        self.slave.hide_add_button()

    def hide_del_button(self):
        """Hides the del button
        """
        self.slave.hide_del_button()

    def hide_edit_button(self):
        """Hides the edit button
        """
        self.slave.hide_edit_button()

    def get_quantity(self):
        """Returns the quantity of the current model or 1 if there is no model
        :returns: the quantity
開發者ID:romaia,項目名稱:stoq,代碼行數:70,代碼來源:abstractwizard.py

示例2: SellableItemSlave

# 需要導入模塊: from kiwi.ui.widgets.list import SummaryLabel [as 別名]
# 或者: from kiwi.ui.widgets.list.SummaryLabel import update_total [as 別名]

#.........這裏部分代碼省略.........
            widget.set_sensitive(False)

    #
    # Public API
    #

    def add_sellable(self, sellable):
        """Add a sellable to the current step

        This will call step.get_order_item to create the correct item for the
        current model, and this created item will be returned.
        """
        quantity = self.get_quantity()
        value = self.cost.read()
        storable = sellable.product_storable
        order_items = []

        if (storable is not None and
            storable.is_batch and
            self.batch_selection_dialog is not None):
            order_items.extend(self._get_batch_order_items(sellable,
                                                           value, quantity))
        else:
            order_item = self._get_order_item(sellable, value, quantity)
            if order_item is not None:
                order_items.append(order_item)

        for item in order_items:
            if item in self.slave.klist:
                self.slave.klist.update(item)
            else:
                self.slave.klist.append(item)

        self._update_total()

        if len(order_items):
            self._reset_sellable()

    def remove_items(self, items):
        """Remove items from the current :class:`IContainer`.

        Subclasses can override this if special logic is necessary.
        """
        for item in items:
            self.model.remove_item(item)

    def hide_item_addition_toolbar(self):
        self.item_table.hide()

    def hide_add_button(self):
        """Hides the add button
        """
        self.slave.hide_add_button()

    def hide_del_button(self):
        """Hides the del button
        """
        self.slave.hide_del_button()

    def hide_edit_button(self):
        """Hides the edit button
        """
        self.slave.hide_edit_button()

    def get_quantity(self):
        """Returns the quantity of the current model or 1 if there is no model
開發者ID:leandrorchaves,項目名稱:stoq,代碼行數:70,代碼來源:abstractwizard.py

示例3: SellableItemSlave

# 需要導入模塊: from kiwi.ui.widgets.list import SummaryLabel [as 別名]
# 或者: from kiwi.ui.widgets.list.SummaryLabel import update_total [as 別名]

#.........這裏部分代碼省略.........

    def update_visual_mode(self):
        for widget in [self.barcode, self.product_button]:
            widget.set_sensitive(False)

    #
    # Public API
    #

    def add_sellable(self, sellable):
        """Add a sellable to the current step

        This will call step.get_order_item to create the correct item for the
        current model, and this created item will be returned.
        """
        quantity = self.get_quantity()
        value = self.cost.read()
        storable = sellable.product_storable
        order_items = []

        if storable is not None and storable.is_batch and self.batch_selection_dialog is not None:
            order_items.extend(self.get_batch_order_items(sellable, value, quantity))
        else:
            order_item = self.get_order_item(sellable, value, quantity)
            if order_item is not None:
                order_items.append(order_item)

        for item in order_items:
            if item in self.slave.klist:
                self.slave.klist.update(item)
            else:
                self.slave.klist.append(item)

        self._update_total()

        if len(order_items):
            self._reset_sellable()

        # After an item is added, reset manager to None so the discount is only
        # authorized for one item at a time.
        self.manager = None

    def remove_items(self, items):
        """Remove items from the current :class:`IContainer`.

        Subclasses can override this if special logic is necessary.
        """
        for item in items:
            self.model.remove_item(item)

    def hide_item_addition_toolbar(self):
        self.item_table.hide()

    def hide_add_button(self):
        """Hides the add button
        """
        self.slave.hide_add_button()

    def hide_del_button(self):
        """Hides the del button
        """
        self.slave.hide_del_button()

    def hide_edit_button(self):
        """Hides the edit button
        """
開發者ID:rosalin,項目名稱:stoq,代碼行數:70,代碼來源:abstractwizard.py


注:本文中的kiwi.ui.widgets.list.SummaryLabel.update_total方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。