当前位置: 首页>>代码示例>>Python>>正文


Python i18n._函数代码示例

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


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

示例1: __init__

 def __init__(self):
     RCTManifestCommand.__init__(self, name="cat-manifest", aliases=['cm'],
                            shortdesc=_("Print manifest information"),
                            primary=True)
     self.parser.add_option("--no-content", action="store_true",
                            default=False,
                            help=_("skip printing Content Sets"))
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:manifest_commands.py

示例2: _validate_options

    def _validate_options(self):
        cert_file = self._get_file_from_args()
        if not cert_file:
            raise InvalidCLIOptionError(_("You must specify a certificate file."))

        if not os.path.isfile(cert_file):
            raise InvalidCLIOptionError(_("The specified certificate file does not exist."))
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:cert_commands.py

示例3: get_org

    def get_org(self, username):
        try:
            owner_list = self.cp.getOwnerList(username)
        except Exception as e:
            log.exception(e)
            system_exit(os.EX_SOFTWARE, CONNECTION_FAILURE % e)

        if len(owner_list) == 0:
            system_exit(1, _("%s cannot register with any organizations.") % username)
        else:
            if self.options.org:
                org_input = self.options.org
            elif len(owner_list) == 1:
                org_input = owner_list[0]['key']
            else:
                org_input = six.moves.input(_("Org: ")).strip()
                readline.clear_history()

            org = None
            for owner_data in owner_list:
                if owner_data['key'] == org_input or owner_data['displayName'] == org_input:
                    org = owner_data['key']
                    break
            if not org:
                system_exit(os.EX_DATAERR, _("Couldn't find organization '%s'.") % org_input)
        return org
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:26,代码来源:migrate.py

示例4: _add_group

    def _add_group(self, group):
        tree_iter = None
        if group.name and len(group.entitlements) > 1:
            unique = self.find_unique_name_count(group.entitlements)
            if unique - 1 > 1:
                name_string = _("Stack of %s and %s others") % \
                        (group.name, str(unique - 1))
            elif unique - 1 == 1:
                name_string = _("Stack of %s and 1 other") % (group.name)
            else:
                name_string = _("Stack of %s") % (group.name)
            tree_iter = self.store.add_map(tree_iter, self._create_stacking_header_entry(name_string))

        new_parent_image = None
        for i, cert in enumerate(group.entitlements):
            image = self._get_entry_image(cert)
            self.store.add_map(tree_iter, self._create_entry_map(cert, image))

            # Determine if we need to change the parent's image. We
            # will match the parent's image with the children if any of
            # the children have an image.
            if self.image_ranks_higher(new_parent_image, image):
                new_parent_image = image

        # Update the parent image if required.
        if new_parent_image and tree_iter:
            self.store.set_value(tree_iter, self.store['image'],
                    ga_GdkPixbuf.Pixbuf.new_from_file_at_size(new_parent_image, 13, 13))
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:28,代码来源:mysubstab.py

示例5: _button_clicked

    def _button_clicked(self, button):
        self._calendar_window = ga_Gtk.Window(ga_Gtk.WindowType.TOPLEVEL)
        self._calendar_window.set_type_hint(ga_Gdk.WindowTypeHint.DIALOG)
        self._calendar_window.set_modal(True)
        self._calendar_window.set_title(_("Date Selection"))

        self._calendar.select_month(self._date.month - 1, self._date.year)
        self._calendar.select_day(self._date.day)

        vbox = ga_Gtk.VBox(spacing=3)
        vbox.set_border_width(2)
        vbox.pack_start(self._calendar, True, True, 0)

        button_box = ga_Gtk.HButtonBox()
        button_box.set_layout(ga_Gtk.ButtonBoxStyle.END)
        vbox.pack_start(button_box, True, True, 0)

        button = ga_Gtk.Button(_("Today"))
        button.connect("clicked", self._today_clicked)
        button_box.pack_start(button, True, True, 0)

        frame = ga_Gtk.Frame()
        frame.add(vbox)
        self._calendar_window.add(frame)
        self._calendar_window.set_position(ga_Gtk.WindowPosition.MOUSE)
        self._calendar_window.show_all()

        self._calendar.connect("day-selected-double-click",
                self._calendar_clicked)
开发者ID:Januson,项目名称:subscription-manager,代码行数:29,代码来源:widgets.py

示例6: _validate_options

    def _validate_options(self):
        manifest_file = self._get_file_from_args()
        if not manifest_file:
            raise InvalidCLIOptionError(_("You must specify a manifest file."))

        if not os.path.isfile(manifest_file):
            raise InvalidCLIOptionError(_("The specified manifest file does not exist."))
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:manifest_commands.py

