[gnome-tweaks/wip/muktupavels/none-type] general: fix running Tweaks outside GNOME Shell



commit de0a3902acb10f216b08f649f7e6c0f5ae71ace2
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Oct 16 21:28:57 2018 +0300

    general: fix running Tweaks outside GNOME Shell
    
    Outside GNOME Shell, Tweaks 3.30.1 crashes:
    
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/gtweak/app.py", line 30, in do_activate
        self.win = Window(self, model)
      File "/usr/lib/python3/dist-packages/gtweak/tweakview.py", line 38, in __init__
        self._model.load_tweaks(self)
      File "/usr/lib/python3/dist-packages/gtweak/tweakmodel.py", line 104, in load_tweaks
        mods = __import__("gtweak.tweaks", globals(), locals(), tweak_files, 0)
      File "/usr/lib/python3/dist-packages/gtweak/tweaks/tweak_group_general.py", line 14, in <module>
        _shell_not_ubuntu = _shell.mode != 'ubuntu'
    AttributeError: 'NoneType' object has no attribute 'mode'

 gtweak/tweaks/tweak_group_general.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtweak/tweaks/tweak_group_general.py b/gtweak/tweaks/tweak_group_general.py
index 2124691..11d0867 100644
--- a/gtweak/tweaks/tweak_group_general.py
+++ b/gtweak/tweaks/tweak_group_general.py
@@ -11,7 +11,10 @@ from gtweak.widgets import ListBoxTweakGroup, GetterSetterSwitchTweak, GSettings
 from gtweak.utils import AutostartFile
 
 _shell = GnomeShellFactory().get_shell()
-_shell_not_ubuntu = _shell.mode != 'ubuntu'
+_shell_not_ubuntu = True
+
+if _shell:
+  _shell_not_ubuntu = _shell.mode != 'ubuntu'
 
 class IgnoreLidSwitchTweak(GetterSetterSwitchTweak):
     def __init__(self, **options):


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