本文整理匯總了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())