示例7: get_environment

    def get_environment(self, owner_key):
        environment_list = []
        try:
            if self.cp.supports_resource('environments'):
                environment_list = self.cp.getEnvironmentList(owner_key)
            elif self.options.environment:
                system_exit(os.EX_UNAVAILABLE, _("Environments are not supported by this server."))
        except Exception as e:
            log.exception(e)
            system_exit(os.EX_SOFTWARE, CONNECTION_FAILURE % e)

        environment = None
        if len(environment_list) > 0:
            if self.options.environment:
                env_input = self.options.environment
            elif len(environment_list) == 1:
                env_input = environment_list[0]['name']
            else:
                env_input = six.moves.input(_("Environment: ")).strip()
                readline.clear_history()

            for env_data in environment_list:
                # See BZ #978001
                if (env_data['name'] == env_input or
                   ('label' in env_data and env_data['label'] == env_input) or
                   ('displayName' in env_data and env_data['displayName'] == env_input)):
                    environment = env_data['name']
                    break
            if not environment:
                system_exit(os.EX_DATAERR, _("Couldn't find environment '%s'.") % env_input)

        return environment
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:32,代码来源:migrate.py

示例8: __init__

    def __init__(self, update_callback=None):
        super(SystemFactsDialog, self).__init__()

        #self.consumer = consumer
        self.update_callback = update_callback
        self.identity = inj.require(inj.IDENTITY)
        self.cp_provider = inj.require(inj.CP_PROVIDER)

        self.facts = inj.require(inj.FACTS)

        self.connect_signals({
                "on_system_facts_dialog_delete_event": self._hide_callback,
                "on_close_button_clicked": self._hide_callback,
                "on_facts_update_button_clicked": self._update_facts_callback
                })

        # Set up the model
        self.facts_store = ga_Gtk.TreeStore(str, str)
        self.facts_view.set_model(self.facts_store)

        # Set up columns on the view
        self._add_column(_("Fact"), 0)
        self._add_column(_("Value"), 1)

        # set up the signals from the view
        self.facts_view.connect("row_activated",
                        widgets.expand_collapse_on_row_activated_callback)
开发者ID:Januson,项目名称:subscription-manager,代码行数:27,代码来源:factsgui.py

示例9: __str__

 def __str__(self):
     s = ["Container content cert updates\n"]
     s.append(_("Added:"))
     s.append(self._format_file_list(self.added))
     s.append(_("Removed:"))
     s.append(self._format_file_list(self.removed))
     return '\n'.join(s)
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:container.py

示例10: __init__

    def __init__(self, name="system",
                 shortdesc=_("Assemble system information as a tar file or directory"),
                 primary=True):
        CliCommand.__init__(self, name=name, shortdesc=shortdesc, primary=primary)

        self.parser.add_option("--destination", dest="destination",
                               default="/tmp", help=_("the destination location of the result; default is /tmp"))
        # default is to build an archive, this skips the archive and clean up,
        # just leaving the directory of debug info for sosreport to report
        self.parser.add_option("--no-archive", action='store_false',
                               default=True, dest="archive",
                               help=_("data will be in an uncompressed directory"))
        self.parser.add_option("--sos", action='store_true',
                               default=False, dest="sos",
                               help=_("only data not already included in sos report will be collected"))
        # These options don't do anything anymore, since current versions of
        # RHSM api doesn't support it, and previously they failed silently.
        # So now they are hidden, and they are not hooked up to anything. This
        # avoids breaking existing scripts, since it also didn't do anything
        # before. See rhbz #1246680
        self.parser.add_option("--no-subscriptions", action='store_true',
                               dest="placeholder_for_subscriptions_option",
                               default=False, help=optparse.SUPPRESS_HELP)
        self.parser.add_option("--subscriptions", action='store_true',
                               dest="placeholder_for_subscriptions_option",
                               default=False, help=optparse.SUPPRESS_HELP)

        self.assemble_path = ASSEMBLE_DIR

        # so we can track the path of the archive for tests.
        self.final_destination_path = None
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:31,代码来源:debug_commands.py

示例11: search_button_clicked

    def search_button_clicked(self, widget=None):
        """
        Reload the subscriptions from the server when the Search button
        is clicked.
        """
        if not self.date_picker.date_entry_validate():
            return
        try:
            pb_title = _("Searching")
            pb_label = _("Searching for subscriptions. Please wait.")
            if self.pb:
                self.pb.set_title(pb_title)
                self.pb.set_label(pb_label)
            else:
                # show pulsating progress bar while we wait for results
                self.pb = progress.Progress(pb_title, pb_label)
                self.timer = ga_GObject.timeout_add(100, self.pb.pulse)
                self.pb.set_transient_for(self.parent_win)

            # fire off async refresh
            async_stash = async_utils.AsyncPool(self.pool_stash)
            async_stash.refresh(self.date_picker.date, self._update_display)
        except Exception as e:
            handle_gui_exception(e, _("Error fetching subscriptions from server:  %s"),
                    self.parent_win)
