This commit is contained in:
airclay 2021-09-03 08:36:39 -05:00
parent 3b959e189a
commit 33cf50840d
1 changed files with 8 additions and 1 deletions

9
systrayUpdater.py Normal file → Executable file
View File

@ -15,6 +15,7 @@ from PyQt5.QtGui import *
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
# Available Updates count holder # Available Updates count holder
Nupd = []
avail = "" avail = ""
# Use config.yml file to allow for compatibility with # Use config.yml file to allow for compatibility with
@ -33,8 +34,8 @@ def count():
p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE) p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE)
p2 = subprocess.Popen(['wc', '-l'], stdin=p1.stdout, stdout=subprocess.PIPE) p2 = subprocess.Popen(['wc', '-l'], stdin=p1.stdout, stdout=subprocess.PIPE)
output = ((p2.communicate()[0]).decode()).rstrip('\n') output = ((p2.communicate()[0]).decode()).rstrip('\n')
Nupd = []
digit = str(output)+" Updates" digit = str(output)+" Updates"
global Nupd
Nupd.append(digit) Nupd.append(digit)
global avail global avail
avail = Nupd[-1] avail = Nupd[-1]
@ -78,4 +79,10 @@ menu.addAction(quit)
# Adding options to the System Tray # Adding options to the System Tray
tray.setContextMenu(menu) tray.setContextMenu(menu)
# Update the labels for available updates count
for i in Nupd:
option1.triggered.connect(lambda menuItem=text: self.dostuff(menuItem))
option1.setText(text)
tray.setToolTip(text)
app.exec_() app.exec_()