From f188c6f71b5fc4024485b005dde2b115199d7368 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 20 Aug 2018 08:14:52 -0400 Subject: [PATCH] [displaymanager] Simplify DE class - The DE isn't being configured, and isn't where the complexity lies. Drop the ABC from it. --- src/modules/displaymanager/main.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index d45913d5c..e8ff86c4c 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -30,13 +30,16 @@ import libcalamares import configparser -class DesktopEnvironment(metaclass=abc.ABCMeta): +class DesktopEnvironment: """ - Desktop Environment base class. A subclass - implements DE maintainence for a specific DE. + Desktop Environment -- some utility functions for a desktop + environment (e.g. finding out if it is installed). This + is independent of the *Display Manager*, which is what + we're configuring in this module. """ - executable = None - desktop_file = None + def __init__(self, exec, desktop): + self.executable = exec + self.desktop_file = desktop def find_desktop_environment(self, root_mount_point): """ @@ -48,16 +51,6 @@ class DesktopEnvironment(metaclass=abc.ABCMeta): os.path.exists("{!s}/usr/share/xsessions/{!s}.desktop".format(root_mount_point, self.desktop_file)) ) - def __init__(self, exec, desktop): - self.executable = exec - self.desktop_file = desktop - -# Collect all the subclasses of DesktopEnvironment defined above, -desktop_environments = [ - c for c in globals().values() - if type(c) is abc.ABCMeta and issubclass(c, DesktopEnvironment) and c.desktop_file -] - desktop_environments = [ DesktopEnvironment('/usr/bin/startkde', 'plasma'), # KDE Plasma 5