本文整理汇总了Python中kiwi.ui.objectlist.SummaryLabel.show方法的典型用法代码示例。如果您正苦于以下问题:Python SummaryLabel.show方法的具体用法?Python SummaryLabel.show怎么用?Python SummaryLabel.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.ui.objectlist.SummaryLabel
的用法示例。
在下文中一共展示了SummaryLabel.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_summary_labels
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_summary_labels(self):
summary_label = SummaryLabel(klist=self.payments_list,
column='paid_value',
label='<b>%s</b>' % api.escape(_(u"Total:")),
value_format='<b>%s</b>')
summary_label.show()
self.payments_vbox.pack_start(summary_label, False, True, 0)
示例2: _setup_summary_labels
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_summary_labels(self):
order_summary_label = SummaryLabel(
klist=self.ordered_items,
column='total',
label='<b>%s</b>' % api.escape(_(u"Total")),
value_format='<b>%s</b>')
order_summary_label.show()
self.ordered_vbox.pack_start(order_summary_label, False)
示例3: _setup_summary_labels
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_summary_labels(self):
summary_label = SummaryLabel(
klist=self.payments_list,
column="paid_value",
label="<b>%s</b>" % api.escape(_(u"Total:")),
value_format="<b>%s</b>",
)
summary_label.show()
self.payments_vbox.pack_start(summary_label, False)
示例4: setup_widgets
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def setup_widgets(self):
value_format = '<b>%s</b>'
balance_label = "<b>%s</b>" % api.escape(_("Balance:"))
account_summary_label = SummaryLabel(klist=self.klist,
column='paid_value',
label=balance_label,
value_format=value_format,
data_func=lambda p: p.is_outpayment())
account_summary_label.show()
self.pack_start(account_summary_label, False, True, 0)
示例5: _setup_summary_labels
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_summary_labels(self):
value_format = "<b>%s</b>"
total_label = "<b>%s</b>" % api.escape(_("Total:"))
total_summary_label = SummaryLabel(klist=self.payments_list,
column='value',
label=total_label,
value_format=value_format)
total_summary_label.show()
self.payments_vbox.pack_start(total_summary_label, False)
total_label = "<b>%s</b>" % api.escape(_("Total paid:"))
total_paid_summary_label = SummaryLabel(klist=self.payments_list,
column='paid_value',
label=total_label,
value_format=value_format)
total_paid_summary_label.show()
self.payments_vbox.pack_start(total_paid_summary_label, False)
total_label = "<b>%s</b>" % api.escape(_("Total:"))
transaction_summary_label = SummaryLabel(
klist=self.stock_transactions_list,
column='total',
label=total_label,
value_format=value_format)
transaction_summary_label.show()
self.stock_transactions_vbox.pack_start(transaction_summary_label, False)
total_label = "<b>%s</b>" % api.escape(_("Total:"))
sale_summary_label = SummaryLabel(klist=self.sales_list,
column='total',
label=total_label,
value_format=value_format)
sale_summary_label.show()
self.sales_vbox.pack_start(sale_summary_label, False)
示例6: _setup_widgets
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_widgets(self):
self._setup_status()
self.product_list.set_columns(self._get_product_columns())
products = self.store.find(TransferOrderItem, transfer_order=self.model)
self.product_list.add_list(list(products))
value_format = '<b>%s</b>'
total_label = value_format % api.escape(_("Total:"))
products_summary_label = SummaryLabel(klist=self.product_list,
column='total',
label=total_label,
value_format=value_format)
products_summary_label.show()
self.products_vbox.pack_start(products_summary_label, False)
示例7: _create_summary_label
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _create_summary_label(self, report, column='value', label=None):
# Setting tha data
obj_list = getattr(self, report + '_list')
box = getattr(self, report + '_vbox')
if label is None:
label = _('Total:')
label = '<b>%s</b>' % api.escape(label)
value_format = '<b>%s</b>'
# Creating the label
label = SummaryLabel(klist=obj_list, column=column, label=label,
value_format=value_format)
# Displaying the label
box.pack_start(label, False, False, 0)
label.show()
return label
示例8: PurchaseFinishProductListStep
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
class PurchaseFinishProductListStep(WizardEditorStep):
gladefile = 'PurchaseFinishProductListStep'
model_type = Settable
proxy_widgets = ()
def __init__(self, store, wizard, model):
WizardEditorStep.__init__(self, store, wizard, model)
self._setup_widgets()
def _setup_widgets(self):
self.product_list.set_columns(self._get_columns())
items = PurchaseItemView.find_by_purchase(self.store, self.model.purchase)
self.product_list.add_list(items)
self._setup_summary()
def _setup_summary(self):
self.summary = SummaryLabel(klist=self.product_list,
column='total_received',
value_format='<b>%s</b>')
self.summary.show()
self.vbox1.pack_start(self.summary, expand=False)
def _get_columns(self):
return [Column('description', title=_('Description'),
data_type=str, expand=True, searchable=True),
Column('quantity', title=_('Ordered'), data_type=int,
width=90, format_func=format_quantity, expand=True),
Column('quantity_received', title=_('Received'), data_type=int,
width=110, format_func=format_quantity),
Column('sellable.unit_description', title=_('Unit'),
data_type=str, width=50),
Column('cost', title=_('Cost'), data_type=currency, width=90),
Column('total_received', title=_('Total'), data_type=currency,
width=100)]
#
# WizardStep hooks
#
def next_step(self):
return PurchaseFinishPaymentAdjustStep(self.store, self.wizard,
self.model, self)
def has_previous_step(self):
return False
示例9: _setup_widgets
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_widgets(self):
self.product_list.set_columns(self._get_product_columns())
products = self.store.find(ReceivingOrderItem,
receiving_order_id=self.model.id)
self.product_list.add_list(list(products))
value_format = '<b>%s</b>'
total_label = value_format % api.escape(_("Total:"))
products_summary_label = SummaryLabel(klist=self.product_list,
column='total',
label=total_label,
value_format=value_format)
products_summary_label.show()
self.products_vbox.pack_start(products_summary_label, False)
label = self.print_labels.get_children()[0]
label = label.get_children()[0].get_children()[1]
label.set_label(_(u'Print labels'))
示例10: _setup_widgets
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_widgets(self):
self.product_list.set_columns(self._get_product_columns())
# if the parameter is on we have to build the summary
if api.sysparam.get_bool("CREATE_PAYMENTS_ON_STOCK_DECREASE"):
value_format = "<b>%s</b>"
total_cost_label = value_format % api.escape(_("Total cost:"))
products_cost_summary_label = SummaryLabel(
klist=self.product_list, column="total_cost", label=total_cost_label, value_format=value_format
)
products_cost_summary_label.show()
self.products_vbox.pack_start(products_cost_summary_label, False)
products = self.store.find(StockDecreaseItem, stock_decrease=self.model)
self.product_list.add_list(list(products))
if self.model.group:
self.payment_list.set_columns(self._get_payment_columns())
self.payment_list.add_list(list(self.model.group.payments))
else:
self.notebook.remove_page(2)
示例11: _setup_widgets
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_widgets(self):
self.purchases_list.set_columns(self._get_purchase_columns())
self.product_list.set_columns(self._get_product_columns())
self.payments_list.set_columns(self._get_payments_columns())
purchases = self.model.get_supplier_purchases()
self.purchases_list.add_list(purchases)
self._build_data(purchases)
self.product_list.add_list(self.products)
self.payments_list.add_list(self.payments)
value_format = '<b>%s</b>'
total_label = "<b>%s</b>" % api.escape(_("Total:"))
purchases_summary_label = SummaryLabel(klist=self.purchases_list,
column='total',
label=total_label,
value_format=value_format)
purchases_summary_label.show()
self.purchases_vbox.pack_start(purchases_summary_label, False, True, 0)
示例12: _setup_widgets
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_widgets(self):
self.product_list.set_columns(self._get_product_columns())
products = self.model.get_items(with_children=False)
# XXX Just a precaution
self.product_list.clear()
for product in products:
self.product_list.append(None, product)
for child in product.children_items:
self.product_list.append(product, child)
value_format = '<b>%s</b>'
total_label = value_format % api.escape(_("Total:"))
products_summary_label = SummaryLabel(klist=self.product_list,
column='total',
label=total_label,
value_format=value_format)
products_summary_label.show()
self.products_vbox.pack_start(products_summary_label, False)
label = self.print_labels.get_children()[0]
label = label.get_children()[0].get_children()[1]
label.set_label(_(u'Print labels'))
示例13: _setup_widgets
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
def _setup_widgets(self):
if self._is_batch:
self._add_batches_tab()
self.receiving_list.set_columns(self._get_receiving_columns())
self.sales_list.set_columns(self._get_sale_columns())
self.transfer_list.set_columns(self._get_transfer_columns())
self.loan_list.set_columns(self._get_loan_columns())
self.decrease_list.set_columns(self._get_decrease_columns())
self.inventory_list.set_columns(self._get_inventory_columns())
self.returned_list.set_columns(self._get_returned_columns())
current_branch = api.get_current_branch(self.store)
items = self.store.find(ReceivingItemView, sellable_id=self.model.id)
if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
items = items.find(Branch.id == current_branch.id)
self.receiving_list.add_list(list(items))
items = SaleItemsView.find_confirmed(self.store,
sellable=self.model)
if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
items = items.find(Branch.id == current_branch.id)
self.sales_list.add_list(list(items))
items = self.store.find(
TransferOrderItem,
And(Ne(TransferOrderItem.transfer_order_id, None),
TransferOrderItem.sellable_id == self.model.id))
self.transfer_list.add_list(list(items))
items = self.store.find(LoanItemView, sellable_id=self.model.id)
if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
items = items.find(Branch.id == current_branch.id)
self.loan_list.add_list(list(items))
items = self.store.find(StockDecreaseItemsView, sellable=self.model.id)
if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
items = items.find(Branch.id == current_branch.id)
self.decrease_list.add_list(list(items))
items = InventoryItemsView.find_by_product(self.store, self.model.product)
if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
items = items.find(Branch.id == current_branch.id)
self.inventory_list.add_list(items)
items = self.store.find(ReturnedSaleItemsView, sellable_id=self.model.id)
if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
items = items.find(Branch.id == current_branch.id)
self.returned_list.add_list(items)
value_format = '<b>%s</b>'
total_label = "<b>%s</b>" % api.escape(_("Total:"))
receiving_summary_label = SummaryLabel(klist=self.receiving_list,
column='quantity',
label=total_label,
value_format=value_format)
receiving_summary_label.show()
self.receiving_vbox.pack_start(receiving_summary_label, False)
sales_summary_label = SummaryLabel(klist=self.sales_list,
column='quantity',
label=total_label,
value_format=value_format)
sales_summary_label.show()
self.sales_vbox.pack_start(sales_summary_label, False)
transfer_summary_label = SummaryLabel(klist=self.transfer_list,
column='quantity',
label=total_label,
value_format=value_format)
transfer_summary_label.show()
self.transfer_vbox.pack_start(transfer_summary_label, False)
loan_summary_label = SummaryLabel(klist=self.loan_list,
column='quantity',
label=total_label,
value_format=value_format)
self.loan_vbox.pack_start(loan_summary_label, False)
decrease_summary_label = SummaryLabel(klist=self.decrease_list,
column='quantity',
label=total_label,
value_format=value_format)
decrease_summary_label.show()
self.decrease_vbox.pack_start(decrease_summary_label, False)
示例14: ProductComponentSlave
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
class ProductComponentSlave(BaseEditorSlave):
gladefile = 'ProductComponentSlave'
model_type = TemporaryProductComponent
proxy_widgets = ['production_time']
def __init__(self, store, product=None, visual_mode=False):
self._product = product
self._remove_component_list = []
BaseEditorSlave.__init__(self, store, model=None, visual_mode=visual_mode)
self._setup_widgets()
def _get_columns(self):
return [Column('code', title=_(u'Code'), data_type=int,
expander=True, sorted=True),
Column('quantity', title=_(u'Quantity'),
data_type=Decimal),
Column('unit', title=_(u'Unit'), data_type=str),
Column('description', title=_(u'Description'),
data_type=str, expand=True),
Column('category', title=_(u'Category'), data_type=str),
# Translators: Ref. is for Reference (as in design reference)
Column('design_reference', title=_(u'Ref.'), data_type=str),
Column('production_cost', title=_(u'Production Cost'),
format_func=get_formatted_cost, data_type=currency),
Column('total_production_cost', title=_(u'Total'),
format_func=get_formatted_cost, data_type=currency),
]
def _setup_widgets(self):
component_list = list(self._get_products())
if component_list:
self.component_combo.prefill(component_list)
else:
self.sort_components_check.set_sensitive(False)
self.component_tree.set_columns(self._get_columns())
self._populate_component_tree()
self.component_label = SummaryLabel(
klist=self.component_tree,
column='total_production_cost',
label='<b>%s</b>' % api.escape(_(u'Total:')),
value_format='<b>%s</b>')
self.component_label.show()
self.component_tree_vbox.pack_start(self.component_label, False)
self.info_label.set_bold(True)
self._update_widgets()
if self.visual_mode:
self.component_combo.set_sensitive(False)
self.add_button.set_sensitive(False)
self.sort_components_check.set_sensitive(False)
def _get_products(self, sort_by_name=True):
# FIXME: This is a kind of workaround until we have the
# SQLCompletion funcionality, then we will not need to sort the
# data.
if sort_by_name:
attr = ProductFullStockView.description
else:
attr = ProductFullStockView.category_description
products = []
query = Eq(Product.is_grid, False)
for product_view in self.store.find(ProductFullStockView, query).order_by(attr):
if product_view.product is self._product:
continue
description = product_view.get_product_and_category_description()
products.append((description, product_view.product))
return products
def _update_widgets(self):
has_selected = self.component_combo.read() is not None
self.add_button.set_sensitive(has_selected)
has_selected = self.component_tree.get_selected() is not None
self.edit_button.set_sensitive(has_selected)
self.remove_button.set_sensitive(has_selected)
# FIXME: This is wrong. Summary label already calculates the total. We
# are duplicating this.
value = self.get_component_cost()
self.component_label.set_value(get_formatted_cost(value))
if not self._validate_components():
self.component_combo.set_sensitive(False)
self.add_button.set_sensitive(False)
self.edit_button.set_sensitive(False)
self.remove_button.set_sensitive(False)
self.info_label.set_text(_(u"This product is being produced. "
"Can't change components."))
def _populate_component_tree(self):
self._add_to_component_tree()
def _get_components(self, product):
for component in self.store.find(ProductComponent, product=product):
yield TemporaryProductComponent(product=component.product,
component=component.component,
quantity=component.quantity,
design_reference=component.design_reference)
#.........这里部分代码省略.........
示例15: SearchContainer
# 需要导入模块: from kiwi.ui.objectlist import SummaryLabel [as 别名]
# 或者: from kiwi.ui.objectlist.SummaryLabel import show [as 别名]
#.........这里部分代码省略.........
"with columns or callback set")
assert not search_filter.parent
self.set_filter_position(search_filter, position)
search_filter.connect('changed', self._on_search_filter__changed)
search_filter.connect('removed', self._on_search_filter__remove)
self._search_filters.append(search_filter)
def remove_filter(self, filter):
self.filters_box.remove(filter)
self._search_filters.remove(filter)
filter.destroy()
if self._auto_search:
self.search()
def get_search_filters(self):
return self._search_filters
def set_filter_position(self, search_filter, position):
"""
Set the the filter position.
@param search_filter:
@param position:
"""
if search_filter.parent:
search_filter.parent.remove(search_filter)
if position == SearchFilterPosition.TOP:
self.hbox.pack_start(search_filter, False, False)
self.hbox.reorder_child(search_filter, 0)
elif position == SearchFilterPosition.BOTTOM:
self.filters_box.pack_start(search_filter, False, False)
search_filter.show()
def get_filter_position(self, search_filter):
"""
Get filter by position.
@param search_filter:
"""
if search_filter.parent == self.hbox:
return SearchFilterPosition.TOP
elif search_filter.parent == self:
return SearchFilterPosition.BOTTOM
else:
raise AssertionError(search_filter)
def set_query_executer(self, querty_executer):
"""
Ties a QueryExecuter instance to the SearchContainer class
@param querty_executer: a querty executer
@type querty_executer: a L{QueryExecuter} subclass
"""
if not isinstance(querty_executer, QueryExecuter):
raise TypeError("querty_executer must be a QueryExecuter instance")
self._query_executer = querty_executer
def get_query_executer(self):
"""
Fetchs the QueryExecuter for the SearchContainer
@returns: a querty executer
@rtype: a L{QueryExecuter} subclass
"""
return self._query_executer