• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python sysparam.get_int函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中stoqlib.lib.parameters.sysparam.get_int函数的典型用法代码示例。如果您正苦于以下问题:Python get_int函数的具体用法?Python get_int怎么用?Python get_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_int函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _get_parameter_value

    def _get_parameter_value(self, obj):
        """Given a ParameterData object, returns a string representation of
        its current value.
        """
        detail = sysparam.get_detail_by_name(obj.field_name)
        if detail.type == unicode:
            data = sysparam.get_string(obj.field_name)
        elif detail.type == bool:
            data = sysparam.get_bool(obj.field_name)
        elif detail.type == int:
            data = sysparam.get_int(obj.field_name)
        elif detail.type == decimal.Decimal:
            data = sysparam.get_decimal(obj.field_name)
        elif isinstance(detail.type, basestring):
            data = sysparam.get_object(self.store, obj.field_name)
        else:
            raise NotImplementedError(detail.type)

        if isinstance(data, Domain):
            if not (IDescribable in providedBy(data)):
                raise TypeError(u"Parameter `%s' must implement IDescribable "
                                "interface." % obj.field_name)
            return data.get_description()
        elif detail.options:
            return detail.options[int(obj.field_value)]
        elif isinstance(data, bool):
            return [_(u"No"), _(u"Yes")][data]
        elif obj.field_name == u'COUNTRY_SUGGESTED':
            return dgettext("iso_3166", data)
        elif isinstance(data, unicode):
            # FIXME: workaround to handle locale specific data
            return _(data)
        return unicode(data)
开发者ID:pkaislan,项目名称:stoq,代码行数:33,代码来源:parametersearch.py


示例2: _setup_widgets

    def _setup_widgets(self):
        self._update_product_labels_visibility(False)
        cost_digits = sysparam.get_int("COST_PRECISION_DIGITS")
        self.quantity.set_sensitive(False)
        # 10 for the length of MAX_INT, 3 for the precision and 1 for comma
        self.quantity.set_max_length(14)
        self.cost.set_sensitive(False)
        # 10 for the length of MAX_INT and 1 for comma
        self.cost.set_max_length(10 + cost_digits + 1)
        self.add_sellable_button.set_sensitive(False)
        self.unit_label.set_bold(True)

        for widget in [self.quantity, self.cost]:
            widget.set_adjustment(gtk.Adjustment(lower=0, upper=MAX_INT, step_incr=1))

        self._reset_sellable()
        self._setup_summary()
        self.cost.set_digits(cost_digits)
        self.quantity.set_digits(3)

        self.barcode.grab_focus()
        self.item_table.set_focus_chain(
            [self.barcode, self.quantity, self.cost, self.add_sellable_button, self.product_button]
        )
        self.register_validate_function(self.validate)
开发者ID:amaurihamasu,项目名称:stoq,代码行数:25,代码来源:abstractwizard.py


示例3: setup_widgets

    def setup_widgets(self):
        marker('Setting up widgets')
        # Only quotes have expire date.
        self.expire_date.hide()
        self.expire_label.hide()

        # Hide client category widgets
        self.client_category_lbl.hide()
        self.client_category.hide()

        # if the NF-e plugin is active, the client is mandantory in this
        # wizard (in this situation, we have only quote sales).
        if self.model.status == Sale.STATUS_QUOTE:
            manager = get_plugin_manager()
            mandatory_client = manager.is_active('nfe')
            self.client.set_property('mandatory', mandatory_client)

        marker('Filling sales persons')
        salespersons = self.store.find(SalesPerson)
        self.salesperson.prefill(api.for_person_combo(salespersons))
        marker('Finished filling sales persons')

        marker('Read parameter')
        change_salesperson = sysparam.get_int('ACCEPT_CHANGE_SALESPERSON')
        if change_salesperson == ChangeSalespersonPolicy.ALLOW:
            self.salesperson.grab_focus()
        elif change_salesperson == ChangeSalespersonPolicy.DISALLOW:
            self.salesperson.set_sensitive(False)
        elif change_salesperson == ChangeSalespersonPolicy.FORCE_CHOOSE:
            self.model.salesperson = None
            self.salesperson.grab_focus()
        else:
            raise AssertionError
        marker('Finished reading parameter')
        self._setup_clients_widget()
        self._fill_transporter_combo()
        self._fill_cost_center_combo()

        if sysparam.get_bool('ASK_SALES_CFOP'):
            self._fill_cfop_combo()
        else:
            self.cfop_lbl.hide()
            self.cfop.hide()
            self.create_cfop.hide()

        # the maximum number allowed for an invoice is 999999999.
        self.invoice_number.set_adjustment(
            gtk.Adjustment(lower=1, upper=999999999, step_incr=1))

        if not self.model.invoice_number:
            new_invoice_number = Invoice.get_next_invoice_number(self.store)
            self.invoice_model.invoice_number = new_invoice_number
        else:
            new_invoice_number = self.model.invoice_number
            self.invoice_model.invoice_number = new_invoice_number
            self.invoice_number.set_sensitive(False)

        self.invoice_model.original_invoice = new_invoice_number
        marker('Finished setting up widgets')
