本文整理汇总了Python中stoqlib.gui.slaves.saleslave.SaleListToolbar.connect方法的典型用法代码示例。如果您正苦于以下问题:Python SaleListToolbar.connect方法的具体用法?Python SaleListToolbar.connect怎么用?Python SaleListToolbar.connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.gui.slaves.saleslave.SaleListToolbar
的用法示例。
在下文中一共展示了SaleListToolbar.connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SaleWithToolbarSearch
# 需要导入模块: from stoqlib.gui.slaves.saleslave import SaleListToolbar [as 别名]
# 或者: from stoqlib.gui.slaves.saleslave.SaleListToolbar import connect [as 别名]
class SaleWithToolbarSearch(_BaseSaleSearch):
#
# _BaseSaleSearch
#
def setup_widgets(self):
self._sale_toolbar = SaleListToolbar(self.store, self.results, self)
self._sale_toolbar.connect('sale-returned', self._on_sale__returned)
self._sale_toolbar.update_buttons()
self.attach_slave("extra_holder", self._sale_toolbar)
self.results.connect(
'selection-changed', self._on_results__selection_changed)
self.search.set_summary_label('total', label=_(u'Total:'),
format='<b>%s</b>')
#
# Private
#
def _update_widgets(self, sale_view):
sale = sale_view and sale_view.sale
try:
till = Till.get_current(self.store)
except TillError:
till = None
can_edit = bool(sale and sale.can_edit())
# We need an open till to return sales
if sale and till:
can_return = sale.can_return() or sale.can_cancel()
else:
can_return = False
self._sale_toolbar.return_sale_button.set_sensitive(can_return)
self._sale_toolbar.edit_button.set_sensitive(can_edit)
#
# Callbacks
#
def _on_results__selection_changed(self, results, sale_view):
self._update_widgets(sale_view)
def _on_sale__returned(self, slave, sale_returned):
if sale_returned:
self._update_widgets(self.results.get_selected())
示例2: SaleWithToolbarSearch
# 需要导入模块: from stoqlib.gui.slaves.saleslave import SaleListToolbar [as 别名]
# 或者: from stoqlib.gui.slaves.saleslave.SaleListToolbar import connect [as 别名]
class SaleWithToolbarSearch(_BaseSaleSearch):
#
# _BaseSaleSearch
#
def setup_widgets(self):
self._sale_toolbar = SaleListToolbar(self.store, self.results, self)
self._sale_toolbar.connect('sale-returned', self._on_sale__returned)
self._sale_toolbar.update_buttons()
self.attach_slave("extra_holder", self._sale_toolbar)
self.results.connect(
'selection-changed', self._on_results__selection_changed)
self.search.set_summary_label('total', label=_(u'Total:'),
format='<b>%s</b>')
#
# Private
#
def _update_widgets(self, sale_view):
if sale_view is None:
return
sale = sale_view.sale
can_edit = sale.can_edit()
can_return = sale.can_return() or sale.can_cancel()
self._sale_toolbar.return_sale_button.set_sensitive(can_return)
self._sale_toolbar.edit_button.set_sensitive(can_edit)
#
# Callbacks
#
def _on_results__selection_changed(self, results, sale_view):
self._update_widgets(sale_view)
def _on_sale__returned(self, slave, sale_returned):
if sale_returned:
self._update_widgets(self.results.get_selected())