本文整理汇总了Python中pyanaconda.ui.tui.spokes.NormalTUISpoke类的典型用法代码示例。如果您正苦于以下问题:Python NormalTUISpoke类的具体用法?Python NormalTUISpoke怎么用?Python NormalTUISpoke使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NormalTUISpoke类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh
def refresh(self, args=None):
""" Refresh screen. """
NormalTUISpoke.refresh(self, args)
self._container = ListColumnContainer(1, columns_width=78, spacing=1)
if not self.nm_client:
self.window.add_with_separator(TextWidget(_("Network configuration is not available.")))
return
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 device_configuration in self.editable_configurations:
iface = device_configuration.device_name
text = (_("Configure device %s") % iface)
self._container.add(TextWidget(text), callback=self._ensure_connection_and_configure,
data=iface)
self.window.add_with_separator(self._container)
示例2: __init__
def __init__(self, app, data, storage, payload, instclass):
NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
self._ready = False
self.selected_disks = self.data.ignoredisk.onlyuse[:]
self.selection = None
self.autopart = None
self.clearPartType = None
# This list gets set up once in initialize and should not be modified
# except perhaps to add advanced devices. It will remain the full list
# of disks that can be included in the install.
self.disks = []
self.errors = []
self.warnings = []
if self.data.zerombr.zerombr and arch.isS390():
# if zerombr is specified in a ks file and there are unformatted
# dasds, automatically format them. pass in storage.devicetree here
# instead of storage.disks since mediaPresent is checked on disks;
# a dasd needing dasdfmt will fail this media check though
to_format = storage.devicetree.make_unformatted_dasd_list(getDisks(self.storage.devicetree))
if to_format:
self.run_dasdfmt(to_format)
if not flags.automatedInstall:
# default to using autopart for interactive installs
self.data.autopart.autopart = True
示例3: __init__
def __init__(self, app, data, storage, payload, instclass, roots):
NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
self._root = None
self._roots = roots
# default to selecting the first root in the list
self._selection = 0
示例4: initialize
def initialize(self):
"""
The initialize method that is called after the instance is created.
The difference between __init__ and this method is that this may take
a long time and thus could be called in a separated thread.
:see: pyanaconda.ui.common.UIObject.initialize
"""
# If KickStart provided apply values to spoke
NormalTUISpoke.initialize(self)
self.link = "<URL>"
if self.data.addons.org_centos_cloud.state == "False":
# Addon is Disabled
self.state = False
self.mode = "disabled"
else: # DEFAULT
self.state = True
if (
self.data.addons.org_centos_cloud.arguments == "--allinone"
or self.data.addons.org_centos_cloud.arguments == "none"
):
self.mode = "allinone"
else: # ANSWER FILE
self.link = str(self.data.addons.org_centos_cloud.arguments).replace("--answer-file=", "")
self.mode = "answerfile"
self.data.addons.org_centos_cloud.state = str(self.state)
示例5: 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
self._container = ListColumnContainer(1, spacing=1)
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=disk_info, completed=(disk.name in self.selected_disks))
self._container.add(c, self._update_disk_list_callback, disk)
# if we have more than one disk, present an option to just
# select all disks
if len(self.disks) > 1:
c = CheckboxWidget(title=_("Select all"), completed=self.select_all)
self._container.add(c, self._select_all_disks_callback)
self.window.add_with_separator(self._container)
self.window.add_with_separator(TextWidget(message))
示例6: 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
示例7: 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
示例8: refresh
def refresh(self, args=None):
NormalTUISpoke.refresh(self, args)
threadMgr.wait(THREAD_PAYLOAD)
self._container = ListColumnContainer(1, columns_width=78, spacing=1)
if self.data.method.method == "harddrive" and \
get_mount_device(DRACUT_ISODIR) == get_mount_device(DRACUT_REPODIR):
message = _("The installation source is in use by the installer and cannot be changed.")
self.window.add_with_separator(TextWidget(message))
return
if args == self.SET_NETWORK_INSTALL_MODE:
if self.payload.mirrors_available:
self._container.add(TextWidget(_("Closest mirror")), self._set_network_close_mirror)
self._container.add(TextWidget("http://"), self._set_network_url, SpecifyRepoSpoke.HTTP)
self._container.add(TextWidget("https://"), self._set_network_url, SpecifyRepoSpoke.HTTPS)
self._container.add(TextWidget("ftp://"), self._set_network_url, SpecifyRepoSpoke.FTP)
self._container.add(TextWidget("nfs"), self._set_network_nfs)
else:
self.window.add(TextWidget(_("Choose an installation source type.")))
self._container.add(TextWidget(_("CD/DVD")), self._set_cd_install_source)
self._container.add(TextWidget(_("local ISO file")), self._set_iso_install_source)
self._container.add(TextWidget(_("Network")), self._set_network_install_source)
if self._hmc:
self._container.add(TextWidget(_("SE/HMC")), self._set_hmc_install_source)
self.window.add_with_separator(self._container)
示例9: 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
示例10: refresh
def refresh(self, args=None):
NormalTUISpoke.refresh(self, args)
summary = self._summary_text()
self._window += [TextWidget(summary), ""]
if self.data.timezone.timezone:
timezone_option = _("Change timezone")
else:
timezone_option = _("Set timezone")
_options = [timezone_option, _("Configure NTP servers")]
text = [TextWidget(m) for m in _options]
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)
# gnarl and mangle all of our widgets so things look pretty on screen
choices = [_prep(i, w) for i, w in enumerate(text)]
displayed = ColumnWidget([(78, choices)], 1)
self._window.append(displayed)
return True
示例11: 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(_("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:
size = size_str(disk.size)
c = CheckboxWidget(title="%i) %s: %s (%s)" % (self.disks.index(disk) + 1,
disk.model, size, disk.name),
completed=(disk.name in self.selected_disks))
self._window += [c, ""]
self._window += [TextWidget(message), ""]
return True
示例12: __init__
def __init__(self, data, storage, payload, instclass):
FirstbootSpokeMixIn.__init__(self)
NormalTUISpoke.__init__(self, data, storage, payload, instclass)
self.initialize_start()
self.title = N_("User creation")
self._container = None
if self.data.user.userList:
self._user_data = self.data.user.userList[0]
self._create_user = True
else:
self._user_data = self.data.UserData()
self._create_user = False
self._use_password = self._user_data.isCrypted or self._user_data.password
self._groups = ""
self._is_admin = False
self._policy = self.data.anaconda.pwpolicy.get_policy("user", fallback_to_default=True)
self.errors = []
self._users_module = USERS.get_observer()
self._users_module.connect()
self.initialize_done()
示例13: __init__
def __init__(self, app, data, storage, payload, instclass):
"""
:see: pyanaconda.ui.tui.base.UIScreen
:see: pyanaconda.ui.tui.base.App
:param app: reference to application which is a main class for TUI
screen handling, it is responsible for mainloop control
and keeping track of the stack where all TUI screens are
scheduled
:type app: instance of pyanaconda.ui.tui.base.App
:param data: data object passed to every spoke to load/store data
from/to it
:type data: pykickstart.base.BaseHandler
:param storage: object storing storage-related information
(disks, partitioning, bootloader, etc.)
:type storage: blivet.Blivet
:param payload: object storing packaging-related information
:type payload: pyanaconda.packaging.Payload
:param instclass: distribution-specific information
:type instclass: pyanaconda.installclass.BaseInstallClass
"""
NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
self.done = False
示例14: initialize
def initialize(self):
NormalTUISpoke.initialize(self)
threadMgr.add(AnacondaThread(name=THREAD_STORAGE_WATCHER,
target=self._initialize))
self.selected_disks = self.data.ignoredisk.onlyuse[:]
示例15: 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)