本文整理汇总了Python中stoqlib.api.api.escape函数的典型用法代码示例。如果您正苦于以下问题:Python escape函数的具体用法?Python escape怎么用?Python escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了escape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_widgets
def _setup_widgets(self):
self.sales_list.set_columns(self._get_sale_columns())
self.returned_sales_list.set_columns(self._get_returned_sale_columns())
self.product_list.set_columns(self._get_product_columns())
self.services_list.set_columns(self._get_services_columns())
self.work_order_list.set_columns(self._get_work_order_columns())
self.payments_list.set_columns(self._get_payments_columns())
self.calls_list.set_columns(self._get_calls_columns())
self.account_list.set_columns(self._get_account_columns())
self.sales_list.add_list(self.model.get_client_sales())
self.returned_sales_list.add_list(self.model.get_client_returned_sales())
self.product_list.add_list(self.model.get_client_products())
self.services_list.add_list(self.model.get_client_services())
self.work_order_list.add_list(self.model.get_client_work_orders())
self.payments_list.add_list(self.model.get_client_payments())
self.calls_list.add_list(self.model.person.calls)
self.account_list.add_list(self.model.get_credit_transactions())
value_format = '<b>%s</b>'
total_label = "<b>%s</b>" % api.escape(_("Total:"))
saldo_label = "<b>%s</b>" % api.escape(_("Balance:"))
sales_summary_label = SummaryLabel(klist=self.sales_list,
column='total',
label=total_label,
value_format=value_format)
account_summary_label = SummaryLabel(klist=self.account_list,
column='paid_value',
label=saldo_label,
value_format=value_format,
data_func=lambda p: p.is_outpayment())
sales_summary_label.show()
account_summary_label.show()
self.sales_vbox.pack_start(sales_summary_label, False)
self.account_vbox.pack_start(account_summary_label, False)
示例2: _setup_widgets
def _setup_widgets(self):
self.sales_list.set_columns(self._get_sale_columns())
self.product_list.set_columns(self._get_product_columns())
self.services_list.set_columns(self._get_services_columns())
self.payments_list.set_columns(self._get_payments_columns())
self.calls_list.set_columns(self._get_calls_columns())
self.account_list.set_columns(self._get_account_columns())
self.sales_list.add_list(self.model.get_client_sales())
self.product_list.add_list(self.model.get_client_products())
self.services_list.add_list(self.model.get_client_services())
self.payments_list.add_list(self.model.get_client_payments())
self.calls_list.add_list(self.model.person.calls)
self.account_list.add_list(self.model.get_credit_transactions())
value_format = '<b>%s</b>'
total_label = "<b>%s</b>" % api.escape(_("Total:"))
saldo_label = "<b>%s</b>" % api.escape(_("Saldo:"))
sales_summary_label = SummaryLabel(klist=self.sales_list,
column='total',
label=total_label,
value_format=value_format)
account_summary_label = SummaryLabel(klist=self.account_list,
column='value',
label=saldo_label,
value_format=value_format)
sales_summary_label.show()
account_summary_label.show()
self.sales_vbox.pack_start(sales_summary_label, False)
self.account_vbox.pack_start(account_summary_label, False)
示例3: _setup_summary_labels
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)
示例4: describe_item
def describe_item(self, client_view):
details = []
birth_date = (client_view.birth_date and
client_view.birth_date.strftime('%x'))
for label, value in [
(_("Phone"), client_view.phone_number),
(_("Mobile"), client_view.mobile_number),
(self._person_l10n.label, client_view.cpf),
(self._company_l10n.label, client_view.cnpj),
(_("RG"), client_view.rg_number),
(_("Birth date"), birth_date),
(_("Category"), client_view.client_category),
(_("Address"), format_address(client_view))]:
if not value:
continue
details.append('%s: %s' % (label, api.escape(value)))
name = "<big>%s</big>" % (api.escape(client_view.name), )
if details:
short = name + '\n<span size="small">%s</span>' % (
api.escape(', '.join(details[:1])))
complete = name + '\n<span size="small">%s</span>' % (
api.escape('\n'.join(details)))
else:
short = name
complete = name
return short, complete
示例5: setup_proxies
def setup_proxies(self):
receiving_date = self.model.get_receival_date_str()
branch_name = self.model.get_branch_name()
text = _('Received in <b>%s</b> for branch <b>%s</b>')
header_text = text % (api.escape(receiving_date),
api.escape(branch_name))
self.header_label.set_markup(header_text)
self.add_proxy(self.model, ['notes'])
示例6: __init__
def __init__(self, cert_name, retry=False):
super(CertificatePasswordDialog, self).__init__(None)
text = _("Enter the password for <b>%s</b>:") % (api.escape(cert_name), )
if retry:
error_text = '<b><span color="red">%s</span></b>' % (
api.escape(_("Wrong password provided...")), )
text = "%s\n%s" % (error_text, text)
self.info_lbl.set_markup(text)
示例7: refresh
def refresh(self):
if stoq.trial_mode:
self.status = ResourceStatus.STATUS_NA
self.reason = (_('Online features are not available in trial mode'))
self.reason_long = _('Online features require a subscription of Stoq.link')
return
if not api.sysparam.get_bool('ONLINE_SERVICES'):
self.status = ResourceStatus.STATUS_NA
self.reason = (_("Online services (Stoq.link integration, backup, "
"etc) not enabled..."))
self.reason_long = _('Enable the parameter "Online Services" '
'on the "Admin" app to solve this issue')
return
if self._check_running():
self.status = self.STATUS_OK
self.reason = _("Online services data hub is running fine.")
self.reason_long = None
else:
self.status = ResourceStatus.STATUS_ERROR
self.reason = _("Online services data hub not found...")
package = '<a href="apt://stoq-server">stoq-server</a>'
self.reason_long = safe_str(
api.escape(_("Install and configure the %s package "
"to solve this issue")) % (package, ))
示例8: search_completed
def search_completed(self, results):
# We are only interested in the workorders whose status are in one of our
# columns
results = results.find(WorkOrder.status.is_in(self.status_columns))
for work_order_view in results.order_by(WorkOrder.open_date):
work_order = work_order_view.work_order
status_name = WorkOrder.statuses.get(work_order.status)
# Skip cancel/delivered etc
if status_name is None:
continue
# Since this column isnt one of the |work_order| status
if work_order.client_informed_date:
status_name = _('Client informed')
column = self.get_column_by_title(status_name)
if column is None:
continue
if work_order_view.sellable:
description = '%s - %s' % (
work_order_view.sellable,
work_order_view.description)
else:
description = work_order_view.description
# FIXME: Figure out a better way of rendering
work_order_view.markup = '<b>%s</b>\n%s\n%s' % (
description,
str(api.escape(work_order_view.client_name)),
work_order_view.open_date.strftime('%x'))
column.append_item(work_order_view)
示例9: _setup_summary_labels
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)
示例10: create_ui
def create_ui(self):
if api.sysparam.get_bool('SMART_LIST_LOADING'):
self.search.enable_lazy_search()
self.window.add_new_items([
self.NewOrder,
self.NewQuote,
self.NewProduct,
self.NewConsignment])
self.window.add_search_items([
self.Products,
self.Suppliers,
self.SearchQuotes,
self.Services])
self.search.set_summary_label(column='total',
label=('<b>%s</b>' %
api.escape(_('Orders total:'))),
format='<b>%s</b>',
parent=self.get_statusbar_message_area())
self.results.set_selection_mode(gtk.SELECTION_MULTIPLE)
self.Confirm.set_sensitive(False)
self._inventory_widgets = [self.NewConsignment,
self.CloseInConsignment]
self.register_sensitive_group(self._inventory_widgets,
lambda: not self.has_open_inventory())
示例11: create_ui
def create_ui(self):
if api.sysparam.get_bool('SMART_LIST_LOADING'):
self.search.enable_lazy_search()
self.window.add_print_items2([
(_("Print quote..."), 'work_order.PrintQuote'),
(_("Print receipt..."), 'work_order.PrintReceipt'),
])
self.window.add_export_items()
self.window.add_extra_items2([
(_("Send orders..."), 'work_order.SendOrders'),
(_("Receive orders..."), 'work_order.ReceiveOrders'),
])
self.window.add_extra_items([self.ViewKanban, self.ViewList])
self.window.add_new_items2([
(_("Work order..."), 'work_order.NewOrder'),
])
self.window.add_search_items([
self.Products,
self.Services,
self.Categories,
self.Clients,
])
self.search.set_summary_label(
column='total',
label=('<b>%s</b>' %
api.escape(_('Total:'))),
format='<b>%s</b>',
parent=self.get_statusbar_message_area())
self.results.set_cell_data_func(self._on_results__cell_data_func)
示例12: _update_title
def _update_title(self):
# Workaround to get the current calendar date
view = self.get_view()
view.execute_script("document.title = $('.fc-header-title').text()")
title = view.get_property('title')
self.app.date_label.set_markup(
'<big><b>%s</b></big>' % api.escape(title))
示例13: _till_status_changed
def _till_status_changed(self, closed, blocked):
def large(s):
return '<span weight="bold" size="xx-large">%s</span>' % (
api.escape(s), )
if closed:
text = large(_("Till closed"))
if not blocked:
text += '\n\n<span size="large"><a href="open-till">%s</a></span>' % (
api.escape(_('Open till')))
elif blocked:
text = large(_("Till blocked"))
else:
text = large(_("Till open"))
self.till_status_label.set_use_markup(True)
self.till_status_label.set_justify(gtk.JUSTIFY_CENTER)
self.till_status_label.set_markup(text)
self.set_sensitive([self.TillOpen], closed)
self.set_sensitive([self.TillVerify], not closed and not blocked)
self.set_sensitive([
self.TillClose, self.NewTrade, self.LoanClose, self.WorkOrderClose
], not closed or blocked)
self._set_sale_sensitive(not closed and not blocked)
示例14: _update_account_type
def _update_account_type(self, account_type):
if not self.account_type.get_sensitive():
return
if account_type != Account.TYPE_BANK:
self._remove_bank_widgets()
self._remove_bank_option_widgets()
self.code.set_sensitive(True)
return
self.code.set_sensitive(False)
self.bank_type = ProxyComboBox()
self._add_widget(api.escape(_("Bank:")), self.bank_type)
self.bank_type.connect('content-changed',
self._on_bank_type__content_changed)
self.bank_type.show()
banks = [(_('Generic'), None)]
banks.extend([(b.description,
b.bank_number) for b in get_all_banks()])
self.bank_type.prefill(banks)
if self.model.bank:
try:
self.bank_type.select(self.model.bank.bank_number)
except KeyError:
self.bank_type.select(None)
self._update_bank_type()
示例15: describe_item
def describe_item(self, view):
details = []
for label, value in [(_("Name"), view.name), (_("CRM"), view.crm_number)]:
if not value:
continue
details.append('%s: %s' % (label, api.escape(value)))
name = "<big>%s</big>" % (api.escape(view.name), )
if details:
short = name + '\n<span size="small">%s</span>' % (
api.escape(', '.join(details[:1])))
complete = name + '\n<span size="small">%s</span>' % (
api.escape('\n'.join(details)))
else:
short = name
complete = name
return short, complete