PATCH 1/2 cleans our TUI categories a bit. PATCH 2/2 adds a Shell spoke to s390(x) installations where we cannot run tmux. I think it is a nice way to let users go to the shell and do something. And since it appears only in s390(x) installations, it shouldn't be confusing for people who will enter it. :)
Vratislav Podzimek (2): Put TUI spokes in common categories Add shell spoke to s390x installations
pyanaconda/ui/tui/hubs/summary.py | 2 +- pyanaconda/ui/tui/spokes/network.py | 2 +- pyanaconda/ui/tui/spokes/shell_spoke.py | 65 +++++++++++++++++++++++++++++++++ pyanaconda/ui/tui/spokes/source.py | 6 +-- pyanaconda/ui/tui/spokes/storage.py | 6 +-- 5 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 pyanaconda/ui/tui/spokes/shell_spoke.py
There is no reason to have a special category for every spoke we have.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/tui/hubs/summary.py | 2 +- pyanaconda/ui/tui/spokes/network.py | 2 +- pyanaconda/ui/tui/spokes/source.py | 6 +++--- pyanaconda/ui/tui/spokes/storage.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py index 0bc5911..1318c3c 100644 --- a/pyanaconda/ui/tui/hubs/summary.py +++ b/pyanaconda/ui/tui/hubs/summary.py @@ -29,7 +29,7 @@ import time class SummaryHub(TUIHub): title = _("Installation") ## FIXME: this should be pulling data from somewhere, not just a static list - categories = ["source", "localization", "destination", "password", "software", "network"] + categories = ["localization", "password", "software", "system"]
def setup(self, environment="anaconda"): should_schedule = TUIHub.setup(self, environment=environment) diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py index c07af01..f4b99dc 100644 --- a/pyanaconda/ui/tui/spokes/network.py +++ b/pyanaconda/ui/tui/spokes/network.py @@ -40,7 +40,7 @@ __all__ = ["NetworkSpoke"] class NetworkSpoke(EditTUISpoke): """ Spoke used to configure network settings. """ title = _("Network settings") - category = "network" + category = "system"
def __init__(self, app, data, storage, payload, instclass): EditTUISpoke.__init__(self, app, data, storage, payload, instclass) diff --git a/pyanaconda/ui/tui/spokes/source.py b/pyanaconda/ui/tui/spokes/source.py index de8eac4..25a60c4 100644 --- a/pyanaconda/ui/tui/spokes/source.py +++ b/pyanaconda/ui/tui/spokes/source.py @@ -43,7 +43,7 @@ __all__ = ["SourceSpoke"] class SourceSpoke(EditTUISpoke): """ Spoke used to customize the install source repo. """ title = _("Installation source") - category = "source" + category = "software"
_protocols = (_("Closest mirror"), "http://", "https://", "ftp://", "nfs")
@@ -222,7 +222,7 @@ class SourceSpoke(EditTUISpoke): class SpecifyRepoSpoke(EditTUISpoke): """ Specify the repo URL here if closest mirror not selected. """ title = _("Specify Repo Options") - category = "source" + category = "software"
edit_fields = [ Entry(_("Repo URL"), "url", re.compile(".*$"), True) @@ -257,7 +257,7 @@ class SpecifyRepoSpoke(EditTUISpoke): class SpecifyNFSRepoSpoke(EditTUISpoke): """ Specify server and mount opts here if NFS selected. """ title = _("Specify Repo Options") - category = "source" + category = "software"
edit_fields = [ Entry(_("NFS <server>:/<path>"), "server", re.compile(".*$"), True), diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py index 714c590..30bd3a6 100644 --- a/pyanaconda/ui/tui/spokes/storage.py +++ b/pyanaconda/ui/tui/spokes/storage.py @@ -58,7 +58,7 @@ class StorageSpoke(NormalTUISpoke): as disk selection, partitioning, and fs type. """ title = _("Install Destination") - category = "destination" + category = "system"
def __init__(self, app, data, storage, payload, instclass): NormalTUISpoke.__init__(self, app, data, storage, payload, instclass) @@ -306,7 +306,7 @@ class StorageSpoke(NormalTUISpoke): class AutoPartSpoke(NormalTUISpoke): """ Autopartitioning options are presented here. """ title = _("Autopartitioning Options") - category = "destination" + category = "system"
def __init__(self, app, data, storage, payload, instclass): NormalTUISpoke.__init__(self, app, data, storage, payload, instclass) @@ -372,7 +372,7 @@ class AutoPartSpoke(NormalTUISpoke): class PartitionSchemeSpoke(NormalTUISpoke): """ Spoke to select what partitioning scheme to use on disk(s). """ title = _("Partition Scheme Options") - category = "destination" + category = "system"
# set default FS to LVM, for consistency with graphical behavior _selection = 1
Ack
On 10/08/2013 02:08 PM, Vratislav Podzimek wrote:
There is no reason to have a special category for every spoke we have.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/ui/tui/hubs/summary.py | 2 +- pyanaconda/ui/tui/spokes/network.py | 2 +- pyanaconda/ui/tui/spokes/source.py | 6 +++--- pyanaconda/ui/tui/spokes/storage.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py index 0bc5911..1318c3c 100644 --- a/pyanaconda/ui/tui/hubs/summary.py +++ b/pyanaconda/ui/tui/hubs/summary.py @@ -29,7 +29,7 @@ import time class SummaryHub(TUIHub): title = _("Installation") ## FIXME: this should be pulling data from somewhere, not just a static list
- categories = ["source", "localization", "destination", "password", "software", "network"]
categories = ["localization", "password", "software", "system"]
def setup(self, environment="anaconda"): should_schedule = TUIHub.setup(self, environment=environment)
diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py index c07af01..f4b99dc 100644 --- a/pyanaconda/ui/tui/spokes/network.py +++ b/pyanaconda/ui/tui/spokes/network.py @@ -40,7 +40,7 @@ __all__ = ["NetworkSpoke"] class NetworkSpoke(EditTUISpoke): """ Spoke used to configure network settings. """ title = _("Network settings")
- category = "network"
category = "system"
def __init__(self, app, data, storage, payload, instclass): EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
diff --git a/pyanaconda/ui/tui/spokes/source.py b/pyanaconda/ui/tui/spokes/source.py index de8eac4..25a60c4 100644 --- a/pyanaconda/ui/tui/spokes/source.py +++ b/pyanaconda/ui/tui/spokes/source.py @@ -43,7 +43,7 @@ __all__ = ["SourceSpoke"] class SourceSpoke(EditTUISpoke): """ Spoke used to customize the install source repo. """ title = _("Installation source")
- category = "source"
category = "software"
_protocols = (_("Closest mirror"), "http://", "https://", "ftp://", "nfs")
@@ -222,7 +222,7 @@ class SourceSpoke(EditTUISpoke): class SpecifyRepoSpoke(EditTUISpoke): """ Specify the repo URL here if closest mirror not selected. """ title = _("Specify Repo Options")
- category = "source"
category = "software"
edit_fields = [ Entry(_("Repo URL"), "url", re.compile(".*$"), True)
@@ -257,7 +257,7 @@ class SpecifyRepoSpoke(EditTUISpoke): class SpecifyNFSRepoSpoke(EditTUISpoke): """ Specify server and mount opts here if NFS selected. """ title = _("Specify Repo Options")
- category = "source"
category = "software"
edit_fields = [ Entry(_("NFS <server>:/<path>"), "server", re.compile(".*$"), True),
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py index 714c590..30bd3a6 100644 --- a/pyanaconda/ui/tui/spokes/storage.py +++ b/pyanaconda/ui/tui/spokes/storage.py @@ -58,7 +58,7 @@ class StorageSpoke(NormalTUISpoke): as disk selection, partitioning, and fs type. """ title = _("Install Destination")
- category = "destination"
category = "system"
def __init__(self, app, data, storage, payload, instclass): NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
@@ -306,7 +306,7 @@ class StorageSpoke(NormalTUISpoke): class AutoPartSpoke(NormalTUISpoke): """ Autopartitioning options are presented here. """ title = _("Autopartitioning Options")
- category = "destination"
category = "system"
def __init__(self, app, data, storage, payload, instclass): NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
@@ -372,7 +372,7 @@ class AutoPartSpoke(NormalTUISpoke): class PartitionSchemeSpoke(NormalTUISpoke): """ Spoke to select what partitioning scheme to use on disk(s). """ title = _("Partition Scheme Options")
- category = "destination"
category = "system"
# set default FS to LVM, for consistency with graphical behavior _selection = 1
We cannot run tmux on s390x, so we should give users a different way to enter the shell.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/tui/spokes/shell_spoke.py | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 pyanaconda/ui/tui/spokes/shell_spoke.py
diff --git a/pyanaconda/ui/tui/spokes/shell_spoke.py b/pyanaconda/ui/tui/spokes/shell_spoke.py new file mode 100644 index 0000000..dd9760e --- /dev/null +++ b/pyanaconda/ui/tui/spokes/shell_spoke.py @@ -0,0 +1,65 @@ +# +# Copyright (C) 2013 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Vratislav Podzimek vpodzime@redhat.com +# + +"""Text mode shell spoke""" + +from pyanaconda.ui.tui.spokes import NormalTUISpoke +from pyanaconda.ui.tui.simpleline.widgets import TextWidget +from pyanaconda.i18n import _ +from pyanaconda.constants import ANACONDA_ENVIRON +from blivet import arch + +import os +import subprocess + +class ShellSpoke(NormalTUISpoke): + title = _("Shell") + category = "system" + + @classmethod + def should_run(cls, environment, data): + # run only in the installer on s390(x) machines + return environment == ANACONDA_ENVIRON and arch.isS390() + + @property + def completed(self): + # always completed + return True + + @property + def status(self): + return _("Start shell") + + def apply(self): + # no action needed here + pass + + def refresh(self, args=None): + NormalTUISpoke.refresh(self, args) + + self._window += [TextWidget(_("Exit the shell to continue")), ""] + + def prompt(self, args=None): + # run shell instead of prompt, close window after the prompt and + # suppress the prompt + proc = subprocess.Popen(["bash", "--login"], shell=True, cwd="/") + proc.wait() + self.close() + return None
On Tue, 2013-10-08 at 14:08 +0200, Vratislav Podzimek wrote:
We cannot run tmux on s390x, so we should give users a different way to enter the shell.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/ui/tui/spokes/shell_spoke.py | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 pyanaconda/ui/tui/spokes/shell_spoke.py
diff --git a/pyanaconda/ui/tui/spokes/shell_spoke.py b/pyanaconda/ui/tui/spokes/shell_spoke.py new file mode 100644 index 0000000..dd9760e --- /dev/null +++ b/pyanaconda/ui/tui/spokes/shell_spoke.py @@ -0,0 +1,65 @@ +# +# Copyright (C) 2013 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Vratislav Podzimek vpodzime@redhat.com +#
+"""Text mode shell spoke"""
+from pyanaconda.ui.tui.spokes import NormalTUISpoke +from pyanaconda.ui.tui.simpleline.widgets import TextWidget +from pyanaconda.i18n import _ +from pyanaconda.constants import ANACONDA_ENVIRON +from blivet import arch
+import os
os is not needed anymore (I've replaced os.system() with subprocess.Popen()). Fixed locally.
Looks good to me.
On 10/08/2013 02:08 PM, Vratislav Podzimek wrote:
We cannot run tmux on s390x, so we should give users a different way to enter the shell.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/ui/tui/spokes/shell_spoke.py | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 pyanaconda/ui/tui/spokes/shell_spoke.py
diff --git a/pyanaconda/ui/tui/spokes/shell_spoke.py b/pyanaconda/ui/tui/spokes/shell_spoke.py new file mode 100644 index 0000000..dd9760e --- /dev/null +++ b/pyanaconda/ui/tui/spokes/shell_spoke.py @@ -0,0 +1,65 @@ +# +# Copyright (C) 2013 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Vratislav Podzimek vpodzime@redhat.com +#
+"""Text mode shell spoke"""
+from pyanaconda.ui.tui.spokes import NormalTUISpoke +from pyanaconda.ui.tui.simpleline.widgets import TextWidget +from pyanaconda.i18n import _ +from pyanaconda.constants import ANACONDA_ENVIRON +from blivet import arch
+import os +import subprocess
+class ShellSpoke(NormalTUISpoke):
- title = _("Shell")
- category = "system"
- @classmethod
- def should_run(cls, environment, data):
# run only in the installer on s390(x) machines
return environment == ANACONDA_ENVIRON and arch.isS390()
- @property
- def completed(self):
# always completed
return True
- @property
- def status(self):
return _("Start shell")
- def apply(self):
# no action needed here
pass
- def refresh(self, args=None):
NormalTUISpoke.refresh(self, args)
self._window += [TextWidget(_("Exit the shell to continue")), ""]
- def prompt(self, args=None):
# run shell instead of prompt, close window after the prompt and
# suppress the prompt
proc = subprocess.Popen(["bash", "--login"], shell=True, cwd="/")
proc.wait()
self.close()
return None
PATCH 1/2 cleans our TUI categories a bit. PATCH 2/2 adds a Shell spoke to s390(x) installations where we cannot run tmux. I think it is a nice way to let users go to the shell and do something. And since it appears only in s390(x) installations, it shouldn't be confusing for people who will enter it. :)
Good idea. I'm a little worried about input/output redirection while in this shell, though. Have you encountered any problems when trying to pipe stuff, or redirect to/from files, or anything of that nature?
- Chris
On Tue, 2013-10-08 at 13:59 -0400, Chris Lumens wrote:
PATCH 1/2 cleans our TUI categories a bit. PATCH 2/2 adds a Shell spoke to s390(x) installations where we cannot run tmux. I think it is a nice way to let users go to the shell and do something. And since it appears only in s390(x) installations, it shouldn't be confusing for people who will enter it. :)
Good idea. I'm a little worried about input/output redirection while in this shell, though. Have you encountered any problems when trying to pipe stuff, or redirect to/from files, or anything of that nature?
Nope, I've just tried some things and everything works as in any other shell.
anaconda-patches@lists.fedorahosted.org