[pitivi] ui.prefs: sort preferences by their unlocalized label names; clean up bad labels



commit c80743c32b6c54a3bb6dd5f9325b603eb9647b24
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Fri Apr 17 22:32:58 2009 -0700

    ui.prefs: sort preferences by their unlocalized label names; clean up bad labels
---
 pitivi/ui/prefs.py       |   27 ++++++++++++++++++++-------
 pitivi/ui/trackobject.py |    6 +++---
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/pitivi/ui/prefs.py b/pitivi/ui/prefs.py
index 2b8b3f2..3a324c7 100644
--- a/pitivi/ui/prefs.py
+++ b/pitivi/ui/prefs.py
@@ -263,27 +263,40 @@ class PreferencesDialog(gtk.Window):
 
     def _fillContents(self):
         self.sections = {}
-        for section, options in self.prefs.iteritems():
+        for section in sorted(self.prefs):
+            options = self.prefs[section]
             self.model.append((_(section), section))
             widgets = gtk.Table()
             widgets.set_border_width(6)
             widgets.props.column_spacing = 6
             widgets.props.row_spacing = 3
             self.sections[section] = widgets
-            for y, (attrname, (label, description, klass, args)) in enumerate(
-                options.iteritems()):
-                label = gtk.Label(_(label))
-                label.set_justify(gtk.JUSTIFY_RIGHT)
+
+            prefs = {}
+            for attrname in options:
+                label, description, klass, args = options[attrname]
+                label_widget = gtk.Label(_(label))
                 widget = klass(**args)
-                widgets.attach(label, 0, 1, y, y + 1, xoptions=0, yoptions=0)
-                widgets.attach(widget, 1, 2, y, y + 1, yoptions=0)
                 widget.setWidgetValue(getattr(self.settings, attrname))
                 widget.connectValueChanged(self._valueChanged, widget,
                     attrname)
                 self.widgets[attrname] = widget
+                prefs[label] = (label_widget, widget)
+
+            # Sort widgets: I think we only want to sort by the non-localized
+            # names, so options appear in the same place across locales ...
+            # but then I may be wrong
+
+            for y, unlocalized in enumerate(sorted(prefs)):
+                label, widget = prefs[unlocalized]
+                label.set_alignment(1.0, 0.5)
+                widgets.attach(label, 0, 1, y, y + 1, xoptions=gtk.FILL, yoptions=0)
+                widgets.attach(widget, 1, 2, y, y + 1, yoptions=0)
                 label.show()
                 widget.show()
+
             self.contents.pack_start(widgets, True, True)
+
         self.treeview.get_selection().select_path((0,))
 
     def _treeSelectionChangedCb(self, selection):
diff --git a/pitivi/ui/trackobject.py b/pitivi/ui/trackobject.py
index 64fd484..cc52769 100644
--- a/pitivi/ui/trackobject.py
+++ b/pitivi/ui/trackobject.py
@@ -38,7 +38,7 @@ GlobalSettings.addConfigOption('videoClipBg',
 
 PreferencesDialog.addColorPreference('videoClipBg',
     section = "Appearance",
-    label = "Video Clip Background Color",
+    label = "Clip Background (Video)",
     description = "The background color for clips in video tracks.")
 
 GlobalSettings.addConfigOption('audioClipBg',
@@ -49,7 +49,7 @@ GlobalSettings.addConfigOption('audioClipBg',
 
 PreferencesDialog.addColorPreference('audioClipBg',
     section = "Appearance",
-    label = "Audio Clip Baground Color",
+    label = "Clip Background (Audio)",
     description = "The background color for clips in audio tracks.")
 
 GlobalSettings.addConfigOption('selectedBorderColor',
@@ -60,7 +60,7 @@ GlobalSettings.addConfigOption('selectedBorderColor',
 
 PreferencesDialog.addColorPreference('selectedBorderColor',
     section = "Appearance",
-    label = "Selection Border Color",
+    label = "Clip Selection Border Color",
     description = "The color of the clip's border when it is selected")
 
 GlobalSettings.addConfigOption('clipFontDesc',



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]