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

Python translation.stoqlib_ngettext函数代码示例

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

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



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

示例1: _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


示例2: _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


示例3: get_summary_row

    def get_summary_row(self):
        total_sales = len(self._sales)
        if self._total_amount > 0:
            total_percentage = self._total_value * 100 / self._total_payment
            average_sale = self._total_amount / total_sales
        else:
            total_percentage = 0
            average_sale = 0

        sales_label = stoqlib_ngettext('%d sale', '%d sales',
                                       total_sales) % total_sales
        # TODO: Create a better way to add more lines to the summary row
        total_sales_label = get_formatted_price(self._total_amount)
        if self._sales_person:
            total_sales_label += ' (' + _("%s/sale") % (
                get_formatted_price(average_sale, )) + ')'

        summary_row = [sales_label,
                       total_sales_label,
                       get_formatted_price(self._total_payment),
                       get_formatted_percentage(total_percentage),
                       get_formatted_price(self._total_value),
                       format_quantity(self._total_sold)]
        if not self._sales_person:
            summary_row.insert(1, '')
        return summary_row
开发者ID:relsi,项目名称:stoq,代码行数:26,代码来源:sale.py


示例4: _check_client_birthdays

    def _check_client_birthdays(self):
        if not api.sysparam.get_bool('BIRTHDAY_NOTIFICATION'):
            return

        # Display the info bar once per day
        date = api.user_settings.get('last-birthday-check')
        last_check = date and datetime.datetime.strptime(date, '%Y-%m-%d').date()
        if last_check and last_check >= datetime.date.today():
            return

        # Only display the infobar if the user has access to calendar (because
        # clicking on the button will open it) and to sales (because it
        # requires that permission to be able to check client details)
        user = api.get_current_user(self.store)
        if not all([user.profile.check_app_permission(u'calendar'),
                    user.profile.check_app_permission(u'sales')]):
            return

        branch = api.get_current_branch(self.store)
        clients_count = ClientWithSalesView.find_by_birth_date(
            self.store, datetime.datetime.today(), branch=branch).count()

        if clients_count:
            msg = stoqlib_ngettext(
                _("There is %s client doing birthday today!"),
                _("There are %s clients doing birthday today!"),
                clients_count) % (clients_count, )
            button = gtk.Button(_("Check the calendar"))
            button.connect('clicked', self._on_check_calendar__clicked)

            self._birthdays_bar = self.add_info_bar(
                gtk.MESSAGE_INFO,
                "<b>%s</b>" % (glib.markup_escape_text(msg), ),
                action_widget=button)
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:34,代码来源:shellwindow.py


示例5: _cancel_order

 def _cancel_order(self):
     order_views = self.results.get_selected_rows()
     assert all(ov.purchase.can_cancel() for ov in order_views)
     cancel_label = stoqlib_ngettext(_("Cancel order"),
                                     _("Cancel orders"), len(order_views))
     select_label = stoqlib_ngettext(_('The selected order will be cancelled.'),
                                     _('The selected orders will be cancelled.'),
                                     len(order_views))
     if not yesno(select_label, gtk.RESPONSE_YES,
                  cancel_label, _("Don't cancel")):
         return
     with api.new_store() as store:
         for order_view in order_views:
             order = store.fetch(order_view.purchase)
             order.cancel()
     self._update_totals()
     self.refresh()
     self.select_result(order_views)
开发者ID:amaurihamasu,项目名称:stoq,代码行数:18,代码来源:purchase.py


示例6: _create_pending_returned_sale_message

    def _create_pending_returned_sale_message(self):
        branch = api.get_current_branch(self.store)
        n_returned = ReturnedSale.get_pending_returned_sales(self.store, branch).count()

        if not n_returned:
            return None

        msg = stoqlib_ngettext(_(u"You have %s returned sale to receive"),
                               _(u"You have %s returned sales to receive"),
                               n_returned) % n_returned
        info_returned_bar = self.window.add_info_bar(gtk.MESSAGE_QUESTION, msg)
        button = info_returned_bar.add_button(_(u"Returned sale"), gtk.RESPONSE_OK)
        button.connect('clicked', self._on_info_returned_sales__clicked)

        return info_returned_bar
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:15,代码来源:stock.py


示例7: _create_pending_info_message

    def _create_pending_info_message(self):
        branch = api.get_current_branch(self.store)
        n_transfers = TransferOrder.get_pending_transfers(self.store, branch).count()

        if not n_transfers:
            return None

        msg = stoqlib_ngettext(_(u"You have %s incoming transfer"),
                               _(u"You have %s incoming transfers"),
                               n_transfers) % n_transfers
        info_bar = self.window.add_info_bar(gtk.MESSAGE_QUESTION, msg)
        button = info_bar.add_button(_(u"Receive"), gtk.RESPONSE_OK)
        button.connect('clicked', self._on_info_transfers__clicked)

        return info_bar
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:15,代码来源:stock.py


示例8: _search_transfers

    def _search_transfers(self):
        branch = api.get_current_branch(self.store)
        self.run_dialog(TransferOrderSearch, self.store)

        if self.transfers_bar:
            n_transfers = TransferOrder.get_pending_transfers(self.store, branch).count()

            if n_transfers > 0:
                msg = stoqlib_ngettext(_(u"You have %s incoming transfer"),
                                       _(u"You have %s incoming transfers"),
                                       n_transfers) % n_transfers
                self.transfers_bar.set_message(msg)
            else:
                self.transfers_bar.hide()
        self.refresh()
开发者ID:igorferreira,项目名称:stoq,代码行数:15,代码来源:stock.py


示例9: _search_pending_returned_sales

    def _search_pending_returned_sales(self):
        with api.new_store() as store:
            self.run_dialog(PendingReturnedSaleSearch, store)

        branch = api.get_current_branch(self.store)
        # After the search is closed we may want to update , or even hide the
        # message, if there is no pending returned sale to receive
        if self.returned_bar:
            n_returned = ReturnedSale.get_pending_returned_sales(self.store, branch).count()

            if n_returned > 0:
                msg = stoqlib_ngettext(_(u"You have %s returned sale to receive"),
                                       _(u"You have %s returned sales to receive"),
                                       n_returned) % n_returned
                self.returned_bar.set_message(msg)
            else:
                self.returned_bar.hide()
        self.refresh()
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:18,代码来源:stock.py


示例10: _setup_details

    def _setup_details(self):
        """ This method build the report title based on the arguments sent
        by SearchBar to its class constructor.
        """
        rows = len(self.data)
        total_rows = rows + self.blocked_records
        item = stoqlib_ngettext(self.main_object_name[0], self.main_object_name[1], total_rows)
        self.subtitle = self.subtitle_template.format(rows=rows, total_rows=total_rows, item=item)

        base_note = ""
        if self.filter_format_string and self.status_name:
            base_note += self.filter_format_string % self.status_name.lower()

        notes = []
        for filter_string in self.filter_strings:
            if base_note:
                notes.append("%s %s" % (base_note, filter_string))
            elif filter_string:
                notes.append(filter_string)
        self.notes = notes
开发者ID:stoq,项目名称:stoq,代码行数:20,代码来源:report.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python webservice.WebService类代码示例发布时间:2022-05-27
下一篇:
Python translation.locale_sorted函数代码示例发布时间: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