开发者ID:Farrapo,项目名称:stoq,代码行数:59,代码来源:salewizard.py


示例4: setup_widgets

    def setup_widgets(self):
        self.cost.set_digits(sysparam.get_int('COST_PRECISION_DIGITS'))
        self.consignment_yes_button.set_active(self.model.consignment)
        self.consignment_yes_button.set_sensitive(self._model_created)
        self.consignment_no_button.set_sensitive(self._model_created)
        self.manage_stock.set_sensitive(self._model_created)

        self.description.grab_focus()
开发者ID:pkaislan,项目名称:stoq,代码行数:8,代码来源:producteditor.py


示例5: _setup_widgets

 def _setup_widgets(self):
     self.order.set_text(unicode(self.model.order.identifier))
     for widget in [self.quantity, self.cost, self.quantity_sold,
                    self.quantity_returned]:
         widget.set_adjustment(gtk.Adjustment(lower=0, upper=MAX_INT,
                                              step_incr=1))
     self.description.set_text(self.model.sellable.get_description())
     self.cost.set_digits(sysparam.get_int('COST_PRECISION_DIGITS'))
开发者ID:Joaldino,项目名称:stoq,代码行数:8,代码来源:purchaseeditor.py


示例6: _maybe_schedule_idle_logout

 def _maybe_schedule_idle_logout(self):
     # Verify if the user will use automatic logout.
     from stoqlib.lib.parameters import sysparam
     minutes = sysparam.get_int('AUTOMATIC_LOGOUT')
     # If user defined 0 minutes, ignore automatic logout.
     if minutes != 0:
         seconds = minutes * 60
         GLib.timeout_add_seconds(5, self._verify_idle_logout, seconds)
开发者ID:hackedbellini,项目名称:stoq,代码行数:8,代码来源:shell.py


示例7: _setup_widgets

 def _setup_widgets(self):
     unit = self.model.product.sellable.unit
     if unit is None:
         description = _(u"Unit(s)")
     else:
         description = unit.description
     self.unit_label.set_text(description)
     self.base_cost.set_digits(sysparam.get_int("COST_PRECISION_DIGITS"))
     self.base_cost.set_adjustment(gtk.Adjustment(lower=0, upper=MAX_INT, step_incr=1))
     self.minimum_purchase.set_adjustment(gtk.Adjustment(lower=0, upper=MAX_INT, step_incr=1))
开发者ID:stoq,项目名称:stoq,代码行数:10,代码来源:producteditor.py


示例8: setup_proxies

    def setup_proxies(self):
        self._setup_widgets()
        self.proxy = self.add_proxy(self.model,
                                    StartSaleQuoteStep.proxy_widgets)
        if sysparam.get_bool('ASK_SALES_CFOP'):
            self.add_proxy(self.model, StartSaleQuoteStep.cfop_widgets)

        expire_delta = sysparam.get_int('EXPIRATION_SALE_QUOTE_DATE')
        if expire_delta > 0 and not self.model.expire_date:
            # Only set the expire date if id doesn't already have one.
            self.expire_date.update(localtoday() +
                                    relativedelta(days=expire_delta))
