本文整理汇总了Python中stoqlib.gui.base.dialogs.run_dialog函数的典型用法代码示例。如果您正苦于以下问题:Python run_dialog函数的具体用法?Python run_dialog怎么用?Python run_dialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_dialog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _show_client_birthdays_by_date
def _show_client_birthdays_by_date(self, date):
from stoqlib.gui.search.personsearch import ClientSearch
with api.new_store() as store:
y, m, d = map(int, date.split('-'))
date = localdate(y, m, d).date()
run_dialog(ClientSearch, self.app, store, birth_date=date)
示例2: _dialog_client
def _dialog_client(self, id):
from stoqlib.domain.person import Client
from stoqlib.gui.dialogs.clientdetails import ClientDetailsDialog
with api.new_store() as store:
model = store.get(Client, id)
run_dialog(ClientDetailsDialog, self.app, store, model)
示例3: _show_details
def _show_details(self, model):
from stoqlib.gui.editors.workordereditor import WorkOrderPackageItemEditor
parent = self.get_toplevel().get_toplevel()
# XXX: The window here is not decorated on gnome-shell, and because of
# the visual_mode it gets no buttons. What to do?
run_dialog(WorkOrderPackageItemEditor, parent, self.store,
model=model.package_item, visual_mode=True)
示例4: finish
def finish(self):
missing = get_missing_items(self.model, self.store)
if missing:
run_dialog(MissingItemsDialog, self, self.model, missing)
return False
order = TransferOrder(
open_date=self.model.open_date,
receival_date=self.model.receival_date,
source_branch=self.model.source_branch,
destination_branch=self.model.destination_branch,
source_responsible=self.model.source_responsible,
destination_responsible=self.model.destination_responsible,
store=self.store)
for item in self.model.get_items():
transfer_item = order.add_sellable(item.sellable,
quantity=item.quantity,
batch=item.batch)
transfer_item.send()
# XXX Waiting for transfer order receiving wizard implementation
order.receive()
self.retval = self.model
self.close()
StockTransferWizardFinishEvent.emit(order)
self._receipt_dialog(order)
示例5: on_credit_transactions_button__clicked
def on_credit_transactions_button__clicked(self, button):
# If we are not in edit mode, we are creating a new object, and thus we
# should reuse the transaction
reuse_store = not self.edit_mode
run_dialog(CreditInfoListDialog, self.get_toplevel().get_toplevel(),
self.store, self.model, reuse_store=reuse_store)
self.proxy.update('credit_account_balance')
示例6: _pay
def _pay(self, payable_views):
"""
Pay a list of items from a payable_views, note that
the list of payable_views must reference the same order
@param payables_views: a list of payable_views
"""
assert self._can_pay(payable_views)
# Do not allow confirming the payment if the purchase was not
# completely received.
purchase_order = payable_views[0].purchase
if (purchase_order and
api.sysparam.get_bool('BLOCK_INCOMPLETE_PURCHASE_PAYMENTS') and
not purchase_order.status == PurchaseOrder.ORDER_CLOSED):
return warning(_("Can't confirm the payment if the purchase "
"is not completely received yet."))
with api.new_store() as store:
payments = [store.fetch(view.payment) for view in payable_views]
run_dialog(PurchasePaymentConfirmSlave, self, store,
payments=payments)
if store.committed:
# We need to refresh the whole list as the payment(s) can possibly
# disappear for the selected view
self.refresh()
self._update_widgets()
示例7: test_dialog
def test_dialog(): # pragma nocover
from stoqlib.gui.base.dialogs import run_dialog
ec = api.prepare_test()
client = ec.store.find(Client).any()
run_dialog(OpticalPatientDetails, None, ec.store, client)
ec.store.commit()
示例8: _edit
def _edit(self, payable_views):
with api.new_store() as store:
order = store.fetch(payable_views[0].purchase)
run_dialog(PurchasePaymentsEditor, self, store, order)
if store.committed:
self.refresh()
示例9: on_details_button__clicked
def on_details_button__clicked(self, *args):
selected = self.search.results.get_selected_rows()[0]
if not selected:
raise ValueError('You should have one order selected '
'at this point, got nothing')
run_dialog(PurchaseDetailsDialog, self.wizard, self.store,
model=selected.purchase)
示例10: on_details_button_clicked
def on_details_button_clicked(self, *args):
# FIXME: Person editor/slaves are depending on the store being a
# StoqlibStore. See bug 5012
with api.trans() as store:
selected = self.results.get_selected()
user = store.fetch(selected.user)
run_dialog(UserEditor, self, store, user, visual_mode=True)
示例11: 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
示例12: on_details_button_clicked
def on_details_button_clicked(self, button):
work_order_view = self.results.get_selected()
if not work_order_view:
return
run_dialog(WorkOrderEditor, self, self.store,
model=work_order_view.work_order, visual_mode=True)
示例13: run_person_role_dialog
def run_person_role_dialog(role_editor, parent, store, model=None,
**editor_kwargs):
if not model:
editor_kwargs.pop('visual_mode', None)
return run_dialog(PersonRoleWizard, parent, store, role_editor,
**editor_kwargs)
return run_dialog(role_editor, parent, store, model, **editor_kwargs)
示例14: test
def test(): # pragma: no cover
from stoqlib.gui.base.dialogs import run_dialog
from stoqlib.api import api
ec = api.prepare_test()
model = ec.store.find(CostCenter).any()
run_dialog(CostCenterDialog, None, ec.store, model)
示例15: search_products
def search_products(self):
with api.new_store() as store:
profile = api.get_current_user(store).profile
can_create = (profile.check_app_permission('admin') or
profile.check_app_permission('purchase'))
run_dialog(ProductSearch, None, store, hide_footer=True, hide_toolbar=not can_create,
hide_cost_column=not can_create)