[gnome-tweaks] cleanup: Adjust spacing for pycodestyle compliance



commit 12d55b54e515b0511629e09ee9e108b17cb795af
Author: prakashdanish <grafitykoncept gmail com>
Date:   Sun Oct 7 20:05:42 2018 -0400

    cleanup: Adjust spacing for pycodestyle compliance
    
    pycodestyle is the Python style guide checker
    formerly known as pep8
    
    4 space indents
    2 new lines between top level functions
    1 new line between definitions
    1 space after commas or = or words
    1 space after # introducing a comment
    no space after opening parentheses

 gnome-tweaks            |  3 +-
 gtweak/gsettings.py     |  1 +
 gtweak/gshellwrapper.py |  7 +++--
 gtweak/tweakmodel.py    | 11 ++++---
 gtweak/tweakview.py     |  9 +++---
 gtweak/utils.py         | 49 ++++++++++++++++++++---------
 gtweak/widgets.py       | 82 ++++++++++++++++++++++++++++++-------------------
 7 files changed, 103 insertions(+), 59 deletions(-)
---
diff --git a/gnome-tweaks b/gnome-tweaks
index e90cf2a..0133d9b 100755
--- a/gnome-tweaks
+++ b/gnome-tweaks
@@ -16,6 +16,7 @@ gi.require_version("Gtk", "3.0")
 import gtweak
 from gtweak.defs import VERSION
 
