[gnome-tweak-tool] More tweak order sorting improvements
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] More tweak order sorting improvements
- Date: Tue, 7 Aug 2012 14:37:31 +0000 (UTC)
commit 8d6d99d635cdb8bc441efe20084deb8ecb3bf1ac
Author: John Stowers <john stowers gmail com>
Date: Tue Aug 7 16:38:10 2012 +0200
More tweak order sorting improvements
gtweak/tweakmodel.py | 4 ++++
gtweak/tweaks/tweak_shell.py | 4 +++-
gtweak/tweakview.py | 4 +++-
3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index b4e82e9..dd40743 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -32,6 +32,9 @@ TWEAK_GROUP_SHELL = _("Shell")
#translate this the same as the name of the file manager (nautilus)
TWEAK_GROUP_FILES = _("Files")
+TWEAK_SORT_FIRST = -1e3
+TWEAK_SORT_LAST = 1e3
+
LOG = logging.getLogger(__name__)
class Tweak:
@@ -40,6 +43,7 @@ class Tweak:
self.description = description
self.group_name = options.get("group_name",_("Miscellaneous"))
self.loaded = True
+ self.widget_sort_hint = None
self._search_cache = None
diff --git a/gtweak/tweaks/tweak_shell.py b/gtweak/tweaks/tweak_shell.py
index daf64bd..6803642 100644
--- a/gtweak/tweaks/tweak_shell.py
+++ b/gtweak/tweaks/tweak_shell.py
@@ -27,7 +27,7 @@ from gi.repository import Gtk, GLib, GObject, Gio
from gtweak.utils import walk_directories, extract_zip_file, make_combo_list_with_default
from gtweak.gsettings import GSettingsSetting, GSettingsMissingError, GSettingsFakeSetting
from gtweak.gshellwrapper import GnomeShellFactory
-from gtweak.tweakmodel import Tweak, TweakGroup, TWEAK_GROUP_THEME, TWEAK_GROUP_SHELL
+from gtweak.tweakmodel import Tweak, TweakGroup, TWEAK_GROUP_THEME, TWEAK_GROUP_SHELL, TWEAK_SORT_LAST
from gtweak.widgets import ZipFileChooserButton, GSettingsComboTweak, GSettingsComboEnumTweak, GSettingsSwitchTweak, build_label_beside_widget, build_horizontal_sizegroup, build_combo_box_text, UI_BOX_SPACING
class ShowWindowButtons(GSettingsComboTweak):
@@ -124,6 +124,8 @@ class ShellThemeTweak(Tweak):
self.widget = build_label_beside_widget(self.name, chooser, cb)
self.widget_for_size_group = cb
+
+ self.widget_sort_hint = TWEAK_SORT_LAST
def _on_file_set(self, chooser):
f = chooser.get_filename()
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index ddf4f5e..6991014 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -24,13 +24,15 @@ import gtweak.tweakmodel
from gtweak.tweakmodel import TweakModel
DEFAULT_TWEAKGROUP = gtweak.tweakmodel.TWEAK_GROUP_SHELL
-WIDGET_SORT_ORDER = (Gtk.Switch, Gtk.SpinButton, Gtk.ComboBox)
+WIDGET_SORT_ORDER = (Gtk.Switch, Gtk.SpinButton, Gtk.ComboBox, Gtk.Box, Gtk.VBox, Gtk.HBox)
def _sort_tweak_widgets_by_widget_type(tweak):
#for appearance tries to make small widgets be packed first, followed by larger widgets,
#followed by widgets of the same type
if not tweak.widget_for_size_group:
return -1
+ if tweak.widget_sort_hint != None:
+ return tweak.widget_sort_hint
try:
return WIDGET_SORT_ORDER.index(type(tweak.widget_for_size_group))
except ValueError:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]