本文整理汇总了Python中simpleline.render.screen_handler.ScreenHandler.push_screen_modal方法的典型用法代码示例。如果您正苦于以下问题:Python ScreenHandler.push_screen_modal方法的具体用法?Python ScreenHandler.push_screen_modal怎么用?Python ScreenHandler.push_screen_modal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simpleline.render.screen_handler.ScreenHandler
的用法示例。
在下文中一共展示了ScreenHandler.push_screen_modal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _unlock_devices
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _unlock_devices(self):
"""Attempt to unlock all locked LUKS devices.
Returns true if all devices were unlocked.
"""
try_passphrase = None
passphrase = None
for device_name in self._rescue.get_locked_device_names():
skip = False
unlocked = False
while not (skip or unlocked):
if try_passphrase is None:
p = PasswordDialog(device_name)
ScreenHandler.push_screen_modal(p)
if p.answer:
passphrase = p.answer.strip()
else:
passphrase = try_passphrase
if passphrase is None:
# cancelled
skip = True
else:
unlocked = self._rescue.unlock_device(device_name, passphrase)
try_passphrase = passphrase if unlocked else None
return not self._rescue.get_locked_device_names()
示例2: _quit_callback
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _quit_callback(self, data):
d = YesNoDialog(_(QUIT_MESSAGE))
ScreenHandler.push_screen_modal(d)
self.redraw()
if d.answer:
self._rescue.reboot = True
self._rescue.finish()
示例3: _configure_connection
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _configure_connection(self, iface, connection_uuid):
connection = self.nm_client.get_connection_by_uuid(connection_uuid)
new_spoke = ConfigureDeviceSpoke(self.data, self.storage, self.payload,
self._network_module, iface, connection)
ScreenHandler.push_screen_modal(new_spoke)
if new_spoke.errors:
self.errors.extend(new_spoke.errors)
self.redraw()
return
if new_spoke.apply_configuration:
self._apply = True
device = self.nm_client.get_device_by_iface(iface)
log.debug("activating connection %s with device %s",
connection_uuid, iface)
self.nm_client.activate_connection_async(connection, device, None, None)
self._network_module.proxy.LogConfigurationState(
"Settings of {} updated in TUI.".format(iface)
)
self.redraw()
self.apply()
示例4: run_dasdfmt_dialog
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
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()
示例5: _set_iso_install_source
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _set_iso_install_source(self, data):
new_spoke = SelectDeviceSpoke(self.data,
self.storage, self.payload,
self.instclass)
ScreenHandler.push_screen_modal(new_spoke)
self.apply()
self.close()
示例6: _quit_callback
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _quit_callback(self, data):
d = YesNoDialog(_(u"Do you really want to quit?"))
ScreenHandler.push_screen_modal(d)
self.redraw()
if d.answer:
self._rescue.reboot = True
self._rescue.finish()
示例7: _set_network_nfs
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _set_network_nfs(self, data):
self.set_source_nfs()
new_spoke = SpecifyNFSRepoSpoke(self.data, self.storage,
self.payload, self.instclass, self._error)
ScreenHandler.push_screen_modal(new_spoke)
self.apply()
self.close()
示例8: _select_mountable_device
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _select_mountable_device(self, data):
self._device = data
new_spoke = SelectISOSpoke(self.data,
self.storage, self.payload,
self.instclass, self._device)
ScreenHandler.push_screen_modal(new_spoke)
self.close()
示例9: _showError
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _showError(self, message):
"""Internal helper function that MUST BE CALLED FROM THE MAIN THREAD."""
if flags.automatedInstall and not flags.ksprompt:
log.error(message)
# If we're in cmdline mode, just exit.
return
error_window = IpmiErrorDialog(message)
ScreenHandler.push_screen_modal(error_window)
示例10: input
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def input(self, args, key):
"""Handle the input."""
# TRANSLATORS: 'h' to help
if key.lower() == Prompt.HELP:
if self.has_help:
help_path = get_help_path(self.helpFile, True)
ScreenHandler.push_screen_modal(HelpScreen(help_path))
return InputState.PROCESSED_AND_REDRAW
return super().input(args, key)
示例11: input
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def input(self, args, key):
"""Handle the input."""
# TRANSLATORS: 'h' to help
if key.lower() == Prompt.HELP:
if self.has_help:
help_path = ihelp.get_help_path(self.helpFile, self.instclass, True)
ScreenHandler.push_screen_modal(HelpScreen(help_path))
self.redraw()
return InputState.PROCESSED
return super(NormalTUISpoke, self).input(args, key)
示例12: _mount_root
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _mount_root(self):
# decrypt all luks devices
self._unlock_devices()
found_roots = self._rescue.get_found_root_infos()
if len(found_roots) > 1:
# have to prompt user for which root to mount
root_spoke = RootSelectionSpoke(found_roots)
ScreenHandler.push_screen_modal(root_spoke)
self.redraw()
self._rescue.select_root(root_spoke.selection)
self._rescue.mount_root()
示例13: _showYesNoQuestion
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _showYesNoQuestion(self, message):
"""Internal helper function that MUST BE CALLED FROM THE MAIN THREAD."""
if flags.automatedInstall and not flags.ksprompt:
log.error(message)
# If we're in cmdline mode, just say no.
return False
question_window = YesNoDialog(message)
ScreenHandler.push_screen_modal(question_window)
return question_window.answer
示例14: _validate_password
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _validate_password(self, password, confirm):
"""Validate and process user password."""
if password != confirm:
self._report(_(constants.SECRET_CONFIRM_ERROR_TUI[self._secret_type]))
return None
# If an empty password was provided, unset the value
if not password:
return ""
# prepare a password validation request
password_check_request = input_checking.PasswordCheckRequest()
password_check_request.password = password
password_check_request.password_confirmation = ""
password_check_request.policy = self._policy
# validate the password
password_check = input_checking.PasswordValidityCheck()
password_check.run(password_check_request)
# if the score is equal to 0 and we have an error message set
if not password_check.result.password_score and password_check.result.error_message:
self._report(password_check.result.error_message)
return None
if password_check.result.password_quality < self._policy.minquality:
if self._policy.strict:
done_msg = ""
else:
done_msg = _("\nWould you like to use it anyway?")
if password_check.result.error_message:
weak_prefix = _(constants.SECRET_WEAK_WITH_ERROR[self._secret_type])
error = "{} {} {}".format(weak_prefix, password_check.result.error_message, done_msg)
else:
weak_prefix = _(constants.SECRET_WEAK[self._secret_type])
error = "{} {}".format(weak_prefix, done_msg)
if not self._policy.strict:
question_window = YesNoDialog(error)
ScreenHandler.push_screen_modal(question_window)
if not question_window.answer:
return None
else:
self._report(error)
return None
if any(char not in constants.PW_ASCII_CHARS for char in password):
self._report(_(constants.SECRET_ASCII[self._secret_type]))
return self._process_password(password)
示例15: _configure_network_interface
# 需要导入模块: from simpleline.render.screen_handler import ScreenHandler [as 别名]
# 或者: from simpleline.render.screen_handler.ScreenHandler import push_screen_modal [as 别名]
def _configure_network_interface(self, data):
devname = data
ndata = network.ksdata_from_ifcfg(devname)
if not ndata:
# There is no ifcfg file for the device.
# Make sure there is just one connection for the device.
try:
nm.nm_device_setting_value(devname, "connection", "uuid")
except nm.SettingsNotFoundError:
log.debug("can't find any connection for %s", devname)
return
except nm.MultipleSettingsFoundError:
log.debug("multiple non-ifcfg connections found for %s", devname)
return
log.debug("dumping ifcfg file for in-memory connection %s", devname)
nm.nm_update_settings_of_device(devname, [['connection', 'id', devname, None]])
ndata = network.ksdata_from_ifcfg(devname)
new_spoke = ConfigureNetworkSpoke(self.data, self.storage,
self.payload, self.instclass, ndata)
ScreenHandler.push_screen_modal(new_spoke)
self.redraw()
if ndata.ip == "dhcp":
ndata.bootProto = "dhcp"
ndata.ip = ""
else:
ndata.bootProto = "static"
if not ndata.netmask:
self.errors.append(_("Configuration not saved: netmask missing in static configuration"))
return
if ndata.ipv6 == "ignore":
ndata.noipv6 = True
ndata.ipv6 = ""
else:
ndata.noipv6 = False
uuid = network.update_settings_with_ksdata(devname, ndata)
network.update_onboot_value(devname, ndata.onboot, ksdata=None, root_path="")
network.logIfcfgFiles("settings of %s updated in tui" % devname)
if ndata._apply:
self._apply = True
try:
nm.nm_activate_device_connection(devname, uuid)
except (nm.UnmanagedDeviceError, nm.UnknownConnectionError):
self.errors.append(_("Can't apply configuration, device activation failed."))
self.apply()