本文整理汇总了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
示例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
示例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
"""