[gnome-tweak-tool/decouple-tweakgroups] Finish port to group_name=



commit d163193e1f13087db450c7e366c06ec41928abe7
Author: John Stowers <john stowers gmail com>
Date:   Sat Aug 6 19:59:39 2011 +1200

    Finish port to group_name=

 gtweak/tweakmodel.py             |    5 +----
 gtweak/tweaks/tweak_font.py      |   18 ++++++++----------
 gtweak/tweaks/tweak_interface.py |   18 ++++++++----------
 gtweak/tweaks/tweak_nautilus.py  |   14 +++++++-------
 gtweak/tweaks/tweak_test.py      |   18 +++++++++---------
 gtweak/tweaks/tweak_windows.py   |   16 +++++++---------
 6 files changed, 40 insertions(+), 49 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index 6fde120..b3f688e 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -34,10 +34,7 @@ class Tweak:
     def __init__(self, name, description, **options):
         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"]
+        self.group_name = options.get("group_name",_("Miscellaneous"))
 
         #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_font.py b/gtweak/tweaks/tweak_font.py
index 9356508..7af313f 100644
--- a/gtweak/tweaks/tweak_font.py
+++ b/gtweak/tweaks/tweak_font.py
@@ -18,18 +18,16 @@
 from gi.repository import Gtk
 
 from gtweak.tweakmodel import Tweak, TWEAK_GROUP_FONTS
-from gtweak.widgets import GSettingsRangeTweak, GSettingsFontButtonTweak, GConfFontButtonTweak, GSettingsComboTweak, build_horizontal_sizegroup
-
-sg = build_horizontal_sizegroup()
+from gtweak.widgets import GSettingsRangeTweak, GSettingsFontButtonTweak, GConfFontButtonTweak, GSettingsComboTweak
 
 TWEAKS = (
-    GSettingsRangeTweak("org.gnome.desktop.interface", "text-scaling-factor", adjustment_step=0.1, size_group=sg),
-    GSettingsFontButtonTweak("org.gnome.desktop.interface", "font-name", size_group=sg),
-    GSettingsFontButtonTweak("org.gnome.desktop.interface", "document-font-name", size_group=sg),
-    GSettingsFontButtonTweak("org.gnome.desktop.interface", "monospace-font-name", size_group=sg),
-    GConfFontButtonTweak("/apps/metacity/general/titlebar_font", str, size_group=sg),
+    GSettingsRangeTweak("org.gnome.desktop.interface", "text-scaling-factor", adjustment_step=0.1, group_name=TWEAK_GROUP_FONTS),
+    GSettingsFontButtonTweak("org.gnome.desktop.interface", "font-name", group_name=TWEAK_GROUP_FONTS),
+    GSettingsFontButtonTweak("org.gnome.desktop.interface", "document-font-name", group_name=TWEAK_GROUP_FONTS),
+    GSettingsFontButtonTweak("org.gnome.desktop.interface", "monospace-font-name", group_name=TWEAK_GROUP_FONTS),
+    GConfFontButtonTweak("/apps/metacity/general/titlebar_font", str, group_name=TWEAK_GROUP_FONTS),
     GSettingsComboTweak("org.gnome.settings-daemon.plugins.xsettings", "hinting",
-        [(i, i.title()) for i in ("none", "slight", "medium", "full")], size_group=sg),
+        [(i, i.title()) for i in ("none", "slight", "medium", "full")], group_name=TWEAK_GROUP_FONTS),
     GSettingsComboTweak("org.gnome.settings-daemon.plugins.xsettings", "antialiasing",
-        [(i, i.title()) for i in ("none", "grayscale", "rgba")], size_group=sg),
+        [(i, i.title()) for i in ("none", "grayscale", "rgba")], group_name=TWEAK_GROUP_FONTS),
 )
diff --git a/gtweak/tweaks/tweak_interface.py b/gtweak/tweaks/tweak_interface.py
index c258fbe..d2034bf 100644
--- a/gtweak/tweaks/tweak_interface.py
+++ b/gtweak/tweaks/tweak_interface.py
@@ -21,8 +21,8 @@ from gi.repository import Gtk
 
 import gtweak
 from gtweak.utils import walk_directories, make_combo_list_with_default
-from gtweak.tweakmodel import TweakGroup
-from gtweak.widgets import GSettingsSwitchTweak, GSettingsComboTweak, build_horizontal_sizegroup
+from gtweak.tweakmodel import TWEAK_GROUP_INTERFACE
+from gtweak.widgets import GSettingsSwitchTweak, GSettingsComboTweak
 
 class GtkThemeSwitcher(GSettingsComboTweak):
     def __init__(self, **options):
@@ -92,13 +92,11 @@ class KeyThemeSwitcher(GSettingsComboTweak):
                     os.path.isfile(os.path.join(d, "gtk-2.0-key", "gtkrc")))
         return valid
 
-sg = build_horizontal_sizegroup()
-
 TWEAKS = (
-    GSettingsSwitchTweak("org.gnome.desktop.interface", "menus-have-icons"),
-    GSettingsSwitchTweak("org.gnome.desktop.interface", "buttons-have-icons"),
-    GtkThemeSwitcher(size_group=sg),
-    KeyThemeSwitcher(size_group=sg),
-    IconThemeSwitcher(size_group=sg),
-    CursorThemeSwitcher(size_group=sg),
+    GSettingsSwitchTweak("org.gnome.desktop.interface", "menus-have-icons", group_name=TWEAK_GROUP_INTERFACE),
+    GSettingsSwitchTweak("org.gnome.desktop.interface", "buttons-have-icons", group_name=TWEAK_GROUP_INTERFACE),
+    GtkThemeSwitcher(group_name=TWEAK_GROUP_INTERFACE),
+    KeyThemeSwitcher(group_name=TWEAK_GROUP_INTERFACE),
+    IconThemeSwitcher(group_name=TWEAK_GROUP_INTERFACE),
+    CursorThemeSwitcher(group_name=TWEAK_GROUP_INTERFACE),
 )