开发者ID:Januson,项目名称:subscription-manager,代码行数:25,代码来源:allsubs.py

示例12: select_service_level

    def select_service_level(self, org, servicelevel):
        not_supported = _("Error: The service-level command is not supported by the server.")
        try:
            levels = self.cp.getServiceLevelList(org)
        except RemoteServerException as e:
            system_exit(-1, not_supported)
        except RestlibException as e:
            if e.code == 404:
                # no need to die, just skip it
                print(not_supported)
                return None
            else:
                # server supports it but something went wrong, die.
                raise e

        # Create the sla tuple before appending the empty string to the list of
        # valid slas.
        slas = [(sla, sla) for sla in levels]
        # Display an actual message for the empty string level.
        slas.append((_("No service level preference"), ""))

        # The empty string is a valid level so append it to the list.
        levels.append("")
        if servicelevel is None or \
            servicelevel.upper() not in (level.upper() for level in levels):
            if servicelevel is not None:
                print(_("\nService level \"%s\" is not available.") % servicelevel)
            menu = Menu(slas, _("Please select a service level agreement for this system."))
            servicelevel = menu.choose()
        return servicelevel
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:30,代码来源:migrate.py

示例13: __init__

    def __init__(self, table_widget, product_dir, yes_id=ga_Gtk.STOCK_APPLY,
                 no_id=ga_Gtk.STOCK_REMOVE):
        """
        Create a new products table, populating the Gtk.TreeView.

        yes_id and no_id are GTK constants that specify the icon to
        use for representing if a product is installed.
        """

        table_widget.get_selection().set_mode(ga_Gtk.SelectionMode.NONE)
        self.table_widget = table_widget
        self.product_store = ga_Gtk.ListStore(str, ga_GdkPixbuf.Pixbuf)
        table_widget.set_model(self.product_store)

        self.yes_icon = self._render_icon(yes_id)
        self.no_icon = self._render_icon(no_id)
        self.product_dir = product_dir

        name_column = ga_Gtk.TreeViewColumn(_("Product"),
                                         ga_Gtk.CellRendererText(),
                                         markup=0)
        name_column.set_expand(True)
        installed_column = ga_Gtk.TreeViewColumn(_("Installed"),
                                              ga_Gtk.CellRendererPixbuf(),
                                              pixbuf=1)

        table_widget.append_column(name_column)
        table_widget.append_column(installed_column)
开发者ID:Januson,项目名称:subscription-manager,代码行数:28,代码来源:widgets.py

示例14: legacy_purge

    def legacy_purge(self, rpc_session, session_key):
        system_id_path = self.rhncfg["systemIdPath"]

        log.info("Deleting system %s from legacy server...", self.system_id)
        try:
            result = rpc_session.system.deleteSystems(session_key, self.system_id)
        except Exception:
            log.exception("Could not delete system %s from legacy server" % self.system_id)
            # If we time out or get a network error, log it and keep going.
            shutil.move(system_id_path, system_id_path + ".save")
            print(_("Did not receive a completed unregistration message from legacy server for system %s.") % self.system_id)

            if self.is_hosted:
                print(_("Please investigate on the Customer Portal at https://access.redhat.com."))
            return

        if result:
            log.info("System %s deleted.  Removing system id file and disabling rhnplugin.conf", self.system_id)
            os.remove(system_id_path)
            try:
                self.disable_yum_rhn_plugin()
            except Exception:
                pass
            print(_("System successfully unregistered from legacy server."))
        else:
            # If the legacy server reports that deletion just failed, then quit.
            system_exit(1, _("Unable to unregister system from legacy server.  ") + SEE_LOG_FILE)
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:27,代码来源:migrate.py

示例15: _display_progress_bar

 def _display_progress_bar(self):
     if self.progress_bar:
         self.progress_bar.set_title(_("Testing Connection"))
         self.progress_bar.set_label(_("Please wait"))
     else:
         self.progress_bar = progress.Progress(_("Testing Connection"), _("Please wait"))
         self.timer = ga_GObject.timeout_add(100, self.progress_bar.pulse)
         self.progress_bar.set_transient_for(self.networkConfigDialog)
开发者ID:Januson,项目名称:subscription-manager,代码行数:8,代码来源:networkConfig.py


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