diff options
Diffstat (limited to 'ayatanasettings')
-rw-r--r-- | ayatanasettings/__init__.py | 1 | ||||
-rw-r--r-- | ayatanasettings/appdata.py | 16 | ||||
-rw-r--r-- | ayatanasettings/builder.py | 80 | ||||
-rw-r--r-- | ayatanasettings/logger.py | 25 | ||||
-rw-r--r-- | ayatanasettings/psutil.py | 62 |
5 files changed, 0 insertions, 184 deletions
diff --git a/ayatanasettings/__init__.py b/ayatanasettings/__init__.py deleted file mode 100644 index 8b13789..0000000 --- a/ayatanasettings/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ayatanasettings/appdata.py b/ayatanasettings/appdata.py deleted file mode 100644 index 50a320b..0000000 --- a/ayatanasettings/appdata.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -APPNAME = 'ayatana-settings' -APPEXECUTABLE='/usr/bin/ayatana-settings' -APPVERSION = '23.11.14' -APPSHOWSETTINGS = 201014 -APPYEAR = '2020' -APPTITLE = 'Ayatana Indicators Settings' -APPDESCRIPTION = 'Ayatana Indicators Settings' -APPLONGDESCRIPTION = 'Ayatana Settings allows you to configure all your Ayatana system indicators.' -APPAUTHOR = 'Robert Tari' -APPMAIL = 'robert@tari.in' -APPURL = 'https://github.com/AyatanaIndicators/ayatana-settings' -APPKEYWORDS = ['ayatana', 'indicator', 'settings'] -APPDEBUG = [] diff --git a/ayatanasettings/builder.py b/ayatanasettings/builder.py deleted file mode 100644 index 1297ec9..0000000 --- a/ayatanasettings/builder.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import gi - -gi.require_version('Gtk', '3.0') - -from gi.repository import Gtk -from .appdata import APPNAME, APPTITLE, APPDEBUG, APPEXECUTABLE -import os - -def getClassVar(sId): - - return 'p' + sId[0:1].upper() + sId[1:] - -def getDataPath(sPath): - - try: - - sExecPath = os.path.split(APPEXECUTABLE)[0] - sDataPath = os.getcwd().replace(sExecPath, '') - sRelativePath = os.path.join(sDataPath, sPath.lstrip('/')) - - if os.path.exists(sRelativePath): - - return sRelativePath - - except: - - pass - - return sPath - -def buildApp(pApp): - - pBuilder = Gtk.Builder() - pBuilder.set_translation_domain(APPNAME) - pBuilder.add_from_file(getDataPath('/usr/share/' + APPNAME + '/' + APPNAME + '.glade')) - pBuilder.connect_signals(pApp) - - for pObject in pBuilder.get_objects(): - - try: - - pApp.__dict__[getClassVar(Gtk.Buildable.get_name(pObject))] = pObject - - if isinstance(pObject, Gtk.Notebook): - - def onNotebookPageSelected(pWidget, pEvent): - - nMouseX, nMouseY = pEvent.get_coords() - - for nPage in range(0, pWidget.get_n_pages()): - - pLabel = pWidget.get_tab_label(pWidget.get_nth_page(nPage)) - nX, nY = pLabel.translate_coordinates(pWidget, 0, 0) - rcSize = pLabel.get_allocation() - - if nMouseX >= nX and nMouseY >= nY and nMouseX <= nX + rcSize.width and nMouseY <= nY + rcSize.height and pWidget.get_tab_label(pWidget.get_nth_page(nPage)).get_sensitive(): - - return False - - return True - - pObject.connect('button-press-event', onNotebookPageSelected) - - except: - - pass - - pApp.pWindow.set_icon_from_file(getDataPath('/usr/share/icons/hicolor/scalable/apps/' + APPNAME + '.svg')) - - sTitle = APPTITLE - - if APPDEBUG: - - sTitle += ' - DEBUGGING MODE' - - pApp.pWindow.set_title(sTitle) - pApp.pWindow.show_all() diff --git a/ayatanasettings/logger.py b/ayatanasettings/logger.py deleted file mode 100644 index 4b8763e..0000000 --- a/ayatanasettings/logger.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import logging -from .appdata import APPNAME - -class Formatter(logging.Formatter): - - def __init__(self): - - logging.Formatter.__init__(self, '[%(asctime)s] %(levelname)s: %(message)s') - self.default_msec_format = '%s.%03d' - - def format(self, record): - - dColours = {'WARNING': '33', 'INFO': '32', 'DEBUG': '37', 'CRITICAL': '35', 'ERROR': '31'} - record.levelname = '\033[1;' + dColours[record.levelname] + 'm' + record.levelname + '\033[0m' - - return logging.Formatter.format(self, record) - -logger = logging.getLogger(APPNAME) -logger.setLevel(logging.DEBUG) -pStreamHandler = logging.StreamHandler() -pStreamHandler.setFormatter(Formatter()) -logger.addHandler(pStreamHandler) diff --git a/ayatanasettings/psutil.py b/ayatanasettings/psutil.py deleted file mode 100644 index acdbe67..0000000 --- a/ayatanasettings/psutil.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import psutil -import os -from .appdata import APPNAME - -def isRunning(): - - for pProc in psutil.process_iter(): - - sName = pProc.name - - if not isinstance(sName, str): - - sName = pProc.name() - - if sName == 'python3' or sName == 'python': - - lCmdLine = pProc.cmdline - - if not isinstance(lCmdLine, list): - - lCmdLine = pProc.cmdline() - - for sCmd in lCmdLine: - - if sCmd.endswith(APPNAME) and pProc.pid != os.getpid(): - - return True - - elif sName.endswith(APPNAME) and pProc.pid != os.getpid(): - - return True - - return False - -def isSystemd(): - - for pProc in psutil.process_iter(): - - sName = pProc.name - - if not isinstance(sName, str): - - sName = pProc.name() - - if sName == 'systemd': - - lCmdLine = pProc.cmdline - - if not isinstance(lCmdLine, list): - - lCmdLine = pProc.cmdline() - - for sCmd in lCmdLine: - - if sCmd == '--user': - - return True - - return False |