+
 if __name__ == '__main__':
     parser = optparse.OptionParser(version=VERSION)
     parser.add_option("-t", "--test", action="store_true",
@@ -37,7 +38,7 @@ if __name__ == '__main__':
         _defs_present = True
     except ImportError:
         GSETTINGS_SCHEMA_DIR = TWEAK_DIR = DATA_DIR = PKG_DATA_DIR = \
-                               LOCALE_DIR  = LIBEXEC_DIR = ""
+                               LOCALE_DIR = LIBEXEC_DIR = ""
         _defs_present = False
 
     # the supplied prefix always beats the contents of defs
diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py
index e0116e9..bcda918 100644
--- a/gtweak/gsettings.py
+++ b/gtweak/gsettings.py
@@ -185,6 +185,7 @@ class GSettingsSetting(Gio.Settings):
         assert self._setting_check_is_list(key)
         return value in self[key]
 
+
 if __name__ == "__main__":
     gtweak.GSETTINGS_SCHEMA_DIR = "/usr/share/glib-2.0/schemas/"
 
diff --git a/gtweak/gshellwrapper.py b/gtweak/gshellwrapper.py
index 0e4a49b..1673657 100644
--- a/gtweak/gshellwrapper.py
+++ b/gtweak/gshellwrapper.py
@@ -113,6 +113,7 @@ class GnomeShell:
     def version(self):
         return self._proxy.version
 
+
 class GnomeShell32(GnomeShell):
 
     EXTENSION_ENABLED_KEY = "enabled-extensions"
@@ -131,6 +132,7 @@ class GnomeShell32(GnomeShell):
     def disable_extension(self, uuid):
         self._settings.setting_remove_from_list(self.EXTENSION_ENABLED_KEY, uuid)
 
+
 class GnomeShell34(GnomeShell32):
 
     SUPPORTS_EXTENSION_PREFS = True
@@ -168,9 +170,9 @@ class GnomeShellFactory:
 
             if v >= [3, 5, 0]:
                 self.shell = GnomeShell36(proxy, settings)
-            elif v >= [3,3,2]:
+            elif v >= [3, 3, 2]:
                 self.shell = GnomeShell34(proxy, settings)
-            elif v >= [3,1,4]:
+            elif v >= [3, 1, 4]:
                 self.shell = GnomeShell32(proxy, settings)
 
             else:
@@ -185,6 +187,7 @@ class GnomeShellFactory:
     def get_shell(self):
         return self.shell
 
+
 if __name__ == "__main__":
     gtweak.GSETTINGS_SCHEMA_DIR = "/usr/share/glib-2.0/schemas/"
 
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index 2e9fb16..7c52e46 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -17,6 +17,7 @@ LOG = logging.getLogger(__name__)
 def string_for_search(s):
     return GLib.utf8_casefold(GLib.utf8_normalize(s, -1, GLib.NormalizeMode.ALL), -1)
 
+
 class Tweak(object):
 
     main_window = None
@@ -27,7 +28,7 @@ class Tweak(object):
         self.name = name or ""
         self.description = description or ""
         self.uid = options.get("uid", self.__class__.__name__)
-        self.group_name = options.get("group_name",_("Miscellaneous"))
+        self.group_name = options.get("group_name", _("Miscellaneous"))
         self.loaded = options.get("loaded", True)
         self.widget_sort_hint = None
 
@@ -41,7 +42,7 @@ class Tweak(object):
                 self._search_cache += " " + string_for_search(self.extra_info)
             except:
                 LOG.warning("Error adding search info", exc_info=True)
-        return  txt in self._search_cache
+        return txt in self._search_cache
 
     def notify_logout(self):
         self._logoutnotification = LogoutNotification()
@@ -49,6 +50,7 @@ class Tweak(object):
     def notify_information(self, summary, desc=""):
         self._notification = Notification(summary, desc)
 
+
 class TweakGroup(object):
 
     main_window = None
@@ -64,6 +66,7 @@ class TweakGroup(object):
             self.tweaks.append(tweak)
             return True
 
+
 class TweakModel(Gtk.ListStore):
     (COLUMN_NAME,
      COLUMN_TWEAK) = list(range(2))
@@ -103,7 +106,7 @@ class TweakModel(Gtk.ListStore):
 
         mods = __import__("gtweak.tweaks", globals(), locals(), tweak_files, 0)
         for mod in [getattr(mods, file_name) for file_name in tweak_files]:
-            groups.extend( getattr(mod, "TWEAK_GROUPS", []) )
+            groups.extend( getattr(mod, "TWEAK_GROUPS", []))
 
         schemas = SchemaList()
 
@@ -132,7 +135,7 @@ class TweakModel(Gtk.ListStore):
         groups = []
 
         for g in self.tweak_groups:
-            for t in  g.tweaks:
+            for t in g.tweaks:
                 if t.search_matches(txt):
                     tweaks.append(t)
                     if not g.name in groups:
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index f54b7da..99abd75 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -92,7 +92,6 @@ class Window(Gtk.ApplicationWindow):
 
         return header
 
-
     def sidebar(self):
         left_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
 
@@ -247,10 +246,10 @@ class Window(Gtk.ApplicationWindow):
                 self._right_header.pack_end(self._group_titlebar_widget)
 
     def _on_find_toggled(self, btn):
-         if self.searchbar.get_search_mode():
-             self.searchbar.set_search_mode(False)
-             self.entry.set_text("")
-         else:
+        if self.searchbar.get_search_mode():
+            self.searchbar.set_search_mode(False)
+            self.entry.set_text("")
+        else:
             self.searchbar.set_search_mode(True)
             self.entry.grab_focus()
 
diff --git a/gtweak/utils.py b/gtweak/utils.py
index 17f2f9f..07b7ab9 100644
--- a/gtweak/utils.py
+++ b/gtweak/utils.py
@@ -19,6 +19,7 @@ from gi.repository import Notify
 
 import gtweak
 
+
 def singleton(cls):
     """
     Singleton decorator that works with GObject derived types. The 'recommended'
@@ -26,12 +27,14 @@ def singleton(cls):
     does not (interacts badly with GObjectMeta
     """
     instances = {}
+
     def getinstance():
         if cls not in instances:
             instances[cls] = cls()
         return instances[cls]
     return getinstance
 
+
 def make_combo_list_with_default(opts, default, title=True, default_text=None):
     """
     Turns a list of values into a list of value,name (where name is the
@@ -45,8 +48,8 @@ def make_combo_list_with_default(opts, default, title=True, default_text=None):
     themes = []
     for t in opts:
         if t.lower() == "default" and t != default:
-            #some themes etc are actually called default. Ick. Dont show them if they
-            #are not the actual default value
+            # some themes etc are actually called default. Ick. Dont show them if they
+            # are not the actual default value
             continue
 
         if title and len(t):
@@ -55,12 +58,13 @@ def make_combo_list_with_default(opts, default, title=True, default_text=None):
             name = t
 
         if t == default:
-            #indicates the default theme, e.g Adwaita (default)
+            # indicates the default theme, e.g Adwaita (default)
             name = default_text or _("%s <i>(default)</i>") % name
 
         themes.append((t, name))
     return themes
 
+
 def walk_directories(dirs, filter_func):
     valid = []
     try:
@@ -68,11 +72,12 @@ def walk_directories(dirs, filter_func):
             if os.path.isdir(thdir):
                 for t in os.listdir(thdir):
                     if filter_func(os.path.join(thdir, t)):
-                         valid.append(t)
+                        valid.append(t)
     except:
         logging.critical("Error parsing directories", exc_info=True)
     return valid
 
+
 def extract_zip_file(z, members_path, dest):
     """ returns (true_if_extracted_ok, true_if_updated) """
     tmp = tempfile.mkdtemp()
@@ -95,6 +100,7 @@ def extract_zip_file(z, members_path, dest):
 
     return ok, updated
 
+
 def execute_subprocess(cmd_then_args, block=True):
     p = subprocess.Popen(
             cmd_then_args,
@@ -104,6 +110,7 @@ def execute_subprocess(cmd_then_args, block=True):
         stdout, stderr = p.communicate()
         return stdout, stderr, p.returncode
 
+
 def get_resource_dirs(resource):
     """Returns a list of all known resource dirs for a given resource.
 
@@ -120,6 +127,7 @@ def get_resource_dirs(resource):
 
     return [dir for dir in dirs if os.path.isdir(dir)]
 
+
 @singleton
 class AutostartManager:
 
@@ -137,9 +145,10 @@ class AutostartManager:
     def get_system_autostart_files():
         f = []
         for d in GLib.get_system_config_dirs():
-            f.extend( glob.glob(os.path.join(d, "autostart", "*.desktop")) )
+            f.extend(glob.glob(os.path.join(d, "autostart", "*.desktop")))
         return f
 
+
 class AutostartFile:
     def __init__(self, appinfo, autostart_desktop_filename="", exec_cmd="", extra_exec_args=""):
         if appinfo:
@@ -176,13 +185,13 @@ class AutostartFile:
 
     def is_start_at_login_enabled(self):
         if os.path.exists(self._user_autostart_file):
-            #prefer user directories first
-            #if it contains X-GNOME-Autostart-enabled=false then it has
-            #has been disabled by the user in the session applet, otherwise
-            #it is enabled
+            # prefer user directories first
+            # if it contains X-GNOME-Autostart-enabled=false then it has
+            # has been disabled by the user in the session applet, otherwise
+            # it is enabled
             return open(self._user_autostart_file).read().find("X-GNOME-Autostart-enabled=false") == -1
         else:
-            #check the system directories
+            # check the system directories
             for f in AutostartManager().get_system_autostart_files():
                 if os.path.basename(f) == self._autostart_desktop_filename:
                     return True
@@ -220,6 +229,7 @@ class AutostartFile:
             old.close()
             new.close()
 
+
 class SchemaList:
 
     __list = None
@@ -240,6 +250,7 @@ class SchemaList:
         for i in SchemaList.__list:
             s = Gio.Settings(i[1])
             s.reset(i[0])
+
 @singleton
 class DisableExtension(GObject.GObject):
 
@@ -253,6 +264,7 @@ class DisableExtension(GObject.GObject):
     def disable(self):
         self.emit("disable-extension")
 
+
 @singleton
 class XSettingsOverrides:
 
@@ -270,7 +282,7 @@ class XSettingsOverrides:
         items = {}
         for k in list(self._variant.keys()):
             try:
-                #variant override doesnt support .items()
+                # variant override doesnt support .items()
                 v = self._variant[k]
                 items[k] = self.VARIANT_TYPES[k](v)
             except KeyError:
@@ -293,22 +305,28 @@ class XSettingsOverrides:
         except KeyError:
             return default
 
-    #while I could store meta type information in the VARIANT_TYPES
-    #dict, its easiest to do default value handling and missing value
-    #checks in dedicated functions
+    # while I could store meta type information in the VARIANT_TYPES
+    # dict, its easiest to do default value handling and missing value
+    # checks in dedicated functions
     def set_shell_shows_app_menu(self, v):
         self._set_override('Gtk/ShellShowsAppMenu', int(v))
+
     def get_shell_shows_app_menu(self):
         return self._get_override('Gtk/ShellShowsAppMenu', True)
+
     def set_enable_primary_paste(self, v):
         self._set_override('Gtk/EnablePrimaryPaste', int(v))
+
     def get_enable_primary_paste(self):
         return self._get_override('Gtk/EnablePrimaryPaste', True)
+
     def set_window_scaling_factor(self, v):
         self._set_override('Gdk/WindowScalingFactor', int(v))
+
     def get_window_scaling_factor(self):
         return self._get_override('Gdk/WindowScalingFactor', 1)
 
+
 class Notification:
     def __init__(self, summary, body):
         if Notify.is_initted() or Notify.init(_("GNOME Tweaks")):
@@ -324,6 +342,7 @@ class Notification:
         else:
             raise Exception("Not Supported")
 
+
 @singleton
 class LogoutNotification:
     def __init__(self):
@@ -346,7 +365,7 @@ class LogoutNotification:
     def _logout(self, btn, action, user_data, unknown):
         d = Gio.bus_get_sync(Gio.BusType.SESSION, None)
         proxy = Gio.DBusProxy.new_sync(
-                       d,Gio.DBusProxyFlags.NONE, None,
+                       d, Gio.DBusProxyFlags.NONE, None,
                        'org.gnome.SessionManager',
                        '/org/gnome/SessionManager',
                        'org.gnome.SessionManager',
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
index c8ab6f5..703ff54 100644
--- a/gtweak/widgets.py
+++ b/gtweak/widgets.py
@@ -13,6 +13,7 @@ from gtweak.gshellwrapper import GnomeShellFactory
 UI_BOX_SPACING = 4
 _shell = GnomeShellFactory().get_shell()
 
+
 def build_label_beside_widget(txt, *widget, **kwargs):
     """
     Builds a HBox containing widgets.
@@ -60,13 +61,14 @@ def build_label_beside_widget(txt, *widget, **kwargs):
     for w in widget:
         hbox.pack_start(w, False, False, 0)
 
-    #For Atk, indicate that the rightmost widget, usually the switch relates to the
-    #label. By convention this is true in the great majority of cases. Settings that
-    #construct their own widgets will need to set this themselves
+    # For Atk, indicate that the rightmost widget, usually the switch relates to the
+    # label. By convention this is true in the great majority of cases. Settings that
+    # construct their own widgets will need to set this themselves
     lbl.set_mnemonic_widget(widget[-1])
 
     return hbox
 
+
 def build_combo_box_text(selected, *values):
     """
     builds a GtkComboBox and model containing the supplied values.
@@ -77,7 +79,7 @@ def build_combo_box_text(selected, *values):
 
     selected_iter = None
     for (val, name) in values:
-        _iter = store.append( (val, name) )
+        _iter = store.append((val, name))
         if val == selected:
             selected_iter = _iter
 
@@ -90,24 +92,26 @@ def build_combo_box_text(selected, *values):
 
     return combo
 
+
 def build_horizontal_sizegroup():
     sg = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
     sg.props.ignore_hidden = True
     return sg
 
+
 def build_tight_button(stock_id):
     button = Gtk.Button()
     button.set_relief(Gtk.ReliefStyle.NONE)
     button.set_focus_on_click(False)
     button.add(Gtk.Image.new_from_stock(stock_id, Gtk.IconSize.MENU))
-    data =  ".button {\n" \
-            "-GtkButton-default-border : 0px;\n" \
-            "-GtkButton-default-outside-border : 0px;\n" \
-            "-GtkButton-inner-border: 0px;\n" \
-            "-GtkWidget-focus-line-width : 0px;\n" \
-            "-GtkWidget-focus-padding : 0px;\n" \
-            "padding: 0px;\n" \
-            "}"
+    data = ".button {\n" \
+           "-GtkButton-default-border : 0px;\n" \
+           "-GtkButton-default-outside-border : 0px;\n" \
+           "-GtkButton-inner-border: 0px;\n" \
+           "-GtkWidget-focus-line-width : 0px;\n" \
+           "-GtkWidget-focus-padding : 0px;\n" \
+           "padding: 0px;\n" \
+           "}"
     provider = Gtk.CssProvider()
     provider.load_from_data(data)
     # 600 = GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
@@ -130,12 +134,12 @@ class _GSettingsTweak(Tweak):
                 **options)
         except GSettingsMissingError as e:
             self.settings = GSettingsFakeSetting()
-            Tweak.__init__(self,"","")
+            Tweak.__init__(self, "", "")
             self.loaded = False
             logging.info("GSetting missing %s", e)
         except KeyError:
             self.settings = GSettingsFakeSetting()
-            Tweak.__init__(self,"","")
+            Tweak.__init__(self, "", "")
             self.loaded = False
             logging.info("GSettings missing key %s (key %s)" % (schema_name, key_name))
 
@@ -151,13 +155,14 @@ class _GSettingsTweak(Tweak):
             self._extra_info = self.settings.schema_get_summary(self.key_name)
         return self._extra_info
 
+
 class _DependableMixin(object):
 
     def add_dependency_on_tweak(self, depends, depends_how):
         if isinstance(depends, Tweak):
             self._depends = depends
             if depends_how is None:
-                depends_how = lambda x,kn: x.get_boolean(kn)
+                depends_how = lambda x, kn: x.get_boolean(kn)
             self._depends_how = depends_how
 
             sensitive = self._depends_how(
@@ -169,9 +174,10 @@ class _DependableMixin(object):
             depends.settings.connect("changed::%s" % depends.key_name, self._on_changed_depend)
 
     def _on_changed_depend(self, settings, key_name):
-        sensitive = self._depends_how(settings,key_name)
+        sensitive = self._depends_how(settings, key_name)
         self.set_sensitive(sensitive)
 
+
 class ListBoxTweakGroup(Gtk.ListBox, TweakGroup):
     def __init__(self, name, *tweaks, **options):
         if 'uid' not in options:
@@ -184,7 +190,7 @@ class ListBoxTweakGroup(Gtk.ListBox, TweakGroup):
                         selection_mode=Gtk.SelectionMode.NONE,
                         name=options['uid'])
         self.get_style_context().add_class(
-                        options.get('css_class','tweak-group'))
+                        options.get('css_class', 'tweak-group'))
         self.props.margin = 20
         self.props.vexpand = False
         self.props.valign = Gtk.Align.START
