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. --- pyanaconda/ui/gui/categories/__init__.py | 29 ------------------------- pyanaconda/ui/gui/hubs/__init__.py | 36 ++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 38 deletions(-)
diff --git a/pyanaconda/ui/gui/categories/__init__.py b/pyanaconda/ui/gui/categories/__init__.py index 14dc2a0..7a75e5c 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 1f5141a..510c624 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)
On Wed, 2013-01-23 at 15:30 -0500, Chris Lumens wrote:
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.
pyanaconda/ui/gui/categories/__init__.py | 29 ------------------------- pyanaconda/ui/gui/hubs/__init__.py | 36 ++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 38 deletions(-)
ACK.
anaconda-patches@lists.fedorahosted.org