本文整理汇总了Python中stoqlib.lib.message.yesno函数的典型用法代码示例。如果您正苦于以下问题:Python yesno函数的具体用法?Python yesno怎么用?Python yesno使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yesno函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _delete_account
def _delete_account(self, account_view):
store = api.new_store()
account = store.fetch(account_view.account)
methods = PaymentMethod.get_by_account(store, account)
if methods.count() > 0:
if not yesno(
_('This account is used in at least one payment method.\n'
'To be able to delete it the payment methods needs to be'
're-configured first'), gtk.RESPONSE_NO,
_("Configure payment methods"), _("Keep account")):
store.close()
return
elif not yesno(
_('Are you sure you want to remove account "%s" ?') % (
(account_view.description, )), gtk.RESPONSE_NO,
_("Remove account"), _("Keep account")):
store.close()
return
if account_view.id in self._pages:
account_page = self._pages[account_view.id]
self._close_page(account_page)
self.accounts.remove(account_view)
self.accounts.flush()
imbalance = api.sysparam(store).IMBALANCE_ACCOUNT
for method in methods:
method.destination_account = imbalance
account.remove(store)
store.commit(close=True)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:32,代码来源:financial.py
示例2: open
def open(self):
while True:
log.info("opening coupon")
try:
self.emit('open')
break
except CouponOpenError:
if not self.cancel():
return False
except OutofPaperError:
if not yesno(
_("The fiscal printer has run out of paper.\nAdd more paper "
"before continuing."),
gtk.RESPONSE_YES, _("Resume"), _("Confirm later")):
return False
return self.open()
except PrinterOfflineError:
if not yesno(
(_(u"The fiscal printer is offline, turn it on and try "
"again")),
gtk.RESPONSE_YES, _(u"Resume"), _(u"Confirm later")):
return False
return self.open()
except (DriverError, DeviceError) as e:
warning(_(u"It is not possible to emit the coupon"),
str(e))
return False
self._coo = self.emit('get-coo')
self.totalized = False
self.coupon_closed = False
self.payments_setup = False
return True
开发者ID:igorferreira,项目名称:stoq,代码行数:33,代码来源:fiscalprinter.py
示例3: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
# We want to close the checkout, so the user will be back to the
# list of items in the sale.
self.close()
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
self.retval = True
invoice_number = self.invoice_model.invoice_number
# Workaround for bug 4218: If the invoice is was already used by
# another store (another cashier), try using the next one
# available, or show a warning if the number was manually set.
while True:
try:
self.store.savepoint('before_set_invoice_number')
self.model.invoice_number = invoice_number
# We need to flush the database here, or a possible collision
# of invoice_number will only be detected later on, when the
# execution flow is not in the try-except anymore.
self.store.flush()
except IntegrityError:
self.store.rollback_to_savepoint('before_set_invoice_number')
if self._invoice_changed():
warning(_(u"The invoice number %s is already used. "
"Confirm the sale again to chose another one.") %
invoice_number)
self.retval = False
break
else:
invoice_number += 1
else:
break
self.close()
group = self.model.group
# FIXME: This is set too late on Sale.confirm(). If PaymentGroup don't
# have a payer, we won't be able to print bills/booklets.
group.payer = self.model.client and self.model.client.person
# Commit before printing to avoid losing data if something breaks
self.store.confirm(self.retval)
ConfirmSaleWizardFinishEvent.emit(self.model)
booklets = list(group.get_payments_by_method_name(u'store_credit'))
bills = list(group.get_payments_by_method_name(u'bill'))
if (booklets and
yesno(_("Do you want to print the booklets for this sale?"),
gtk.RESPONSE_YES, _("Print booklets"), _("Don't print"))):
print_report(BookletReport, booklets)
if (bills and BillReport.check_printable(bills) and
yesno(_("Do you want to print the bills for this sale?"),
gtk.RESPONSE_YES, _("Print bills"), _("Don't print"))):
print_report(BillReport, bills)
开发者ID:pkaislan,项目名称:stoq,代码行数:59,代码来源:salewizard.py
示例4: setup_payments
def setup_payments(self, sale):
""" Add the payments defined in the sale to the coupon. Note that this
function must be called after all the payments has been created.
"""
# XXX: Remove this when bug #2827 is fixed.
if not self._item_ids:
return True
if self.payments_setup:
return True
log.info('Adding payments to the coupon')
while True:
try:
self.emit('add-payments', sale)
self.payments_setup = True
return True
except (DriverError, DeviceError), details:
log.info("It is not possible to add payments to the coupon: %s"
% str(details))
if not yesno(_(u"Erro na impressão. Deseja tentar novamente?"),
gtk.RESPONSE_YES,
_("Sim"), _(u"Não")):
CancelPendingPaymentsEvent.emit()
return False
_flush_interface()
开发者ID:romaia,项目名称:stoq,代码行数:26,代码来源:fiscalprinter.py
示例5: setup_payments
def setup_payments(self, sale):
""" Add the payments defined in the sale to the coupon. Note that this
function must be called after all the payments has been created.
"""
# XXX: Remove this when bug #2827 is fixed.
if not self._item_ids:
return True
if self.payments_setup:
return True
log.info('Adding payments to the coupon')
while True:
try:
self.emit('add-payments', sale)
self.payments_setup = True
return True
except (DriverError, DeviceError) as details:
log.info("It is not possible to add payments to the coupon: %s"
% str(details))
if not yesno(_(u"An error occurred while trying to print. "
u"Would you like to try again?"),
gtk.RESPONSE_YES,
_("Try again"), _(u"Don't try again")):
CancelPendingPaymentsEvent.emit()
return False
_flush_interface()
开发者ID:igorferreira,项目名称:stoq,代码行数:27,代码来源:fiscalprinter.py
示例6: 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:qman1989,项目名称:stoq,代码行数:7,代码来源:opticalwizard.py
示例7: _finish
def _finish(self, returncode):
logger.info('CreateDatabaseStep._finish (returncode=%s)' % returncode)
if returncode:
self.wizard.enable_back()
# Failed to execute/create database
if returncode == 30:
# This probably happened because the user either;
# - pressed cancel in the authentication popup
# - user erred the password 3 times
# Allow him to try again
if yesno(_("Something went wrong while trying to create "
"the database. Try again?"),
gtk.RESPONSE_NO, _("Change settings"), _("Try again")):
return
self._launch_stoqdbadmin()
return
elif returncode == 31:
# Missing postgresql-contrib package
self.expander.set_expanded(True)
warning(_("Your database is missing the postgresql-contrib "
"package. Install it and try again"))
else:
# Unknown error, just inform user that something went wrong.
self.expander.set_expanded(True)
warning(_("Something went wrong while trying to create "
"the Stoq database"))
return
self.label.set_text("")
self.wizard.load_config_and_call_setup()
create_default_profile_settings()
self.progressbar.set_text(_("Done."))
self.progressbar.set_fraction(1.0)
self.wizard.enable_next()
self.done_label.set_markup(
_("Installation successful, click <b>Forward</b> to continue."))
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:35,代码来源:config.py
示例8: delete_button_clicked
def delete_button_clicked(self, button):
if not yesno(_("Are you sure you want to remove the attachment?"),
gtk.RESPONSE_NO, _("Remove"), _("Don't remove")):
return
self.attachment.blob = None
self._update_widget()
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:7,代码来源:fields.py
示例9: _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
示例10: _send_selected_items_to_supplier
def _send_selected_items_to_supplier(self):
orders = self.results.get_selected_rows()
valid_order_views = [
order for order in orders
if order.status == PurchaseOrder.ORDER_PENDING]
if not valid_order_views:
warning(_("There are no pending orders selected."))
return
msg = stoqlib_ngettext(
_("The selected order will be marked as sent."),
_("The %d selected orders will be marked as sent.")
% len(valid_order_views),
len(valid_order_views))
confirm_label = stoqlib_ngettext(_("Confirm order"),
_("Confirm orders"),
len(valid_order_views))
if not yesno(msg, gtk.RESPONSE_YES, confirm_label, _("Don't confirm")):
return
with api.new_store() as store:
for order_view in valid_order_views:
order = store.fetch(order_view.purchase)
order.confirm()
self.refresh()
self.select_result(orders)
开发者ID:amaurihamasu,项目名称:stoq,代码行数:27,代码来源:purchase.py
示例11: _clear
def _clear(self):
objs = self.get_selection()
qty = len(objs)
if qty < 1:
raise SelectionError('There are no objects selected')
msg = stoqlib_ngettext(
_('Delete this item?'),
_('Delete these %d items?') % qty,
qty)
delete_label = stoqlib_ngettext(
_("Delete item"),
_("Delete items"),
qty)
keep_label = stoqlib_ngettext(
_("Keep it"),
_("Keep them"),
qty)
if not yesno(msg, gtk.RESPONSE_NO, delete_label, keep_label):
return
self.emit('before-delete-items', objs)
if qty == len(self.klist):
self.klist.clear()
else:
for obj in objs:
self.klist.remove(obj)
self.klist.unselect_all()
self._update_sensitivity()
self.emit('after-delete-items')
开发者ID:igorferreira,项目名称:stoq,代码行数:30,代码来源:lists.py
示例12: 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
示例13: finish
def finish(self):
for payment in self.model.group.payments:
if payment.is_preview():
# Set payments created on SaleReturnPaymentStep as pending
payment.set_pending()
SaleReturnWizardFinishEvent.emit(self.model)
total_amount = self.model.total_amount
# If the user chose to create credit for the client instead of returning
# money, there is no need to display this messages.
if not self.credit:
if total_amount == 0:
info(_("The client does not have a debt to this sale anymore. "
"Any existing unpaid installment will be cancelled."))
elif total_amount < 0:
info(_("A reversal payment to the client will be created. "
"You can see it on the Payable Application."))
self.model.return_(method_name=u'credit' if self.credit else u'money')
self.retval = self.model
self.close()
if self.credit:
if yesno(_(u'Would you like to print the credit letter?'),
gtk.RESPONSE_YES, _(u"Print Letter"), _(u"Don't print")):
print_report(ClientCreditReport, self.model.client)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:27,代码来源:salereturnwizard.py
示例14: _register_branch_station
def _register_branch_station(caller_store, station_name):
import gtk
from stoqlib.lib.parameters import sysparam
if not sysparam.get_bool('DEMO_MODE'):
fmt = _(u"The computer '%s' is not registered to the Stoq "
u"server at %s.\n\n"
u"Do you want to register it "
u"(requires administrator access) ?")
if not yesno(fmt % (station_name,
db_settings.address),
gtk.RESPONSE_YES, _(u"Register computer"), _(u"Quit")):
raise SystemExit
from stoqlib.gui.utils.login import LoginHelper
h = LoginHelper(username="admin")
try:
user = h.validate_user()
except LoginError as e:
error(str(e))
if not user:
error(_("Must login as 'admin'"))
from stoqlib.domain.station import BranchStation
with new_store() as store:
branch = sysparam.get_object(store, 'MAIN_COMPANY')
station = BranchStation.create(store, branch=branch, name=station_name)
return caller_store.fetch(station)
开发者ID:relsi,项目名称:stoq,代码行数:29,代码来源:runtime.py
示例15: 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
示例16: on_cancel
def on_cancel(self):
if self._storables:
msg = _('Save data before close the dialog ?')
if yesno(msg, gtk.RESPONSE_NO, _("Save data"), _("Don't save")):
self._add_initial_stock()
# change retval to True so the store gets commited
self.retval = True
开发者ID:marianaanselmo,项目名称:stoq,代码行数:7,代码来源:initialstockdialog.py
示例17: remove_item
def remove_item(self, item):
msg = _('Removing this device will also remove all related costs.')
remove = yesno(msg, gtk.RESPONSE_NO, _('Remove'), _("Keep device"))
if remove:
self.remove_list_item(item)
self._delete_model(item)
return False
开发者ID:LeonamSilva,项目名称:stoq,代码行数:7,代码来源:paymentmethodeditor.py
示例18: close
def close(self, sale, store):
# XXX: Remove this when bug #2827 is fixed.
if not self._item_ids:
return True
if self.coupon_closed:
return True
log.info('Closing coupon')
while True:
try:
coupon_id = self.emit('close', sale)
sale.coupon_id = coupon_id
self.coupon_closed = True
return True
except (DeviceError, DriverError) as details:
log.info("It is not possible to close the coupon: %s"
% str(details))
if not yesno(_(u"An error occurred while trying to print. "
u"Would you like to try again?"),
gtk.RESPONSE_YES,
_("Try again"), _(u"Don't try again")):
CancelPendingPaymentsEvent.emit()
return False
_flush_interface()
开发者ID:igorferreira,项目名称:stoq,代码行数:25,代码来源:fiscalprinter.py
示例19: close_till
def close_till(self, close_db=True, close_ecf=True):
"""Closes the till
There are 3 possibilities for parameters combination:
* *total close*: Both *close_db* and *close_ecf* are ``True``.
The till on both will be closed.
* *partial close*: Both *close_db* and *close_ecf* are ``False``.
It's more like a till verification. The actual user will do it
to check and maybe remove money from till, leaving it ready
for the next one. Note that this will not emit
'till-status-changed' event, since the till will not
really close.
* *fix conflicting status*: *close_db* and *close_ecf* are
different. Use this only if you need to fix a conflicting
status, like if the DB is open but the ECF is closed, or
the other way around.
:param close_db: If the till in the DB should be closed
:param close_ecf: If the till in the ECF should be closed
:returns: True if the till was closed, otherwise False
"""
is_partial = not close_db and not close_ecf
manager = get_plugin_manager()
# This behavior is only because of ECF
if not is_partial and not self._previous_day:
if (manager.is_active('ecf') and
not yesno(_("You can only close the till once per day. "
"You won't be able to make any more sales today.\n\n"
"Close the till?"),
Gtk.ResponseType.NO, _("Close Till"), _("Not now"))):
return
elif not is_partial:
# When closing from a previous day, close only what is needed.
close_db = self._close_db
close_ecf = self._close_ecf
if close_db:
till = Till.get_last_opened(self.store)
assert till
store = api.new_store()
editor_class = TillVerifyEditor if is_partial else TillClosingEditor
model = run_dialog(editor_class, self._parent, store,
previous_day=self._previous_day, close_db=close_db,
close_ecf=close_ecf)
if not model:
store.confirm(model)
store.close()
return
# TillClosingEditor closes the till
retval = store.confirm(model)
store.close()
if retval and not is_partial:
self._till_status_changed(closed=True, blocked=False)
return retval
开发者ID:hackedbellini,项目名称:stoq,代码行数:59,代码来源:fiscalprinter.py
示例20: on_receive_button__clicked
def on_receive_button__clicked(self, event):
if yesno(_(u'Receive pending returned sale?'), gtk.RESPONSE_NO,
_(u'Receive'), _(u"Don't receive")):
current_user = api.get_current_user(self.store)
self.model.returned_sale.confirm(current_user)
SaleReturnWizardFinishEvent.emit(self.model.returned_sale)
self.store.commit(close=False)
self._setup_status()
开发者ID:amaurihamasu,项目名称:stoq,代码行数:8,代码来源:returnedsaledialog.py
注:本文中的stoqlib.lib.message.yesno函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论