开发者ID:Joaldino,项目名称:stoq,代码行数:12,代码来源:salequotewizard.py


示例9: on_barcode__validate

    def on_barcode__validate(self, widget, value):
        if not value:
            return

        max_barcode = sysparam.get_int('BARCODE_MAX_SIZE')
        if value and len(value) > max_barcode:
            return ValidationError(_(u'Barcode must have %s digits or less.') %
                                   max_barcode)
        if self.model.sellable.check_barcode_exists(value):
            return ValidationError(_('The barcode %s already exists') % value)
        if self._demo_mode and value not in _DEMO_BAR_CODES:
            return ValidationError(_("Cannot create new barcodes in "
                                     "demonstration mode"))
开发者ID:hackedbellini,项目名称:stoq,代码行数:13,代码来源:sellableeditor.py


示例10: get_query_executer

    def get_query_executer(self):
        """
        Fetchs the QueryExecuter for the SearchContainer

        :returns: a querty executer
        :rtype: a :class:`QueryExecuter` subclass
        """
        if self._query_executer is None:
            executer = QueryExecuter(self.store)
            if not self._lazy_search:
                executer.set_limit(sysparam.get_int('MAX_SEARCH_RESULTS'))
            if self._search_spec is not None:
                executer.set_search_spec(self._search_spec)
            self._query_executer = executer
        return self._query_executer
开发者ID:Guillon88,项目名称:stoq,代码行数:15,代码来源:searchslave.py


示例11: _setup_widgets

    def _setup_widgets(self):
        self.order.set_text(str(self.model.order.identifier))
        for widget in [self.quantity, self.cost, self.quantity_sold,
                       self.quantity_returned]:
            widget.set_adjustment(Gtk.Adjustment(lower=0, upper=MAX_INT,
                                                 step_increment=1))

        unit = self.model.sellable.unit
        digits = QUANTITY_PRECISION if unit and unit.allow_fraction else 0
        for widget in [self.quantity,
                       self.quantity_sold,
                       self.quantity_returned]:
            widget.set_digits(digits)

        self.description.set_text(self.model.sellable.get_description())
        self.cost.set_digits(sysparam.get_int('COST_PRECISION_DIGITS'))
开发者ID:hackedbellini,项目名称:stoq,代码行数:16,代码来源:purchaseeditor.py


示例12: needs_closing

    def needs_closing(self):
        """Checks if there's an open till that needs to be closed before
        we can do any further fiscal operations.
        :returns: True if it needs to be closed, otherwise false
        """
        if self.status != Till.STATUS_OPEN:
            return False

        # Verify that the till wasn't opened today
        if self.opening_date.date() == localtoday().date():
            return False

        if localnow().hour < sysparam.get_int('TILL_TOLERANCE_FOR_CLOSING'):
            return False

        return True
开发者ID:hackedbellini,项目名称:stoq,代码行数:16,代码来源:till.py


示例13: has_late_payments

    def has_late_payments(cls, store, person):
        """Checks if the provided person has unpaid payments that are overdue

        :param person: A :class:`person <stoqlib.domain.person.Person>` to
          check if has late payments
        :returns: True if the person has overdue payments. False otherwise
        """
        tolerance = sysparam.get_int('TOLERANCE_FOR_LATE_PAYMENTS')

        query = And(
            cls.person_id == person.id,
            cls.status == Payment.STATUS_PENDING,
            cls.due_date < localtoday() - relativedelta(days=tolerance))

        late_payments = store.find(cls, query)
        if late_payments.any():
            return True

        return False
开发者ID:dionimf,项目名称:stoq,代码行数:19,代码来源:views.py


