本文整理汇总了Python中pyanaconda.core.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _update_action_buttons
def _update_action_buttons(self, row):
obj = PartStoreRow(*row)
device = self.storage.devicetree.get_device_by_id(obj.id)
# Disks themselves may be editable in certain ways, but they are never
# shrinkable.
self._preserveButton.set_sensitive(obj.editable)
self._shrinkButton.set_sensitive(obj.editable and not device.is_disk)
self._deleteButton.set_sensitive(obj.editable)
self._resizeSlider.set_visible(False)
if not obj.editable:
return
# If the selected filesystem does not support shrinking, make that
# button insensitive.
self._shrinkButton.set_sensitive(device.resizable)
if device.resizable:
self._setup_slider(device, Size(obj.target))
# Then, disable the button for whatever action is currently selected.
# It doesn't make a lot of sense to allow clicking that.
if obj.action == _(PRESERVE):
self._preserveButton.set_sensitive(False)
elif obj.action == _(SHRINK):
self._shrinkButton.set_sensitive(False)
self._resizeSlider.set_visible(True)
elif obj.action == _(DELETE):
self._deleteButton.set_sensitive(False)
开发者ID:rvykydal,项目名称:anaconda,代码行数:30,代码来源:resize.py
示例2: status
def status(self):
if self._error:
return _("Error setting up software source")
elif not self.ready:
return _("Processing...")
else:
return self._repo_status()
开发者ID:zhangsju,项目名称:anaconda,代码行数:7,代码来源:installation_source.py
示例3: parse
def parse(self, args):
"""Parse the command.
Do any glob expansion now, since we need to have the real
list of disks available before the execute methods run.
"""
retval = super().parse(args)
# Set the default type.
if self.type is None:
self.type = CLEARPART_TYPE_NONE
# Check the disk label.
if self.disklabel and self.disklabel not in DiskLabel.get_platform_label_types():
raise KickstartParseError(_("Disklabel \"{}\" given in clearpart command is not "
"supported on this platform.").format(self.disklabel),
lineno=self.lineno)
# Get the disks names to clear.
self.drives = get_device_names(self.drives, disks_only=True, lineno=self.lineno,
msg=_("Disk \"{}\" given in clearpart command does "
"not exist."))
# Get the devices names to clear.
self.devices = get_device_names(self.devices, disks_only=False, lineno=self.lineno,
msg=_("Device \"{}\" given in clearpart device list "
"does not exist."))
return retval
开发者ID:zhangsju,项目名称:anaconda,代码行数:29,代码来源:kickstart.py
示例4: parse
def parse(self, args):
tg = super().parse(args)
if tg.iface:
if not network.wait_for_network_devices([tg.iface]):
raise KickstartParseError(lineno=self.lineno,
msg=_("Network interface \"%(nic)s\" required by iSCSI \"%(iscsiTarget)s\" target is not up.") %
{"nic": tg.iface, "iscsiTarget": tg.target})
mode = blivet.iscsi.iscsi.mode
if mode == "none":
if tg.iface:
network_proxy = NETWORK.get_proxy()
activated_ifaces = network_proxy.GetActivatedInterfaces()
blivet.iscsi.iscsi.create_interfaces(activated_ifaces)
elif ((mode == "bind" and not tg.iface)
or (mode == "default" and tg.iface)):
raise KickstartParseError(lineno=self.lineno,
msg=_("iscsi --iface must be specified (binding used) either for all targets or for none"))
try:
blivet.iscsi.iscsi.add_target(tg.ipaddr, tg.port, tg.user,
tg.password, tg.user_in,
tg.password_in,
target=tg.target,
iface=tg.iface)
iscsi_log.info("added iscsi target %s at %s via %s", tg.target, tg.ipaddr, tg.iface)
except (IOError, ValueError) as e:
raise KickstartParseError(lineno=self.lineno, msg=str(e))
return tg
开发者ID:rvykydal,项目名称:anaconda,代码行数:31,代码来源:kickstart.py
示例5: _activated_device_msg
def _activated_device_msg(self, devname):
msg = _("Wired (%(interface_name)s) connected\n") \
% {"interface_name": devname}
device = self.nm_client.get_device_by_iface(devname)
if device:
ipv4config = device.get_ip4_config()
if ipv4config:
addresses = ipv4config.get_addresses()
if addresses:
a0 = addresses[0]
addr_str = a0.get_address()
prefix = a0.get_prefix()
netmask_str = network.prefix_to_netmask(prefix)
gateway_str = ipv4config.get_gateway() or ''
dnss_str = ",".join(ipv4config.get_nameservers())
else:
addr_str = dnss_str = gateway_str = netmask_str = ""
msg += _(" IPv4 Address: %(addr)s Netmask: %(netmask)s Gateway: %(gateway)s\n") % \
{"addr": addr_str, "netmask": netmask_str, "gateway": gateway_str}
msg += _(" DNS: %s\n") % dnss_str
ipv6config = device.get_ip6_config()
if ipv6config:
for address in ipv6config.get_addresses():
addr_str = address.get_address()
prefix = address.get_prefix()
# Do not display link-local addresses
if not addr_str.startswith("fe80:"):
msg += _(" IPv6 Address: %(addr)s/%(prefix)d\n") % \
{"addr": addr_str, "prefix": prefix}
return msg
开发者ID:rvykydal,项目名称:anaconda,代码行数:32,代码来源:network.py
示例6: verify_swap
def verify_swap(storage, constraints, report_error, report_warning):
""" Verify the existence of swap.
:param storage: a storage to check
:param constraints: a dictionary of constraints
:param report_error: a function for error reporting
:param report_warning: a function for warning reporting
"""
swaps = storage.fsset.swap_devices
if not swaps:
installed = util.total_memory()
required = Size("%s MiB" % (constraints[STORAGE_MIN_RAM] + isys.NO_SWAP_EXTRA_RAM))
if not constraints[STORAGE_SWAP_IS_RECOMMENDED]:
if installed < required:
report_warning(_("You have not specified a swap partition. "
"%(requiredMem)s of memory is recommended to continue "
"installation without a swap partition, but you only "
"have %(installedMem)s.")
% {"requiredMem": required, "installedMem": installed})
else:
if installed < required:
report_error(_("You have not specified a swap partition. "
"%(requiredMem)s of memory is required to continue "
"installation without a swap partition, but you only "
"have %(installedMem)s.")
% {"requiredMem": required, "installedMem": installed})
else:
report_warning(_("You have not specified a swap partition. "
"Although not strictly required in all cases, "
"it will significantly improve performance "
"for most installations."))
开发者ID:zhangsju,项目名称:anaconda,代码行数:33,代码来源:storage_utils.py
示例7: _main_loop_handleException
def _main_loop_handleException(self, dump_info):
"""
Helper method with one argument only so that it can be registered
with run_in_loop to run on idle or called from a handler.
:type dump_info: an instance of the meh.DumpInfo class
"""
ty = dump_info.exc_info.type
value = dump_info.exc_info.value
if (issubclass(ty, blivet.errors.StorageError) and value.hardware_fault) \
or (issubclass(ty, OSError) and value.errno == errno.EIO):
# hardware fault or '[Errno 5] Input/Output error'
hw_error_msg = _("The installation was stopped due to what "
"seems to be a problem with your hardware. "
"The exact error message is:\n\n%s.\n\n "
"The installer will now terminate.") % str(value)
self.intf.messageWindow(_("Hardware error occurred"), hw_error_msg)
sys.exit(0)
elif isinstance(value, blivet.errors.UnusableConfigurationError):
sys.exit(0)
elif isinstance(value, NonInteractiveError):
sys.exit(0)
else:
super().handleException(dump_info)
return False
开发者ID:rvykydal,项目名称:anaconda,代码行数:28,代码来源:exception.py
示例8: run_dasdfmt_dialog
def run_dasdfmt_dialog(self, dasd_formatting):
"""Do DASD formatting if user agrees."""
# Prepare text of the dialog.
text = ""
text += _("The following unformatted or LDL DASDs have been "
"detected on your system. You can choose to format them "
"now with dasdfmt or cancel to leave them unformatted. "
"Unformatted DASDs cannot be used during installation.\n\n")
text += dasd_formatting.dasds_summary + "\n\n"
text += _("Warning: All storage changes made using the installer will "
"be lost when you choose to format.\n\nProceed to run dasdfmt?\n")
# Run the dialog.
question_window = YesNoDialog(text)
ScreenHandler.push_screen_modal(question_window)
if not question_window.answer:
return None
print(_("This may take a moment."), flush=True)
# Do the DASD formatting.
dasd_formatting.report.connect(self._show_dasdfmt_report)
dasd_formatting.run(self.storage, self.data)
dasd_formatting.report.disconnect(self._show_dasdfmt_report)
self.update_disks()
开发者ID:rvykydal,项目名称:anaconda,代码行数:28,代码来源:storage.py
示例9: status
def status(self):
kickstart_timezone = self._timezone_module.proxy.Timezone
if kickstart_timezone:
return _("%s timezone") % kickstart_timezone
else:
return _("Timezone is not set.")
开发者ID:rvykydal,项目名称:anaconda,代码行数:7,代码来源:time_spoke.py
示例10: initialize
def initialize(self, actions):
for (i, action) in enumerate(actions, start=1):
mountpoint = ""
if action.type in [ACTION_TYPE_DESTROY, ACTION_TYPE_RESIZE]:
typeString = """<span foreground='red'>%s</span>""" % \
escape_markup(action.type_desc.title())
else:
typeString = """<span foreground='green'>%s</span>""" % \
escape_markup(action.type_desc.title())
if action.obj == ACTION_OBJECT_FORMAT:
mountpoint = getattr(action.device.format, "mountpoint", "")
if hasattr(action.device, "description"):
desc = _("%(description)s (%(deviceName)s)") % {"deviceName": action.device.name,
"description": action.device.description}
serial = action.device.serial
elif hasattr(action.device, "disk"):
desc = _("%(deviceName)s on %(container)s") % {"deviceName": action.device.name,
"container": action.device.disk.description}
serial = action.device.disk.serial
else:
desc = action.device.name
serial = action.device.serial
self._store.append([i,
typeString,
action.object_type_string,
desc,
mountpoint,
serial])
开发者ID:zhangsju,项目名称:anaconda,代码行数:31,代码来源:summary.py
示例11: on_updown_ampm_clicked
def on_updown_ampm_clicked(self, *args):
self._stop_and_maybe_start_time_updating()
if self._amPmLabel.get_text() == _("AM"):
self._amPmLabel.set_text(_("PM"))
else:
self._amPmLabel.set_text(_("AM"))
开发者ID:zhangsju,项目名称:anaconda,代码行数:7,代码来源:datetime_spoke.py
示例12: show_all
def show_all(self):
super().show_all()
from pyanaconda.installation import doInstall, doConfiguration
from pyanaconda.threading import threadMgr, AnacondaThread
thread_args = (self.storage, self.payload, self.data, self.instclass)
threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall, args=thread_args))
# This will run until we're all done with the install thread.
self._update_progress()
threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration, args=thread_args))
# This will run until we're all done with the configuration thread.
self._update_progress()
util.ipmi_report(IPMI_FINISHED)
if self.instclass.eula_path:
# Notify user about the EULA (if any).
print(_("Installation complete"))
print('')
print(_("Use of this product is subject to the license agreement found at:"))
print(self.instclass.eula_path)
print('')
# kickstart install, continue automatically if reboot or shutdown selected
if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
# Just pretend like we got input, and our input doesn't care
# what it gets, it just quits.
raise ExitMainLoop()
开发者ID:zhangsju,项目名称:anaconda,代码行数:32,代码来源:installation_progress.py
示例13: refresh
def refresh(self, args=None):
""" Refresh screen. """
self._load_new_devices()
NormalTUISpoke.refresh(self, args)
self._container = ListColumnContainer(1, columns_width=78, spacing=1)
summary = self._summary_text()
self.window.add_with_separator(TextWidget(summary))
hostname = _("Host Name: %s\n") % self._network_module.proxy.Hostname
self.window.add_with_separator(TextWidget(hostname))
current_hostname = _("Current host name: %s\n") % self._network_module.proxy.GetCurrentHostname()
self.window.add_with_separator(TextWidget(current_hostname))
# if we have any errors, display them
while len(self.errors) > 0:
self.window.add_with_separator(TextWidget(self.errors.pop()))
dialog = Dialog(_("Host Name"))
self._container.add(TextWidget(_("Set host name")), callback=self._set_hostname_callback, data=dialog)
for dev_name in self.supported_devices:
text = (_("Configure device %s") % dev_name)
self._container.add(TextWidget(text), callback=self._configure_network_interface, data=dev_name)
self.window.add_with_separator(self._container)
开发者ID:zhangsju,项目名称:anaconda,代码行数:26,代码来源:network.py
示例14: _activated_device_msg
def _activated_device_msg(self, devname):
msg = _("Wired (%(interface_name)s) connected\n") \
% {"interface_name": devname}
ipv4config = nm.nm_device_ip_config(devname, version=4)
ipv6config = nm.nm_device_ip_config(devname, version=6)
if ipv4config and ipv4config[0]:
addr_str, prefix, gateway_str = ipv4config[0][0]
netmask_str = network.prefix2netmask(prefix)
dnss_str = ",".join(ipv4config[1])
else:
addr_str = dnss_str = gateway_str = netmask_str = ""
msg += _(" IPv4 Address: %(addr)s Netmask: %(netmask)s Gateway: %(gateway)s\n") % \
{"addr": addr_str, "netmask": netmask_str, "gateway": gateway_str}
msg += _(" DNS: %s\n") % dnss_str
if ipv6config and ipv6config[0]:
for ipv6addr in ipv6config[0]:
addr_str, prefix, gateway_str = ipv6addr
# Do not display link-local addresses
if not addr_str.startswith("fe80:"):
msg += _(" IPv6 Address: %(addr)s/%(prefix)d\n") % \
{"addr": addr_str, "prefix": prefix}
return msg
开发者ID:zhangsju,项目名称:anaconda,代码行数:27,代码来源:network.py
示例15: verify_root
def verify_root(storage, constraints, report_error, report_warning):
""" Verify the root.
:param storage: a storage to check
:param constraints: a dictionary of constraints
:param report_error: a function for error reporting
:param report_warning: a function for warning reporting
"""
root = storage.fsset.root_device
if root:
if root.size < constraints[STORAGE_MIN_ROOT]:
report_warning(_("Your root partition is less than %(size)s "
"which is usually too small to install "
"%(product)s.")
% {'size': constraints[STORAGE_MIN_ROOT],
'product': productName})
else:
report_error(_("You have not defined a root partition (/), "
"which is required for installation of %s"
" to continue.") % (productName,))
if storage.root_device and storage.root_device.format.exists:
e = storage.must_format(storage.root_device)
if e:
report_error(e)
开发者ID:zhangsju,项目名称:anaconda,代码行数:26,代码来源:storage_utils.py
示例16: _summary_text
def _summary_text(self):
"""Return summary of current timezone & NTP configuration.
:returns: current status
:rtype: str
"""
msg = ""
# timezone
kickstart_timezone = self._timezone_module.proxy.Timezone
timezone_msg = _("not set")
if kickstart_timezone:
timezone_msg = kickstart_timezone
msg += _("Timezone: %s\n") % timezone_msg
# newline section separator
msg += "\n"
# NTP
msg += _("NTP servers:")
if self._ntp_servers:
for status in format_ntp_status_list(self._ntp_servers):
msg += "\n%s" % status
else:
msg += _("not configured")
return msg
开发者ID:rvykydal,项目名称:anaconda,代码行数:27,代码来源:time_spoke.py
示例17: verify_partition_format_sizes
def verify_partition_format_sizes(storage, constraints, report_error, report_warning):
""" Verify that the size of the device is allowed by the format used.
:param storage: a storage to check
:param constraints: a dictionary of constraints
:param report_error: a function for error reporting
:param report_warning: a function for warning reporting
"""
# storage.mountpoints is a property that returns a new dict each time, so
# iterating over it is thread-safe.
filesystems = storage.mountpoints
for (mount, device) in filesystems.items():
problem = filesystems[mount].check_size()
if problem < 0:
report_error(_("Your %(mount)s partition is too small for "
"%(format)s formatting (allowable size is "
"%(minSize)s to %(maxSize)s)")
% {"mount": mount, "format": device.format.name,
"minSize": device.min_size, "maxSize": device.max_size})
elif problem > 0:
report_error(_("Your %(mount)s partition is too large for "
"%(format)s formatting (allowable size is "
"%(minSize)s to %(maxSize)s)")
% {"mount": mount, "format": device.format.name,
"minSize": device.min_size, "maxSize": device.max_size})
开发者ID:zhangsju,项目名称:anaconda,代码行数:26,代码来源:storage_utils.py
示例18: prompt
def prompt(self, args=None):
""" Customize default prompt. """
prompt = NormalTUISpoke.prompt(self, args)
prompt.set_message(_("Please select the timezone. Use numbers or type names directly"))
# TRANSLATORS: 'b' to go back
prompt.add_option(C_('TUI|Spoke Navigation|Time Settings', 'b'), _("back to region list"))
return prompt
开发者ID:rvykydal,项目名称:anaconda,代码行数:7,代码来源:time_spoke.py
示例19: refresh
def refresh(self, args=None):
super().refresh(args)
self._container = ListColumnContainer(1, columns_width=78, spacing=1)
# check if the storage refresh thread is running
if threadMgr.get(THREAD_STORAGE_WATCHER):
# storage refresh is running - just report it
# so that the user can refresh until it is done
# TODO: refresh once the thread is done ?
message = _(PAYLOAD_STATUS_PROBING_STORAGE)
self.window.add_with_separator(TextWidget(message))
# check if there are any mountable devices
if self._mountable_devices:
for d in self._mountable_devices:
self._container.add(TextWidget(d[1]),
callback=self._select_mountable_device,
data=d[0])
self.window.add_with_separator(self._container)
else:
message = _("No mountable devices found")
self.window.add_with_separator(TextWidget(message))
开发者ID:rvykydal,项目名称:anaconda,代码行数:25,代码来源:installation_source.py
示例20: validate_mountpoint
def validate_mountpoint(mountpoint, used_mountpoints, strict=True):
if strict:
fake_mountpoints = []
else:
fake_mountpoints = ["swap", "biosboot", "prepboot"]
if mountpoint in used_mountpoints:
return _("That mount point is already in use. Try something else?")
elif not mountpoint:
return _("Please enter a valid mount point.")
elif mountpoint in system_mountpoints:
return _("That mount point is invalid. Try something else?")
elif (lowerASCII(mountpoint) not in fake_mountpoints and
((len(mountpoint) > 1 and mountpoint.endswith("/")) or
not mountpoint.startswith("/") or
" " in mountpoint or
re.search(r'/\.*/', mountpoint) or
re.search(r'/\.+$', mountpoint))):
# - does not end with '/' unless mountpoint _is_ '/'
# - starts with '/' except for "swap", &c
# - does not contain spaces
# - does not contain pairs of '/' enclosing zero or more '.'
# - does not end with '/' followed by one or more '.'
return _("That mount point is invalid. Try something else?")
else:
return ""
开发者ID:rvykydal,项目名称:anaconda,代码行数:26,代码来源:custom_storage_helpers.py
注:本文中的pyanaconda.core.i18n._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论