diff --git a/gtweak/tweaks/tweak_nautilus.py b/gtweak/tweaks/tweak_nautilus.py
index 3e34b25..ccbf2c5 100644
--- a/gtweak/tweaks/tweak_nautilus.py
+++ b/gtweak/tweaks/tweak_nautilus.py
@@ -19,7 +19,7 @@ from gi.repository import Gtk
 
 import gtweak
 from gtweak.utils import AutostartManager
-from gtweak.tweakmodel import TweakGroup
+from gtweak.tweakmodel import TWEAK_GROUP_FILE_MANAGER
 from gtweak.widgets import GSettingsSwitchTweak
 
 class DesktopIconTweak(GSettingsSwitchTweak):
@@ -44,10 +44,10 @@ class DesktopIconTweak(GSettingsSwitchTweak):
                 self.settings.get_boolean(key))
 
 TWEAKS = (
-    DesktopIconTweak(),
-    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "computer-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml"),
-    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "home-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml"),
-    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "network-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml"),
-    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "trash-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml"),
-    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "volumes-visible", schema_filename="org.gnome.nautilus.gschema.xml"),
+    DesktopIconTweak(group_name=TWEAK_GROUP_FILE_MANAGER),
+    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "computer-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_FILE_MANAGER),
+    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "home-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_FILE_MANAGER),
+    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "network-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_FILE_MANAGER),
+    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "trash-icon-visible", schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_FILE_MANAGER),
+    GSettingsSwitchTweak("org.gnome.nautilus.desktop", "volumes-visible", schema_filename="org.gnome.nautilus.gschema.xml",group_name=TWEAK_GROUP_FILE_MANAGER),
 )
diff --git a/gtweak/tweaks/tweak_test.py b/gtweak/tweaks/tweak_test.py
index 0cbaf66..77af18d 100644
--- a/gtweak/tweaks/tweak_test.py
+++ b/gtweak/tweaks/tweak_test.py
@@ -59,19 +59,19 @@ class _TestButtonTweak(Tweak):
 
 TWEAK_GROUPS = (
     TweakGroup(
-        "Test Many Settings",
+        "Test Settings Group",
         *[_TestTweak("name: " + str(d), "desc: " + str(d)) for d in range(50)]),
 )
 
-group_name = "Test Foo Bar"
+group_name = "Test Settings"
 
 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),
+    _TestTweak("foo bar", "does foo bar", group_name=group_name),
+    _TestTweak("foo baz", "does foo baz", group_name=group_name),
+    _TestInfoTweak("foo info", "info widget", tweak_info="Information", group_name=group_name),
+    _TestInfoTweak("foo warning", "info widget", tweak_warning="Warning", group_name=group_name),
+    _TestButtonTweak("Need Action", "foo bar", need_action=True, group_name=group_name),
+    _TestButtonTweak("Report Error", "foo baz", action_error=True, group_name=group_name),
+    _TestButtonTweak("Report Info", "foo bob", action_error=False, group_name=group_name),
 )
 
diff --git a/gtweak/tweaks/tweak_windows.py b/gtweak/tweaks/tweak_windows.py
index 1432d09..0a63ccd 100644
--- a/gtweak/tweaks/tweak_windows.py
+++ b/gtweak/tweaks/tweak_windows.py
@@ -19,8 +19,8 @@ import os.path
 
 import gtweak
 from gtweak.utils import walk_directories, make_combo_list_with_default
-from gtweak.tweakmodel import TweakGroup
-from gtweak.widgets import GConfComboTweak, build_horizontal_sizegroup
+from gtweak.tweakmodel import TWEAK_GROUP_WINDOWS, TWEAK_GROUP_INTERFACE
+from gtweak.widgets import GConfComboTweak
 from gtweak.gconf import GConfSetting
 
 class ActionClickTitlebarTweak(GConfComboTweak):
@@ -72,12 +72,10 @@ class WindowThemeSwitcher(GConfComboTweak):
             self.gconf.set_value(value)
             self.gconf_metacity.set_value(value)
 
-sg = build_horizontal_sizegroup()
-
 TWEAKS = (
-    WindowThemeSwitcher(size_group=sg),
-    ActionClickTitlebarTweak("/apps/metacity/general/action_double_click_titlebar", size_group=sg),
-    ActionClickTitlebarTweak("/apps/metacity/general/action_middle_click_titlebar", size_group=sg),
-    ActionClickTitlebarTweak("/apps/metacity/general/action_right_click_titlebar", size_group=sg),
-    FocusModeTweak(size_group=sg),
+    WindowThemeSwitcher(group_name=TWEAK_GROUP_INTERFACE),
+    ActionClickTitlebarTweak("/apps/metacity/general/action_double_click_titlebar", group_name=TWEAK_GROUP_WINDOWS),
+    ActionClickTitlebarTweak("/apps/metacity/general/action_middle_click_titlebar", group_name=TWEAK_GROUP_WINDOWS),
+    ActionClickTitlebarTweak("/apps/metacity/general/action_right_click_titlebar", group_name=TWEAK_GROUP_WINDOWS),
+    FocusModeTweak(group_name=TWEAK_GROUP_WINDOWS),
 )



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