本文整理汇总了Python中pyanaconda.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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:bwann,项目名称:anaconda,代码行数:31,代码来源:summary.py
示例2: status
def status(self):
if len(self.data.user.userList) == 0:
return _("No user will be created")
elif self._wheel.name in self.data.user.userList[0].groups:
return _("Administrator %s will be created") % self.data.user.userList[0].name
else:
return _("User %s will be created") % self.data.user.userList[0].name
开发者ID:cyclefusion,项目名称:anaconda,代码行数:7,代码来源:user.py
示例3: refresh
def refresh(self, args=None):
NormalTUISpoke.refresh(self, args)
# Join the initialization thread to block on it
# This print is foul. Need a better message display
print(_(PAYLOAD_STATUS_PROBING_STORAGE))
threadMgr.wait(THREAD_STORAGE_WATCHER)
# synchronize our local data store with the global ksdata
# Commment out because there is no way to select a disk right
# now without putting it in ksdata. Seems wrong?
#self.selected_disks = self.data.ignoredisk.onlyuse[:]
self.autopart = self.data.autopart.autopart
message = self._update_summary()
# loop through the disks and present them.
for disk in self.disks:
disk_info = self._format_disk_info(disk)
c = CheckboxWidget(title="%i) %s" % (self.disks.index(disk) + 1, disk_info),
completed=(disk.name in self.selected_disks))
self._window += [c, ""]
# if we have more than one disk, present an option to just
# select all disks
if len(self.disks) > 1:
c = CheckboxWidget(title="%i) %s" % (len(self.disks) + 1, _("Select all")),
completed=(self.selection == len(self.disks)))
self._window += [c, ""]
self._window += [TextWidget(message), ""]
return True
开发者ID:galleguindio,项目名称:anaconda,代码行数:34,代码来源:storage.py
示例4: check_password_empty
def check_password_empty(self, inputcheck):
"""Check whether a password has been specified at all.
This check is used for both the password and the confirmation.
"""
# If the password was set by kickstart, skip the strength check
# pylint: disable=no-member
if self.input_kickstarted and not self.policy.changesok:
return InputCheck.CHECK_OK
# Skip the check if no password is required
if (not self.input_enabled) or self.input_kickstarted:
return InputCheck.CHECK_OK
# Also skip the check if the policy says that an empty password is fine
# pylint: disable=no-member
elif self.policy.emptyok:
return InputCheck.CHECK_OK
elif not self.get_input(inputcheck.input_obj):
# pylint: disable=no-member
if self.policy.strict:
return _(constants.PASSWORD_EMPTY_ERROR)
else:
if self.waive_clicks > 1:
return InputCheck.CHECK_OK
else:
return "%s %s" % (_(constants.PASSWORD_EMPTY_ERROR), _(constants.PASSWORD_DONE_TWICE))
else:
return InputCheck.CHECK_OK
开发者ID:dougsland,项目名称:anaconda,代码行数:28,代码来源:helpers.py
示例5: _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}
dnss_str = ",".join(ipv6config[1])
return msg
开发者ID:dougsland,项目名称:anaconda,代码行数:28,代码来源:network.py
示例6: _update_summary
def _update_summary(self):
""" Update the summary based on the UI. """
count = 0
capacity = 0
free = Size(bytes=0)
# pass in our disk list so hidden disks' free space is available
free_space = self.storage.getFreeSpace(disks=self.disks)
selected = [d for d in self.disks if d.name in self.selected_disks]
for disk in selected:
capacity += disk.size
free += free_space[disk.name][0]
count += 1
summary = (P_("%d disk selected; %s capacity; %s free",
"%d disks selected; %s capacity; %s free",
count) % (count, str(Size(spec="%s MB" % capacity)), free))
summary_label = self.builder.get_object("summary_label")
summary_label.set_text(summary)
summary_label.set_sensitive(count > 0)
summary_button = self.builder.get_object("summary_button")
summary_button.set_visible(count > 0)
if len(self.disks) == 0:
self.set_warning(_("No disks detected. Please shut down the computer, connect at least one disk, and restart to complete installation."))
elif count == 0:
self.set_warning(_("No disks selected; please select at least one disk to install to."))
else:
self.clear_info()
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:31,代码来源:storage.py
示例7: connectToView
def connectToView(self):
"""Attempt to connect to self.vncconnecthost"""
maxTries = 10
self.log.info(_("Attempting to connect to vnc client on host %s..."), self.vncconnecthost)
if self.vncconnectport != "":
hostarg = self.vncconnecthost + ":" + self.vncconnectport
else:
hostarg = self.vncconnecthost
vncconfigcommand = [self.root+"/usr/bin/vncconfig", "-display", ":%s" % constants.X_DISPLAY_NUMBER, "-connect", hostarg]
for _i in range(maxTries):
vncconfp = iutil.startProgram(vncconfigcommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # vncconfig process
err = vncconfp.communicate()[1].decode("utf-8")
if err == '':
self.log.info(_("Connected!"))
return True
elif err.startswith("connecting") and err.endswith("failed\n"):
self.log.info(_("Will try to connect again in 15 seconds..."))
time.sleep(15)
continue
else:
log.critical(err)
iutil.ipmi_abort(scripts=self.anaconda.ksdata.scripts)
sys.exit(1)
self.log.error(P_("Giving up attempting to connect after %d try!\n",
"Giving up attempting to connect after %d tries!\n",
maxTries), maxTries)
return False
开发者ID:bwann,项目名称:anaconda,代码行数:32,代码来源:vnc.py
示例8: 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:jaymzh,项目名称:anaconda,代码行数:26,代码来源:storage_utils.py
示例9: prompt
def prompt(self, args=None):
""" Customize default prompt. """
prompt = NormalTUISpoke.prompt(self, args)
prompt.set_message(_("Please select language support to install"))
# TRANSLATORS: 'b' to go back
prompt.add_option(C_("TUI|Spoke Navigation|Language Support", "b"), _("to return to language list"))
return prompt
开发者ID:dougsland,项目名称:anaconda,代码行数:7,代码来源:langsupport.py
示例10: input
def input(self, args, key):
"""Override input so that we can launch the VNC password spoke"""
try:
keyid = int(key) - 1
if 0 <= keyid < len(self._choices):
choice = self._choices[keyid]
if choice == _(USETEXT):
self._usevnc = False
else:
self._usevnc = True
newspoke = VNCPassSpoke(self.app, self.data, self.storage,
self.payload, self.instclass)
self.app.switch_screen_modal(newspoke)
self.apply()
self.close()
return INPUT_PROCESSED
except ValueError:
pass
# TRANSLATORS: 'q' to quit
if key.lower() == C_('TUI|Spoke Navigation', 'q'):
d = YesNoDialog(self.app, _(self.app.quit_message))
self.app.switch_screen_modal(d)
if d.answer:
iutil.ipmi_report(IPMI_ABORTED)
if can_touch_runtime_system("Quit and Reboot"):
execWithRedirect("systemctl", ["--no-wall", "reboot"])
else:
exit(1)
else:
return key
开发者ID:thaygiaoth,项目名称:anaconda,代码行数:33,代码来源:askvnc.py
示例11: 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:jaymzh,项目名称:anaconda,代码行数:26,代码来源:storage_utils.py
示例12: _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:bwann,项目名称:anaconda,代码行数:30,代码来源:resize.py
示例13: 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:jresch,项目名称:anaconda,代码行数:26,代码来源:custom_storage_helpers.py
示例14: _doExecute
def _doExecute(self):
self._ready = False
hubQ.send_not_ready(self.__class__.__name__)
# on the off-chance dasdfmt is running, we can't proceed further
threadMgr.wait(constants.THREAD_DASDFMT)
hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
try:
doKickstartStorage(self.storage, self.data, self.instclass)
except (StorageError, KickstartValueError) as e:
log.error("storage configuration failed: %s", e)
StorageChecker.errors = str(e).split("\n")
hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
self.data.bootloader.bootDrive = ""
self.data.ignoredisk.drives = []
self.data.ignoredisk.onlyuse = []
self.storage.config.update(self.data)
self.storage.reset()
self.disks = getDisks(self.storage.devicetree)
# now set ksdata back to the user's specified config
applyDiskSelection(self.storage, self.data, self.selected_disks)
except BootLoaderError as e:
log.error("BootLoader setup failed: %s", e)
StorageChecker.errors = str(e).split("\n")
hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
self.data.bootloader.bootDrive = ""
else:
if self.autopart:
self.run()
finally:
resetCustomStorageData(self.data)
self._ready = True
hubQ.send_ready(self.__class__.__name__, True)
开发者ID:jresch,项目名称:anaconda,代码行数:32,代码来源:storage.py
示例15: refresh
def refresh(self, required_space, auto_swap, disk_free, fs_free, autoPartType, encrypted):
self.autoPartType = autoPartType
self.autoPartTypeCombo = self.builder.get_object("options2_combo")
self.autoPartTypeCombo.set_active(self.autoPartType)
self.encrypted = encrypted
self.encryptCheckbutton = self.builder.get_object("encryption2_checkbutton")
self.encryptCheckbutton.set_active(self.encrypted)
sw_text = self._get_sw_needs_text(required_space, auto_swap)
label_text = _("%s The disks you've selected have the following "
"amounts of free space:") % sw_text
label = self.builder.get_object("options2_label1")
label.set_markup(label_text)
label.set_tooltip_text(_("Please wait... software metadata still loading."))
label.connect("activate-link", self._modify_sw_link_clicked)
self.disk_free_label = self.builder.get_object("options2_disk_free_label")
self.fs_free_label = self.builder.get_object("options2_fs_free_label")
self._set_free_space_labels(disk_free, fs_free)
label_text = _("<b>You don't have enough space available to install "
"%s</b>. You can shrink or remove existing partitions "
"via our guided reclaim space tool, or you can adjust your "
"partitions on your own in the custom partitioning "
"interface.") % productName
self.builder.get_object("options2_label2").set_markup(label_text)
self._add_modify_watcher("options2_label1")
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:29,代码来源:storage.py
示例16: refresh
def refresh(self, args=None):
"""
args is None if we want a list of languages; or, it is a list of all
locales for a language.
"""
NormalTUISpoke.refresh(self, args)
if args:
self._window += [TextWidget(_("Available locales"))]
displayed = [TextWidget(localization.get_english_name(z)) for z in args]
else:
self._window += [TextWidget(_("Available languages"))]
displayed = [TextWidget(z) for z in self._langs]
def _prep(i, w):
""" make everything look nice """
number = TextWidget("%2d)" % (i + 1))
return ColumnWidget([(4, [number]), (None, [w])], 1)
# split zones to three columns
middle = len(displayed) / 3
left = [_prep(i, w) for i, w in enumerate(displayed) if i <= middle]
center = [_prep(i, w) for i, w in enumerate(displayed) if i > middle and i <= 2*middle]
right = [_prep(i, w) for i, w in enumerate(displayed) if i > 2*middle]
c = ColumnWidget([(24, left), (24, center), (24, right)], 3)
self._window += [c, ""]
return True
开发者ID:dougsland,项目名称:anaconda,代码行数:29,代码来源:langsupport.py
示例17: retranslate
def retranslate(self):
# Change the translations on labels and buttons that do not have
# substitution text.
for name in ["pickLanguageLabel", "betaWarnTitle", "betaWarnDesc"]:
self._retranslate_one(name)
# It would be nice to be able to read the translation context from the
# widget, but we live in an imperfect world.
# See also: https://bugzilla.gnome.org/show_bug.cgi?id=729066
for name in ["quitButton", "continueButton"]:
self._retranslate_one(name, "GUI|Welcome|Beta Warn Dialog")
# The welcome label is special - it has text that needs to be
# substituted.
welcomeLabel = self.builder.get_object("welcomeLabel")
welcomeLabel.set_text(
_("WELCOME TO %(name)s %(version)s.") % {"name": productName.upper(), "version": productVersion}
)
# Retranslate the language (filtering) entry's placeholder text
languageEntry = self.builder.get_object("languageEntry")
if not languageEntry in self._origStrings:
self._origStrings[languageEntry] = languageEntry.get_placeholder_text()
languageEntry.set_placeholder_text(_(self._origStrings[languageEntry]))
# And of course, don't forget the underlying window.
self.window.set_property("distribution", distributionText().upper())
self.window.retranslate()
开发者ID:KosiehBarter,项目名称:anaconda,代码行数:30,代码来源:welcome.py
示例18: on_info_bar_clicked
def on_info_bar_clicked(self, *args):
if self.errors:
label = _("The following errors were encountered when checking your storage "
"configuration. You can modify your storage layout or quit the "
"installer.")
dialog = DetailedErrorDialog(self.data, buttons=[_("_Quit"), _("_Modify Storage Layout")], label=label)
with enlightbox(self.window, dialog.window):
errors = "\n".join(self.errors)
dialog.refresh(errors)
rc = dialog.run()
dialog.window.destroy()
if rc == 0:
# Quit.
sys.exit(0)
elif self.warnings:
label = _("The following warnings were encountered when checking your storage "
"configuration. These are not fatal, but you may wish to make "
"changes to your storage layout.")
dialog = DetailedErrorDialog(self.data, buttons=[_("_OK")], label=label)
with enlightbox(self.window, dialog.window):
warnings = "\n".join(self.warnings)
dialog.refresh(warnings)
rc = dialog.run()
dialog.window.destroy()
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:29,代码来源:storage.py
示例19: refresh
def refresh(self, args=None):
NormalTUISpoke.refresh(self, args)
# 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 += [TextWidget(message), ""]
return True
# check if there are any mountable devices
if self._mountable_devices:
def _prep(i, w):
""" Mangle our text to make it look pretty on screen. """
number = TextWidget("%2d)" % (i + 1))
return ColumnWidget([(4, [number]), (None, [w])], 1)
devices = [TextWidget(d[1]) for d in self._mountable_devices]
# gnarl and mangle all of our widgets so things look pretty on
# screen
choices = [_prep(i, w) for i, w in enumerate(devices)]
displayed = ColumnWidget([(78, choices)], 1)
self._window.append(displayed)
else:
message = _("No mountable devices found")
self._window += [TextWidget(message), ""]
return True
开发者ID:adrelanos,项目名称:qubes-installer-qubes-os,代码行数:32,代码来源:source.py
示例20: refresh
def refresh(self, args=None):
"""args is None if we want a list of zones or "zone" to show all timezones in that zone."""
NormalTUISpoke.refresh(self, args)
if args and args in self._timezones:
self._window += [TextWidget(_("Available timezones in region %s") % args)]
displayed = [TextWidget(z) for z in self._timezones[args]]
else:
self._window += [TextWidget(_("Available regions"))]
displayed = [TextWidget(z) for z in self._regions]
def _prep(i, w):
number = TextWidget("%2d)" % (i + 1))
return ColumnWidget([(4, [number]), (None, [w])], 1)
# split zones to three columns
middle = len(displayed) / 3
left = [_prep(i, w) for i, w in enumerate(displayed) if i <= middle]
center = [_prep(i, w) for i, w in enumerate(displayed) if i > middle and i <= 2*middle]
right = [_prep(i, w) for i, w in enumerate(displayed) if i > 2*middle]
c = ColumnWidget([(24, left), (24, center), (24, right)], 3)
self._window.append(c)
return True
开发者ID:KosiehBarter,项目名称:anaconda,代码行数:25,代码来源:time_spoke.py
注:本文中的pyanaconda.i18n._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论