[gnome-tweak-tool/decouple-tweakgroups] Semi-port tweak_test to the new API



commit e73d1440195986fc64615edb4a77c4e831504536
Author: John Stowers <john stowers gmail com>
Date:   Sat Aug 6 11:19:49 2011 +1200

    Semi-port tweak_test to the new API

 gtweak/tweakmodel.py        |    3 +++
 gtweak/tweaks/tweak_test.py |   28 ++++++++++++++++------------
 2 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index 531d45d..6fde120 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -35,6 +35,9 @@ class Tweak:
         self.name = name
         self.description = description
         self.group_name = _("Miscellaneous")
+        if options.has_key("group_name_FIXME"):
+            LOG.warning("Port %s to new group_name API" % self.name)
+            self.group_name = options["group_name_FIXME"]
 
         #FIXME: I would have rather done this as a GObject signal, but it
         #would prohibit other tweaks from inheriting from GtkWidgets
diff --git a/gtweak/tweaks/tweak_test.py b/gtweak/tweaks/tweak_test.py
index 14203ca..0cbaf66 100644
--- a/gtweak/tweaks/tweak_test.py
+++ b/gtweak/tweaks/tweak_test.py
@@ -58,16 +58,20 @@ class _TestButtonTweak(Tweak):
                 self.notify_info(self.name)
 
 TWEAK_GROUPS = (
-        TweakGroup(
-            "Test Foo Bar",
-            _TestTweak("foo bar", "does foo bar"),
-            _TestTweak("foo baz", "does foo baz"),
-            _TestInfoTweak("foo info", "info widget", tweak_info="Information"),
-            _TestInfoTweak("foo warning", "info widget", tweak_warning="Warning"),
-            _TestButtonTweak("Need Action", "foo bar", need_action=True),
-            _TestButtonTweak("Report Error", "foo baz", action_error=True),
-            _TestButtonTweak("Report Info", "foo bob", action_error=False)),
-        TweakGroup(
-            "Test Many Settings",
-            *[_TestTweak("name: " + str(d), "desc: " + str(d)) for d in range(50)]),
+    TweakGroup(
+        "Test Many Settings",
+        *[_TestTweak("name: " + str(d), "desc: " + str(d)) for d in range(50)]),
 )
+
+group_name = "Test Foo Bar"
+
+TWEAKS = (
+    _TestTweak("foo bar", "does foo bar", group_name_FIXME=group_name),
+    _TestTweak("foo baz", "does foo baz", group_name_FIXME=group_name),
+    _TestInfoTweak("foo info", "info widget", tweak_info="Information", group_name_FIXME=group_name),
+    _TestInfoTweak("foo warning", "info widget", tweak_warning="Warning", group_name_FIXME=group_name),
+    _TestButtonTweak("Need Action", "foo bar", need_action=True, group_name_FIXME=group_name),
+    _TestButtonTweak("Report Error", "foo baz", action_error=True, group_name_FIXME=group_name),
+    _TestButtonTweak("Report Info", "foo bob", action_error=False, group_name_FIXME=group_name),
+)
+



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