@@ -197,8 +203,8 @@ class ListBoxTweakGroup(Gtk.ListBox, TweakGroup):
         for t in tweaks:
             self.add_tweak_row(t, activatable)
 
-    #FIXME: need to add remove_tweak_row and remove_tweak (which clears
-    #the search cache etc)
+    # FIXME: need to add remove_tweak_row and remove_tweak (which clears
+    # the search cache etc)
 
     def add_tweak_row(self, t, activatable=False, position=None):
         if self.add_tweak(t):
@@ -219,6 +225,7 @@ class ListBoxTweakGroup(Gtk.ListBox, TweakGroup):
                 self._sg.add_widget(t.widget_for_size_group)
             return row
 
+
 class GSettingsCheckTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     def __init__(self, name, schema_name, key_name, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
@@ -237,6 +244,7 @@ class GSettingsCheckTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
                 options.get("depends_how")
         )
 
+
 class GSettingsSwitchTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     def __init__(self, name, schema_name, key_name, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
@@ -277,6 +285,7 @@ class GSettingsSwitchTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
         self.pack_start(vbox2, False, False, 0)
         self.widget_for_size_group = None
 
+
 class GSettingsFontButtonTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     def __init__(self, name, schema_name, key_name, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
@@ -288,12 +297,13 @@ class GSettingsFontButtonTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
         build_label_beside_widget(name, w, hbox=self)
         self.widget_for_size_group = w
 
+
 class GSettingsRangeTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     def __init__(self, name, schema_name, key_name, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
         _GSettingsTweak.__init__(self, name, schema_name, key_name, **options)
 
-        #returned variant is range:(min, max)
+        # returned variant is range:(min, max)
         _min, _max = self.settings.get_range(key_name)[1]
 
         w = Gtk.HScale.new_with_range(_min, _max, options.get('adjustment_step', 1))
@@ -302,12 +312,13 @@ class GSettingsRangeTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
         build_label_beside_widget(self.name, w, hbox=self)
         self.widget_for_size_group = w
 
+
 class GSettingsSpinButtonTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     def __init__(self, name, schema_name, key_name, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
         _GSettingsTweak.__init__(self, name, schema_name, key_name, **options)
 
-        #returned variant is range:(min, max)
+        # returned variant is range:(min, max)
         _min, _max = self.settings.get_range(key_name)[1]
 
         adjustment = Gtk.Adjustment(value=0, lower=_min, upper=_max, 
step_increment=options.get('adjustment_step', 1))
@@ -324,6 +335,7 @@ class GSettingsSpinButtonTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
                 options.get("depends_how")
         )
 
+
 class GSettingsComboEnumTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     def __init__(self, name, schema_name, key_name, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
@@ -333,7 +345,7 @@ class GSettingsComboEnumTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
         value = self.settings.get_string(key_name)
         self.settings.connect('changed::'+self.key_name, self._on_setting_changed)
 
-        w = build_combo_box_text(value, *[(v,v.replace("-"," ").title()) for v in values])
+        w = build_combo_box_text(value, *[(v, v.replace("-", " ").title()) for v in values])
         w.connect('changed', self._on_combo_changed)
         self.combo = w
 
@@ -341,8 +353,8 @@ class GSettingsComboEnumTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
         self.widget_for_size_group = w
 
     def _values_are_different(self):
-        #to stop bouncing back and forth between changed signals. I suspect there must be a nicer
-        #Gio.settings_bind way to fix this
+        # to stop bouncing back and forth between changed signals. I suspect there must be a nicer
+        # Gio.settings_bind way to fix this
         return self.settings.get_string(self.key_name) != \
                self.combo.get_model().get_value(self.combo.get_active_iter(), 0)
 
@@ -360,13 +372,14 @@ class GSettingsComboEnumTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
         if self._values_are_different():
             self.settings.set_string(self.key_name, val)
 
+
 class GSettingsComboTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     def __init__(self, name, schema_name, key_name, key_options, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
         _GSettingsTweak.__init__(self, name, schema_name, key_name, **options)
 
-        #check key_options is iterable
-        #and if supplied, check it is a list of 2-tuples
+        # check key_options is iterable
+        # and if supplied, check it is a list of 2-tuples
         assert len(key_options) >= 0
         if len(key_options):
             assert len(key_options[0]) == 2
@@ -378,7 +391,7 @@ class GSettingsComboTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
         self.combo.connect('changed', self._on_combo_changed)
         self.settings.connect('changed::'+self.key_name, self._on_setting_changed)
 
-        build_label_beside_widget(name, self.combo,hbox=self)
+        build_label_beside_widget(name, self.combo, hbox=self)
         self.widget_for_size_group = self.combo
 
     def _on_setting_changed(self, setting, key):
@@ -401,10 +414,11 @@ class GSettingsComboTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     @property
     def extra_info(self):
         if self._extra_info is None:
-           self._extra_info = self.settings.schema_get_summary(self.key_name)
-           self._extra_info += " " + " ".join(op[0] for op in self._key_options)
+            self._extra_info = self.settings.schema_get_summary(self.key_name)
+            self._extra_info += " " + " ".join(op[0] for op in self._key_options)
         return self._extra_info
 
+
 class FileChooserButton(Gtk.FileChooserButton):
     def __init__(self, title, local_only, mimetypes):
         Gtk.FileChooserButton.__init__(self, title=title)
@@ -415,10 +429,11 @@ class FileChooserButton(Gtk.FileChooserButton):
                 f.add_mime_type(m)
             self.set_filter(f)
 
-        #self.set_width_chars(15)
+        # self.set_width_chars(15)
         self.set_local_only(local_only)
         self.set_action(Gtk.FileChooserAction.OPEN)
 
+
 class GSettingsFileChooserButtonTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
     def __init__(self, name, schema_name, key_name, local_only, mimetypes, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
@@ -426,7 +441,7 @@ class GSettingsFileChooserButtonTweak(Gtk.Box, _GSettingsTweak, _DependableMixin
 
         self.settings.connect('changed::'+self.key_name, self._on_setting_changed)
 
-        self.filechooser = FileChooserButton(name,local_only,mimetypes)
+        self.filechooser = FileChooserButton(name, local_only, mimetypes)
         self.filechooser.set_uri(self.settings.get_string(self.key_name))
         self.filechooser.connect("file-set", self._on_file_set)
 
@@ -444,10 +459,11 @@ class GSettingsFileChooserButtonTweak(Gtk.Box, _GSettingsTweak, _DependableMixin
         if uri and self._values_are_different():
             self.settings.set_string(self.key_name, uri)
 
+
 class GetterSetterSwitchTweak(Gtk.Box, Tweak):
     def __init__(self, name, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
-        Tweak.__init__(self, name, options.get("description",""), **options)
+        Tweak.__init__(self, name, options.get("description", ""), **options)
 
         sw = Gtk.Switch()
         sw.set_active(self.get_active())
@@ -464,6 +480,7 @@ class GetterSetterSwitchTweak(Gtk.Box, Tweak):
     def set_active(self, v):
         raise NotImplementedError()
 
+
 class Title(Gtk.Box, Tweak):
     def __init__(self, name, desc, **options):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
@@ -475,6 +492,7 @@ class Title(Gtk.Box, Tweak):
             widget.set_margin_top(10)
         self.add(widget)
 
+
 class GSettingsSwitchTweakValue(Gtk.Box, _GSettingsTweak):
 
     def __init__(self, name, schema_name, key_name, **options):


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