本文整理汇总了Python中stoqlib.lib.translation._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: on_quantity__validate
def on_quantity__validate(self, widget, value):
if self._expanded_edition:
return
if value <= 0:
return ValidationError(_(u'The quantity should be positive.'))
if value and not self._has_stock(value):
return ValidationError(_(u'Quantity not available in stock.'))
开发者ID:LeonamSilva,项目名称:stoq,代码行数:7,代码来源:loaneditor.py
示例2: _get_sales_columns
def _get_sales_columns(self):
return [IdentifierColumn('identifier', title=_('Sale #'), sorted=True),
Column('salesperson', title=_('Sales Person'), data_type=str),
Column('client', title=_('Client'), data_type=str, expand=True),
Column('branch', title=_('Branch'), data_type=str, visible=False),
Column('value', title=_('Value'), data_type=str,
justify=Gtk.Justification.RIGHT)]
开发者ID:hackedbellini,项目名称:stoq,代码行数:7,代码来源:tilldailymovement.py
示例3: _get_account_columns
def _get_account_columns(self):
def format_withdrawal(value):
if value < 0:
return currency(abs(value)).format(symbol=True, precision=2)
def format_deposit(value):
if value > 0:
return currency(value).format(symbol=True, precision=2)
if self.model.account_type == Account.TYPE_INCOME:
color_func = lambda x: False
else:
color_func = lambda x: x < 0
return [Column('date', title=_("Date"), data_type=datetime.date, sorted=True),
Column('code', title=_("Code"), data_type=unicode),
Column('description', title=_("Description"),
data_type=unicode, expand=True),
Column('account', title=_("Account"), data_type=unicode),
Column('value',
title=self.model.account.get_type_label(out=False),
data_type=currency,
format_func=format_deposit),
Column('value',
title=self.model.account.get_type_label(out=True),
data_type=currency,
format_func=format_withdrawal),
ColoredColumn('total', title=_("Total"), data_type=currency,
color='red',
data_func=color_func)]
开发者ID:leandrorchaves,项目名称:stoq,代码行数:29,代码来源:financial.py
示例4: _check_param_online_services
def _check_param_online_services(self):
from stoqlib.database.runtime import new_store
from stoqlib.lib.parameters import sysparam
from gi.repository import Gtk
if sysparam.get_bool('ONLINE_SERVICES') is None:
from kiwi.ui.dialogs import HIGAlertDialog
# FIXME: All of this is to avoid having to set markup as the default
# in kiwi/ui/dialogs:HIGAlertDialog.set_details, after 1.0
# this can be simplified when we fix so that all descriptions
# sent to these dialogs are properly escaped
dialog = HIGAlertDialog(
parent=None,
flags=Gtk.DialogFlags.MODAL,
type=Gtk.MessageType.WARNING)
dialog.add_button(_("Not right now"), Gtk.ResponseType.NO)
dialog.add_button(_("Enable online services"), Gtk.ResponseType.YES)
dialog.set_primary(_('Do you want to enable Stoq online services?'))
dialog.set_details(PRIVACY_STRING, use_markup=True)
dialog.set_default_response(Gtk.ResponseType.YES)
response = dialog.run()
dialog.destroy()
store = new_store()
sysparam.set_bool(store, 'ONLINE_SERVICES', response == Gtk.ResponseType.YES)
store.commit()
store.close()
开发者ID:hackedbellini,项目名称:stoq,代码行数:27,代码来源:shell.py
示例5: _maybe_create_database
def _maybe_create_database(self):
logger.info('_maybe_create_database (db_is_local=%s, remove_demo=%s)'
% (self.wizard.db_is_local, self.wizard.remove_demo))
if self.wizard.db_is_local:
self._launch_stoqdbadmin()
return
elif self.wizard.remove_demo:
self._launch_stoqdbadmin()
return
self.wizard.write_pgpass()
settings = self.wizard.settings
self.wizard.config.load_settings(settings)
# store = settings.get_super_store()
# version = store.dbVersion()
# if version < (8, 1):
# info(_("Stoq requires PostgresSQL 8.1 or later, but %s found") %
# ".".join(map(str, version)))
# store.close()
# return False
# Secondly, ask the user if he really wants to create the database,
dbname = settings.dbname
if yesno(_(u"The specified database '%s' does not exist.\n"
u"Do you want to create it?") % dbname,
gtk.RESPONSE_YES, _(u"Create database"), _(u"Don't create")):
self.process_view.feed("** Creating database\r\n")
self._launch_stoqdbadmin()
else:
self.process_view.feed("** Not creating database\r\n")
self.wizard.disable_next()
开发者ID:leandrorchaves,项目名称:stoq,代码行数:32,代码来源:config.py
示例6: _remove_work_order
def _remove_work_order(self, holder, name, work_order, work_order_id):
if work_order.is_finished():
warning(_("You cannot remove workorder with the status '%s'")
% work_order.status_str)
return
if not work_order.get_items().find().is_empty():
warning(_("This workorder already has items and cannot be removed"))
return
# We cannot remove the WO from the database (since it already has some
# history), but we can disassociate it from the sale, cancel and leave
# a reason for it.
reason = (_(u'Removed from sale %s') % work_order.sale.identifier)
work_order.sale = None
work_order.cancel(reason=reason)
self._work_order_ids.remove(work_order_id)
# Remove the tab
self.detach_slave(name)
pagenum = self.work_orders_nb.page_num(holder)
self.work_orders_nb.remove_page(pagenum)
# And remove the WO
self.wizard.workorders.remove(work_order)
self.force_validation()
开发者ID:amaurihamasu,项目名称:stoq,代码行数:27,代码来源:workorderquotewizard.py
示例7: _get_columns
def _get_columns(self):
return [Column('description', title=_(u'Product'),
data_type=str, expand=True),
Column('ordered', title=_(u'Ordered'),
data_type=int),
Column('stock', title=_(u'Stock'),
data_type=int)]
开发者ID:Guillon88,项目名称:stoq,代码行数:7,代码来源:missingitemsdialog.py
示例8: run_wizard
def run_wizard(cls, parent):
"""Run the wizard to create a product
This will run the wizard and after finishing, ask if the user
wants to create another product alike. The product will be
cloned and `stoqlib.gui.editors.producteditor.ProductEditor`
will run as long as the user chooses to create one alike
"""
with api.new_store() as store:
rv = run_dialog(cls, parent, store)
if rv:
inner_rv = rv
while yesno(_("Would you like to register another product alike?"),
gtk.RESPONSE_NO, _("Yes"), _("No")):
with api.new_store() as store:
template = store.fetch(rv)
inner_rv = run_dialog(ProductEditor, parent, store,
product_type=template.product_type,
template=template)
if not inner_rv:
break
# We are insterested in the first rv that means that at least one
# obj was created.
return rv
开发者ID:Guillon88,项目名称:stoq,代码行数:28,代码来源:productwizard.py
示例9: _check_param_online_services
def _check_param_online_services(self):
from stoqlib.database.runtime import get_default_store, new_store
from stoqlib.lib.parameters import sysparam
import gtk
sparam = sysparam(get_default_store())
if sparam.ONLINE_SERVICES is None:
from kiwi.ui.dialogs import HIGAlertDialog
# FIXME: All of this is to avoid having to set markup as the default
# in kiwi/ui/dialogs:HIGAlertDialog.set_details, after 1.0
# this can be simplified when we fix so that all descriptions
# sent to these dialogs are properly escaped
dialog = HIGAlertDialog(
parent=None,
flags=gtk.DIALOG_MODAL,
type=gtk.MESSAGE_WARNING)
dialog.add_button(_("Not right now"), gtk.RESPONSE_NO)
dialog.add_button(_("Enable online services"), gtk.RESPONSE_YES)
dialog.set_primary(_('Do you want to enable Stoq online services?'))
dialog.set_details(PRIVACY_STRING, use_markup=True)
dialog.set_default_response(gtk.RESPONSE_YES)
response = dialog.run()
dialog.destroy()
store = new_store()
sysparam(store).ONLINE_SERVICES = int(bool(response == gtk.RESPONSE_YES))
store.commit()
store.close()
开发者ID:qman1989,项目名称:stoq,代码行数:28,代码来源:shell.py
示例10: validate_invoice_number
def validate_invoice_number(invoice_number, store):
if not 0 < invoice_number <= 999999999:
return ValidationError(
_("Invoice number must be between 1 and 999999999"))
if not store.find(Invoice, invoice_number=invoice_number).is_empty():
return ValidationError(_(u'Invoice number already used.'))
开发者ID:hackedbellini,项目名称:stoq,代码行数:7,代码来源:invoice.py
示例11: _write_account_cells
def _write_account_cells(self, sheet, cells):
for y, cell in enumerate(cells):
sheet.write(2 + y, 0, cell, HEADER_LEFT_STYLE)
n_rows = len(cells)
sheet.write(n_rows + 2, 0, _(u"Average"), HEADER_LEFT_STYLE)
sheet.write(n_rows + 3, 0, _(u"Total"), HEADER_LEFT_STYLE)
开发者ID:rg3915,项目名称:stoq,代码行数:7,代码来源:financial.py
示例12: _write_headers
def _write_headers(self, sheet, n_columns):
for x in range(n_columns):
month_name = get_month_names()[x]
sheet.write(1, 1 + x, month_name, HEADER_TOP_STYLE)
sheet.write(1, n_columns + 1, _(u"Average"), HEADER_TOP_STYLE)
sheet.write(1, n_columns + 2, _(u"Total"), HEADER_TOP_STYLE)
开发者ID:rg3915,项目名称:stoq,代码行数:7,代码来源:financial.py
示例13: on_return_quantity__validate
def on_return_quantity__validate(self, widget, value):
if value < self._original_return_qty:
return ValidationError(_(u'Can not decrease this quantity.'))
total = value + self.model.sale_quantity
if total > self.model.quantity:
return ValidationError(_(u'Sale and return quantity is greater '
'than the total quantity.'))
开发者ID:LeonamSilva,项目名称:stoq,代码行数:7,代码来源:loaneditor.py
示例14: create_ui
def create_ui(self):
if api.sysparam(self.store).SMART_LIST_LOADING:
self.search.enable_lazy_search()
self.popup = self.uimanager.get_widget('/StockSelection')
self.window.add_new_items([self.NewReceiving, self.NewTransfer,
self.NewStockDecrease, self.LoanNew])
self.window.add_search_items([
self.SearchStockItems,
self.SearchStockDecrease,
self.SearchClosedStockItems,
self.SearchProductHistory,
self.SearchPurchasedStockItems,
self.SearchTransfer,
])
self.window.Print.set_tooltip(
_("Print a report of these products"))
self._inventory_widgets = [self.NewTransfer, self.NewReceiving,
self.StockInitial, self.NewStockDecrease,
self.LoanNew, self.LoanClose]
self.register_sensitive_group(self._inventory_widgets,
lambda: not self.has_open_inventory())
self.image_viewer = None
self.image = gtk.Image()
self.edit_button = self.uimanager.get_widget('/toolbar/AppToolbarPH/EditProduct')
self.edit_button.set_icon_widget(self.image)
self.image.show()
self.search.set_summary_label(column='stock',
label=_('<b>Stock Total:</b>'),
format='<b>%s</b>',
parent=self.get_statusbar_message_area())
开发者ID:tmaxter,项目名称:stoq,代码行数:34,代码来源:stock.py
示例15: on_SalesCancel__activate
def on_SalesCancel__activate(self, action):
sale_view = self.results.get_selected()
can_cancel = api.sysparam.get_bool('ALLOW_CANCEL_LAST_COUPON')
# A plugin (e.g. ECF) can avoid the cancelation of a sale
# because it wants it to be cancelled using another way
if can_cancel and SaleAvoidCancelEvent.emit(sale_view.sale):
return
store = api.new_store()
sale = store.fetch(sale_view.sale)
msg_text = _(u"This will cancel the sale, Are you sure?")
model = SaleComment(store=store, sale=sale,
author=api.get_current_user(store))
retval = self.run_dialog(
NoteEditor, store, model=model, attr_name='comment',
message_text=msg_text, label_text=_(u"Reason"),
mandatory=True, ok_button_label=_(u"Cancel sale"),
cancel_button_label=_(u"Don't cancel"))
if not retval:
store.rollback()
return
sale.cancel()
store.commit(close=True)
self.refresh()
开发者ID:Guillon88,项目名称:stoq,代码行数:27,代码来源:sales.py
示例16: _update_filter_items
def _update_filter_items(self):
options = [
FilterItem(_('Received payments'), 'status:paid'),
FilterItem(_('To receive'), 'status:not-paid'),
FilterItem(_('Late payments'), 'status:late'),
]
self.add_filter_items(PaymentCategory.TYPE_RECEIVABLE, options)
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:7,代码来源:receivable.py
示例17: _update_till_status
def _update_till_status(self, closed, blocked):
# Three different situations;
#
# - Till is closed
# - Till is opened
# - Till was not closed the previous fiscal day (blocked)
self.set_sensitive([self.TillOpen], closed)
self.set_sensitive([self.TillClose, self.PaymentReceive],
not closed or blocked)
widgets = [self.TillVerify, self.TillAddCash, self.TillRemoveCash,
self.SearchTillHistory, self.app_vbox]
self.set_sensitive(widgets, not closed and not blocked)
if closed:
text = _(u"Till closed")
self.clear()
self.setup_focus()
elif blocked:
text = _(u"Till blocked from previous day")
else:
till = Till.get_current(self.store)
text = _(u"Till opened on %s") % till.opening_date.strftime('%x')
self.till_status_label.set_text(text)
self._update_toolbar_buttons()
self._update_total()
开发者ID:pkaislan,项目名称:stoq,代码行数:29,代码来源:till.py
示例18: print_quote_details
def print_quote_details(self, model, payments_created=False):
msg = _('Would you like to print the quote details now?')
# We can only print the details if the quote was confirmed.
if yesno(msg, gtk.RESPONSE_YES,
_("Print quote details"), _("Don't print")):
orders = WorkOrder.find_by_sale(self.model.store, self.model)
print_report(OpticalWorkOrderReceiptReport, list(orders))
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:7,代码来源:opticalwizard.py
示例19: on_NewTrade__activate
def on_NewTrade__activate(self, action):
if self._trade:
if yesno(
_("There is already a trade in progress... Do you "
"want to cancel it and start a new one?"),
gtk.RESPONSE_NO, _("Cancel trade"), _("Finish trade")):
self._clear_trade(remove=True)
else:
return
if self._current_store:
store = self._current_store
store.savepoint('before_run_wizard_saletrade')
else:
store = api.new_store()
trade = self.run_dialog(SaleTradeWizard, store)
if trade:
self._trade = trade
self._current_store = store
elif self._current_store:
store.rollback_to_savepoint('before_run_wizard_saletrade')
else:
store.rollback(close=True)
self._show_trade_infobar(trade)
开发者ID:pkaislan,项目名称:stoq,代码行数:26,代码来源:pos.py
示例20: _check_branch
def _check_branch(self):
from stoqlib.database.runtime import (get_default_store, new_store,
get_current_station,
set_current_branch_station)
from stoqlib.domain.person import Company
from stoqlib.lib.parameters import sysparam
from stoqlib.lib.message import info
default_store = get_default_store()
compaines = default_store.find(Company)
if (compaines.count() == 0 or
not sysparam.has_object('MAIN_COMPANY')):
from stoqlib.gui.base.dialogs import run_dialog
from stoqlib.gui.dialogs.branchdialog import BranchDialog
if self._ran_wizard:
info(_("You need to register a company before start using Stoq"))
else:
info(_("Could not find a company. You'll need to register one "
"before start using Stoq"))
store = new_store()
person = run_dialog(BranchDialog, None, store)
if not person:
raise SystemExit
branch = person.branch
sysparam.set_object(store, 'MAIN_COMPANY', branch)
current_station = get_current_station(store)
if current_station is not None:
current_station.branch = branch
store.commit()
store.close()
set_current_branch_station(default_store, station_name=None)
开发者ID:hackedbellini,项目名称:stoq,代码行数:33,代码来源:shell.py
注:本文中的stoqlib.lib.translation._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论