Skip to content

Commit

Permalink
- pylint docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
trigg committed May 7, 2024
1 parent 48e5d87 commit da52ed1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/script/arch-update-tray.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
"""Arch-Update System Tray."""
import gettext
import logging
import os
Expand Down Expand Up @@ -78,7 +79,7 @@


def arch_update():
# Find a way to launch with terminal
""" Find a way to launch with terminal """
update = "/usr/share/applications/arch-update.desktop"
if shutil.which("kioclient"):
subprocess.run(["kioclient", "exec", update], check=False)
Expand All @@ -92,7 +93,10 @@ def arch_update():


class ArchUpdateGtk3:
""" System Tray using GTK3 library """

def file_changed(self, _a=None, _b=None, _c=None, _d=None):
""" Called when statefile contents change """
try:
with open(self.statefile, encoding="utf-8") as f:
contents = f.readline().strip()
Expand All @@ -103,9 +107,11 @@ def file_changed(self, _a=None, _b=None, _c=None, _d=None):
self.ind.set_icon(contents)

def update(self, _button=None):
""" Start arch-update """
arch_update()

def __init__(self, statefile):
""" Start Gtk3 System Tray """
self.statefile = statefile

self.ind = ai.Indicator.new(
Expand All @@ -130,7 +136,10 @@ def __init__(self, statefile):


class ArchUpdateQt6:
""" System Tray using QT6 library """

def file_changed(self):
""" Called when statefile contents change """

contents = ""
if self.watcher and not self.statefile in self.watcher.files():
Expand All @@ -146,9 +155,11 @@ def file_changed(self):
self.tray.setIcon(icon)

def update(self):
""" Start arch-update """
arch_update()

def __init__(self, statefile):
""" Start Qt6 System Tray """

self.statefile = statefile
self.watcher = None
Expand All @@ -171,6 +182,7 @@ def __init__(self, statefile):


def start(toolkit):
""" Start one of the System trays """
match toolkit:
case 'qt6':
ArchUpdateQt6(STATE_FILE)
Expand Down

0 comments on commit da52ed1

Please sign in to comment.