diff options
author | B Stack <bgstack15@gmail.com> | 2020-04-01 17:07:54 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-04-02 09:06:38 -0400 |
commit | 3d0911850e5afa7b0f631b6c06dc2caefc38a15d (patch) | |
tree | b80190c7e6bd5bd6e2a96fd4828910aa22b1be1d | |
parent | move debian/ to stackrpms (diff) | |
download | logout-manager-3d0911850e5afa7b0f631b6c06dc2caefc38a15d.tar.gz logout-manager-3d0911850e5afa7b0f631b6c06dc2caefc38a15d.tar.bz2 logout-manager-3d0911850e5afa7b0f631b6c06dc2caefc38a15d.zip |
fix #2 and #3 distro name
python 3.8 removed platform.platform() in favor of
distro.linux_distribution(). This change uses the new format.
-rwxr-xr-x | src/usr/bin/logout-manager-trayicon | 14 | ||||
-rw-r--r-- | src/usr/share/logout-manager/lmlib.py | 10 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/usr/bin/logout-manager-trayicon b/src/usr/bin/logout-manager-trayicon index b6471f9..012e2bd 100755 --- a/src/usr/bin/logout-manager-trayicon +++ b/src/usr/bin/logout-manager-trayicon @@ -2,6 +2,11 @@ # File: logout-manager-trayicon # License: CC-BY-SA 4.0 # Author: bgstack15 +# Startdate: 2020-03-20 +# Title: Logout Manager tray icon +# Purpose: An easy menu from the system tray in a panel for a window manager or desktop environment +# History: +# 2020-04-01 update for python 3.8 # Reference: # icon work https://stackoverflow.com/questions/45162862/how-do-i-set-an-icon-for-the-whole-application-using-pygobject # button right click must be from "button-press-event" and import Gdk https://python-gtk-3-tutorial.readthedocs.io/en/latest/menus.html @@ -15,10 +20,11 @@ # send signals https://stackoverflow.com/questions/15080500/how-can-i-send-a-signal-from-a-python-program # https://docs.python.org/3.8/library/signal.html#module-signal # Dependencies: -# dep-pip: psutil -# dep-devuan: python3-psutil +# dep-pip: psutil distro +# dep-devuan: python3-psutil python3-distro -import gi, os, platform, re, sys, psutil, signal +import gi, os, re, sys, psutil, signal +from distro import linux_distribution gi.require_version("Gtk","3.0") from gi.repository import Gtk from gi.repository import Gdk @@ -27,7 +33,7 @@ from dotenv import load_dotenv # all this to load the libpath try: defaultdir="/etc/sysconfig" - thisplatform = platform.platform().lower() + thisplatform = linux_distribution()[0].lower() if 'debian' in thisplatform or 'devuan' in thisplatform: defaultdir="/etc/default" # load_dotenv keeps existing environment variables as higher precedent diff --git a/src/usr/share/logout-manager/lmlib.py b/src/usr/share/logout-manager/lmlib.py index 40ee3a0..0bf0a0c 100644 --- a/src/usr/share/logout-manager/lmlib.py +++ b/src/usr/share/logout-manager/lmlib.py @@ -12,8 +12,11 @@ # platform info https://stackoverflow.com/questions/110362/how-can-i-find-the-current-os-in-python/10091465#10091465 # Improve: # Documentation: +# Dependencies: +# dep-devuan: python3-distro -import configparser, platform, os, subprocess +import configparser, os, subprocess +from distro import linux_distribution logout_manager_version="2020-03-10a" @@ -260,9 +263,10 @@ def Initialize_config(infile): # set icon category # written primarily for el7 which uses "app" for the system-reboot icons, etc. - a = platform.dist() + a, b, _ = linux_distribution() + a = a.lower() try: - if a[0] == "redhat" and int(a[1].split(".")[0]) <= 7: + if ("red hat" in a or "redhat" in a) and int(b.split(".")[0]) <= 7: config.set_icon_category("apps") except: pass |