[PATCH 1/4] Adapt to unified GUI+TUI categories
Vratislav Podzimek
vpodzime at redhat.com
Tue Jan 6 16:29:27 UTC 2015
Anaconda now uses the same categories for GUI and TUI.
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
org_fedora_hello_world/categories/__init__.py | 1 +
org_fedora_hello_world/categories/hello_world.py | 40 ++++++++++++++++++++++
org_fedora_hello_world/gui/categories/__init__.py | 1 -
.../gui/categories/hello_world.py | 40 ----------------------
org_fedora_hello_world/gui/spokes/hello_world.py | 3 +-
org_fedora_hello_world/tui/spokes/hello_world.py | 10 +++---
6 files changed, 47 insertions(+), 48 deletions(-)
create mode 100644 org_fedora_hello_world/categories/__init__.py
create mode 100644 org_fedora_hello_world/categories/hello_world.py
delete mode 100644 org_fedora_hello_world/gui/categories/__init__.py
delete mode 100644 org_fedora_hello_world/gui/categories/hello_world.py
diff --git a/org_fedora_hello_world/categories/__init__.py b/org_fedora_hello_world/categories/__init__.py
new file mode 100644
index 0000000..0c45a67
--- /dev/null
+++ b/org_fedora_hello_world/categories/__init__.py
@@ -0,0 +1 @@
+import hello_world
diff --git a/org_fedora_hello_world/categories/hello_world.py b/org_fedora_hello_world/categories/hello_world.py
new file mode 100644
index 0000000..8517846
--- /dev/null
+++ b/org_fedora_hello_world/categories/hello_world.py
@@ -0,0 +1,40 @@
+#
+# 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 at redhat.com>
+#
+"""Hello world category module"""
+
+N_ = lambda x: x
+
+from pyanaconda.ui.categories import SpokeCategory
+
+__all__ = ["HelloWorldCategory"]
+
+class HelloWorldCategory(SpokeCategory):
+ """
+ Class for the Hello world category. Category groups related spokes
+ together. Both logically and visually (creates a box on a hub). It
+ references a class of the hub it is supposed to be placed on. On the
+ other hand spokes reference a class of the category they should be
+ included in.
+
+ """
+
+ displayOnHubGUI = "SummaryHub"
+ displayOnHubTUI = "SummaryHub"
+ title = N_("HELLO WORLD")
diff --git a/org_fedora_hello_world/gui/categories/__init__.py b/org_fedora_hello_world/gui/categories/__init__.py
deleted file mode 100644
index 0c45a67..0000000
--- a/org_fedora_hello_world/gui/categories/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-import hello_world
diff --git a/org_fedora_hello_world/gui/categories/hello_world.py b/org_fedora_hello_world/gui/categories/hello_world.py
deleted file mode 100644
index bcfadce..0000000
--- a/org_fedora_hello_world/gui/categories/hello_world.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# 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 at redhat.com>
-#
-"""Hello world category module"""
-
-N_ = lambda x: x
-
-from pyanaconda.ui.gui.categories import SpokeCategory
-from pyanaconda.ui.gui.hubs.summary import SummaryHub
-
-__all__ = ["HelloWorldCategory"]
-
-class HelloWorldCategory(SpokeCategory):
- """
- Class for the Hello world category. Category groups related spokes
- together. Both logically and visually (creates a box on a hub). It
- references a class of the hub it is supposed to be placed on. On the
- other hand spokes reference a class of the category they should be
- included in.
-
- """
-
- displayOnHub = SummaryHub
- title = N_("HELLO WORLD")
diff --git a/org_fedora_hello_world/gui/spokes/hello_world.py b/org_fedora_hello_world/gui/spokes/hello_world.py
index 65c2720..44ebac9 100644
--- a/org_fedora_hello_world/gui/spokes/hello_world.py
+++ b/org_fedora_hello_world/gui/spokes/hello_world.py
@@ -28,10 +28,9 @@ _ = lambda x: x
N_ = lambda x: x
# the path to addons is in sys.path so we can import things from org_fedora_hello_world
-from org_fedora_hello_world.gui.categories.hello_world import HelloWorldCategory
+from org_fedora_hello_world.categories.hello_world import HelloWorldCategory
from pyanaconda.ui.gui import GUIObject
from pyanaconda.ui.gui.spokes import NormalSpoke
-from pyanaconda.ui.gui.utils import enlightbox
from pyanaconda.ui.common import FirstbootSpokeMixIn
# export only the spoke, no helper functions, classes or constants
diff --git a/org_fedora_hello_world/tui/spokes/hello_world.py b/org_fedora_hello_world/tui/spokes/hello_world.py
index 666dc3f..ed48e43 100644
--- a/org_fedora_hello_world/tui/spokes/hello_world.py
+++ b/org_fedora_hello_world/tui/spokes/hello_world.py
@@ -29,6 +29,8 @@ N_ = lambda x: x
import re
+# the path to addons is in sys.path so we can import things from org_fedora_hello_world
+from org_fedora_hello_world.categories.hello_world import HelloWorldCategory
from pyanaconda.ui.tui.spokes import NormalTUISpoke
from pyanaconda.ui.tui.spokes import EditTUISpoke
from pyanaconda.ui.tui.spokes import EditTUISpokeEntry as Entry
@@ -56,10 +58,8 @@ class HelloWorldSpoke(FirstbootSpokeMixIn, NormalTUISpoke):
# title of the spoke
title = N_("Hello World")
- # categories in text mode are simple strings that are not shown anywhere,
- # every hub just has a list of categories it should display spokes from
- # let's just use one of the standard categories defined for the Summary hub
- category = "localization"
+ # category this spoke belongs to
+ category = HelloWorldCategory
def __init__(self, app, data, storage, payload, instclass):
"""
@@ -228,7 +228,7 @@ class HelloWorldEditSpoke(EditTUISpoke):
"""Example class demonstrating usage of EditTUISpoke inheritance"""
title = N_("Hello World Edit")
- category = "localization"
+ category = HelloWorldCategory
# simple RE used to specify we only accept a single word as a valid input
_valid_input = re.compile(r'^\w+$')
--
2.1.0
More information about the anaconda-patches
mailing list