summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2013-01-23 15:29:26 -0500
committerChris Lumens <clumens@redhat.com>2013-01-24 11:19:05 -0500
commite5e72c4ff069c04c551172c7dc9ccc7f2ecfc8dd (patch)
tree987a9727e9196d4ddca26592798ce21bdf299882
parent7ddd91d16396ec2b7714701efb41570a712756e0 (diff)
downloadanaconda-e5e72c4ff069c04c551172c7dc9ccc7f2ecfc8dd.tar.gz
anaconda-e5e72c4ff069c04c551172c7dc9ccc7f2ecfc8dd.tar.xz
anaconda-e5e72c4ff069c04c551172c7dc9ccc7f2ecfc8dd.zip
Use only one large grid for the hubs.
This makes the spoke selectors on rows by theirselves much smaller. They no longer extend all the way to the right edge of the screen.
-rw-r--r--pyanaconda/ui/gui/categories/__init__.py29
-rw-r--r--pyanaconda/ui/gui/hubs/__init__.py36
2 files changed, 27 insertions, 38 deletions
diff --git a/pyanaconda/ui/gui/categories/__init__.py b/pyanaconda/ui/gui/categories/__init__.py
index 14dc2a0c0..7a75e5cc8 100644
--- a/pyanaconda/ui/gui/categories/__init__.py
+++ b/pyanaconda/ui/gui/categories/__init__.py
@@ -43,34 +43,6 @@ class SpokeCategory(object):
displayOnHub = None
title = N_("DEFAULT TITLE")
- def grid(self, selectors):
- """Construct a Gtk.Grid consisting of two columns from the provided
- list of selectors.
- """
- from gi.repository import Gtk
-
- if len(selectors) == 0:
- return None
-
- row = 0
- col = 0
-
- g = Gtk.Grid()
- g.set_row_homogeneous(True)
- g.set_column_homogeneous(True)
- g.set_row_spacing(6)
- g.set_column_spacing(6)
- g.set_margin_bottom(12)
-
- for selector in selectors:
- g.attach(selector, col, row, 1, 1)
-
- col = int(not col)
- if col == 0:
- row += 1
-
- return g
-
def collect_categories(mask_paths):
"""Return a list of all category subclasses. Look for them in modules
imported as module_mask % basename(f) where f is name of all files in path.
@@ -80,4 +52,3 @@ def collect_categories(mask_paths):
categories.extend(collect(mask, path, lambda obj: getattr(obj, "displayOnHub", None) != None))
return categories
-
diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
index b704fa81d..39e8705f5 100644
--- a/pyanaconda/ui/gui/hubs/__init__.py
+++ b/pyanaconda/ui/gui/hubs/__init__.py
@@ -132,15 +132,21 @@ class Hub(GUIObject, common.Hub):
ret[c] = collect_spokes(self.paths["spokes"], c.__name__)
return ret
-
+
def _createBox(self):
from gi.repository import Gtk, AnacondaWidgets
from pyanaconda.ui.gui.utils import setViewportBackground
cats_and_spokes = self._collectCategoriesAndSpokes()
categories = cats_and_spokes.keys()
-
- box = Gtk.VBox(False, 6)
+
+ grid = Gtk.Grid()
+ grid.set_row_spacing(6)
+ grid.set_column_spacing(6)
+ grid.set_column_homogeneous(True)
+ grid.set_margin_bottom(12)
+
+ row = 0
for c in sorted(categories, key=lambda c: c.title):
obj = c()
@@ -206,16 +212,28 @@ class Hub(GUIObject, common.Hub):
label = Gtk.Label("<span font-desc=\"Sans 14\">%s</span>" % _(obj.title))
label.set_use_markup(True)
label.set_halign(Gtk.Align.START)
+ label.set_margin_top(12)
label.set_margin_bottom(12)
- box.pack_start(label, False, True, 0)
-
- grid = obj.grid(selectors)
- grid.set_margin_left(12)
- box.pack_start(grid, False, True, 0)
+ grid.attach(label, 0, row, 2, 1)
+ row += 1
+
+ col = 0
+ for selector in selectors:
+ selector.set_margin_left(12)
+ grid.attach(selector, col, row, 1, 1)
+ col = int(not col)
+ if col == 0:
+ row += 1
+
+ # If this category contains an odd number of selectors, the above
+ # row += 1 will not have run for the last row, which puts the next
+ # category's title in the wrong place.
+ if len(selectors) % 2:
+ row += 1
spokeArea = self.window.get_spoke_area()
viewport = Gtk.Viewport()
- viewport.add(box)
+ viewport.add(grid)
spokeArea.add(viewport)
setViewportBackground(viewport)