本文整理汇总了Python中stoqlib.gui.base.wizards.BaseWizard类的典型用法代码示例。如果您正苦于以下问题:Python BaseWizard类的具体用法?Python BaseWizard怎么用?Python BaseWizard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseWizard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, store, model):
self.temporary_items = {}
self.imported_count = {}
self.manual_count = True
first_step = InventoryCountTypeStep(store, self, previous=None)
BaseWizard.__init__(self, store, first_step, model)
示例2: __init__
def __init__(self, store, model=None):
model = model or self._create_model(store)
# If we receive the order right after the purchase.
self.receiving_model = None
first_step = StartConsignmentStep(self, store, model)
BaseWizard.__init__(self, store, first_step, model)
示例3: __init__
def __init__(self, options, config=None):
if not config:
config = StoqConfig()
self.settings = config.get_settings()
self.link_request_done = False
self.create_examples = False
self.config = config
self.enable_production = False
self.has_installed_db = False
self.options = options
self.plugins = []
self.db_is_local = False
self.enable_online_services = True
self.auth_type = TRUST_AUTHENTICATION
if config.get('Database', 'enable_production') == 'True':
self.enable_production = True
if self.enable_production:
first_step = PluginStep(self)
else:
first_step = WelcomeStep(self)
BaseWizard.__init__(self, None, first_step, title=self.title)
self.get_toplevel().set_deletable(False)
self.next_button.grab_focus()
示例4: __init__
def __init__(self, store):
self.model = None
self.sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
self.current_branch = api.get_current_branch(store)
first_step = ReceivingSelectionStep(self, store)
BaseWizard.__init__(self, store, first_step, self.model)
self.next_button.set_sensitive(False)
示例5: __init__
def __init__(self, store, model):
self.temporary_items = {}
self.imported_count = {}
self.manual_count = True
self.can_count_twice = api.sysparam.get_bool('ALLOW_SAME_SELLABLE_IN_A_ROW')
first_step = InventoryCountTypeStep(store, self, previous=None)
BaseWizard.__init__(self, store, first_step, model)
示例6: __init__
def __init__(self, store, role_editor):
if not issubclass(role_editor, BasePersonRoleEditor):
raise TypeError("Editor %s must be BasePersonRoleEditor " "instance" % role_editor)
self.role_editor = role_editor
BaseWizard.__init__(self, store, PersonRoleTypeStep(self, store), title=self.get_role_title())
if role_editor.help_section:
self.set_help_section(role_editor.help_section)
示例7: __init__
def __init__(self, store, purchase):
self.purchase = purchase
model = self._create_model(purchase)
if self.purchase.status != PurchaseOrder.ORDER_CONFIRMED:
raise ValueError("Invalid order status. It should " "be ORDER_CONFIRMED")
first_step = PurchaseFinishProductListStep(store, self, model)
BaseWizard.__init__(self, store, first_step, model)
示例8: __init__
def __init__(self, store, receiving_order=None):
self.receiving_order = receiving_order
if self.receiving_order is not None:
self.title = _('Receiving Order Return')
model = self._create_model(store)
first_step = StartStockDecreaseStep(store, self, model)
BaseWizard.__init__(self, store, first_step, model)
self.create_payments = False
示例9: __init__
def __init__(self, store, model=None):
title = self._get_title(model)
model = model or self._create_model(store)
if model.status != Sale.STATUS_QUOTE:
raise ValueError('Invalid sale status. It should '
'be STATUS_QUOTE')
first_step = StartSaleQuoteStep(store, self, model)
BaseWizard.__init__(self, store, first_step, model, title=title,
edit_mode=False)
示例10: __init__
def __init__(self, store, model=None):
title = self._get_title(model)
self.edit = model is not None
self.quote = None
self.quote_group = self._get_or_create_quote_group(model, store)
model = model or self._create_model(store)
if model.status != PurchaseOrder.ORDER_QUOTING:
raise ValueError('Invalid order status. It should '
'be ORDER_QUOTING')
first_step = StartQuoteStep(self, None, store, model)
BaseWizard.__init__(self, store, first_step, model, title=title)
示例11: __init__
def __init__(self, store, model=None):
self.unkown_sale = False
if model:
# Adjust items befre creating the step, so that plugins may have a
# chance to change the value
for item in model.returned_items:
_adjust_returned_sale_item(item)
first_step = SaleReturnItemsStep(self, None, store, model)
else:
first_step = SaleReturnSelectionStep(store, self, None)
BaseWizard.__init__(self, store, first_step, model)
示例12: __init__
def __init__(self, store, role_editor, document=None):
if not issubclass(role_editor, BasePersonRoleEditor):
raise TypeError('Editor %s must be BasePersonRoleEditor '
'instance' % role_editor)
self.role_editor = role_editor
self._document = document
BaseWizard.__init__(self, store,
self.get_first_step(store),
title=self.get_role_title())
if role_editor.help_section:
self.set_help_section(role_editor.help_section)
示例13: __init__
def __init__(self, store, purchase):
sync_mode = api.sysparam.get_bool("SYNCHRONIZED_MODE")
# When in sync mode, only the branch owner can finish a purchase order.
if sync_mode:
assert purchase.branch == api.get_current_branch(store)
self.purchase = purchase
model = self._create_model(purchase)
if self.purchase.status != PurchaseOrder.ORDER_CONFIRMED:
raise ValueError("Invalid order status. It should " "be ORDER_CONFIRMED")
first_step = PurchaseFinishProductListStep(store, self, model)
BaseWizard.__init__(self, store, first_step, model)
示例14: __init__
def __init__(self, store, model=None, edit_mode=False):
title = self._get_title(model)
model = model or self._create_model(store)
# Should we show all products or only the ones associated with the
# selected supplier?
self.all_products = False
# If we receive the order right after the purchase.
self.receiving_model = None
if model.status != PurchaseOrder.ORDER_PENDING:
raise ValueError('Invalid order status. It should '
'be ORDER_PENDING')
first_step = StartPurchaseStep(self, store, model)
BaseWizard.__init__(self, store, first_step, model, title=title,
edit_mode=edit_mode)
示例15: test_cancel_confirmation_close
def test_cancel_confirmation_close(self, yesno):
step = _FakeStep(self.store, None)
wizard = BaseWizard(self.store, step, title="Fake")
# need_cancel_confirmation is False, cancel should close the wizard
with mock.patch.object(wizard, 'close') as close:
wizard.cancel()
self.assertEquals(yesno.call_count, 0)
close.assert_called_once()
wizard.need_cancel_confirmation = True
# need_cancel_confirmation is True but there're no changes. Cancel
# should still close the dialog
with mock.patch.object(wizard, 'close') as close:
wizard.cancel()
self.assertEquals(yesno.call_count, 0)
close.assert_called_once()
# Just to make store.get_pending_changes return something greater
# thant the time the wizard was created
self.create_sellable()
yesno.return_value = True
# need_cancel_confirmation is True and there're changes. yesno
# should ask if we can close the wizard or not and since we are
# answering True, it should still close
with mock.patch.object(wizard, 'close') as close:
wizard.cancel()
yesno.assert_called_once_with(
("If you cancel this dialog all changes will be "
"lost. Are you sure?"),
gtk.RESPONSE_NO, "Cancel", "Don't cancel")
close.assert_called_once()
yesno.reset_mock()
yesno.return_value = False
# need_cancel_confirmation is True and there're changes. yesno
# should ask if we can close the wizard or not and since we are
# answering False, it should not close
with mock.patch.object(wizard, 'close') as close:
wizard.cancel()
yesno.assert_called_once_with(
("If you cancel this dialog all changes will be "
"lost. Are you sure?"),
gtk.RESPONSE_NO, "Cancel", "Don't cancel")
self.assertEquals(close.call_count, 0)