示例14: sysparam

 def sysparam(self, **kwargs):
     """
     Updates a set of system parameters within a context.
     The values will be reverted when leaving the scope.
     kwargs contains a dictionary of parameter name->value
     """
     from stoqlib.lib.parameters import sysparam
     old_values = {}
     for param, value in kwargs.items():
         if isinstance(value, bool):
             old_values[param] = sysparam.get_bool(param)
             sysparam.set_bool(self.store, param, value)
         elif isinstance(value, int):
             old_values[param] = sysparam.get_int(param)
             sysparam.set_int(self.store, param, value)
         elif isinstance(value, Domain) or value is None:
             old_values[param] = sysparam.get_object(self.store, param)
             sysparam.set_object(self.store, param, value)
         elif isinstance(value, str):
             old_values[param] = sysparam.get_string(param)
             sysparam.set_string(self.store, param, value)
         elif isinstance(value, Decimal):
             old_values[param] = sysparam.get_decimal(param)
             sysparam.set_decimal(self.store, param, value)
         else:
             raise NotImplementedError(type(value))
     try:
         yield
     finally:
         for param, value in old_values.items():
             if isinstance(value, bool):
                 sysparam.set_bool(self.store, param, value)
             elif isinstance(value, int):
                 sysparam.set_int(self.store, param, value)
             elif isinstance(value, Domain) or value is None:
                 sysparam.set_object(self.store, param, value)
             elif isinstance(value, str):
                 sysparam.set_string(self.store, param, value)
             elif isinstance(value, Decimal):
                 sysparam.set_decimal(self.store, param, value)
             else:
                 raise NotImplementedError(type(value))
开发者ID:hackedbellini,项目名称:stoq,代码行数:42,代码来源:domaintest.py


示例15: _update_change

    def _update_change(self):
        # XXX: The 'validate' signal was not emitted when there's no
        # proxy attaching widget/model. By calling the validate method
        # works as shortcut to emit the signal properly:
        value = self.received_value.validate(force=True)
        if value is ValueUnset:
            value = '0.0'

        sale_amount = (self.wizard.get_total_amount() -
                       self.wizard.get_total_paid())
        change_value = currency(value) - sale_amount
        self.change_value_lbl.set_text(get_formatted_price(change_value))

        # There is some change for the clientchange, but we cannot edit the
        # received value. This means that the client has already paid more than
        # the total sale amount.
        if change_value > 0 and not self.received_value.get_sensitive():
            self.credit_checkbutton.set_visible(True)
            policy = sysparam.get_int('RETURN_POLICY_ON_SALES')
            self.credit_checkbutton.set_sensitive(policy == ReturnPolicy.CLIENT_CHOICE)
            self.credit_checkbutton.set_active(policy == ReturnPolicy.RETURN_CREDIT)
        else:
            self.credit_checkbutton.set_visible(False)
开发者ID:Guillon88,项目名称:stoq,代码行数:23,代码来源:cashchangeslave.py


示例16: has_late_payments

    def has_late_payments(cls, store, person):
        """Checks if the provided person has unpaid payments that are overdue

        :param person: A :class:`person <stoqlib.domain.person.Person>` to
          check if has late payments
        :returns: True if the person has overdue payments. False otherwise
        """
        tolerance = sysparam.get_int('TOLERANCE_FOR_LATE_PAYMENTS')

        query = And(
            cls.person_id == person.id,
            cls.status == Payment.STATUS_PENDING,
            cls.due_date < localtoday() - relativedelta(days=tolerance))

        for late_payments in store.find(cls, query):
            sale = late_payments.sale
            # Exclude payments for external sales as they are handled by an
            # external entity (e.g. a payment gateway) meaning that they be
            # out of sync with the Stoq database.
            if not sale or not sale.is_external():
                return True

        return False
开发者ID:hackedbellini,项目名称:stoq,代码行数:23,代码来源:views.py


示例17: setup_widgets

 def setup_widgets(self):
     self.cost.set_digits(sysparam.get_int('COST_PRECISION_DIGITS'))
     self.description.grab_focus()
开发者ID:Guillon88,项目名称:stoq,代码行数:3,代码来源:producteditor.py


示例18: get_formatted_cost

def get_formatted_cost(float_value, symbol=True):
    from stoqlib.lib.parameters import sysparam
    precision = sysparam.get_int('COST_PRECISION_DIGITS')
    return get_formatted_price(float_value, symbol=symbol,
                               precision=precision)
开发者ID:hackedbellini,项目名称:stoq,代码行数:5,代码来源:formatters.py



注:本文中的stoqlib.lib.parameters.sysparam.get_int函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sysparam.get_object函数代码示例发布时间:2022-05-27
下一篇:
Python sysparam.get_bool函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap