moved clear
This commit is contained in:
parent
8d1027b475
commit
f44b1daf69
2
PKGBUILD
2
PKGBUILD
|
@ -1,6 +1,6 @@
|
||||||
# Maintainer: Eric Lay <ericlaytm@gmail.com>
|
# Maintainer: Eric Lay <ericlaytm@gmail.com>
|
||||||
pkgname=systrayupdater
|
pkgname=systrayupdater
|
||||||
pkgver=r35.0af7ad3
|
pkgver=r36.ba00462
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="PyQt5 system tray applet to notify of available updates"
|
pkgdesc="PyQt5 system tray applet to notify of available updates"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
|
|
|
@ -38,6 +38,10 @@ def count():
|
||||||
tray.setVisible(False)
|
tray.setVisible(False)
|
||||||
else:
|
else:
|
||||||
tray.setVisible(True)
|
tray.setVisible(True)
|
||||||
|
menu.clear()
|
||||||
|
menu.addAction(runUpdate)
|
||||||
|
menu.addAction(readNews)
|
||||||
|
menu.addAction(quit)
|
||||||
for i in outputList.splitlines():
|
for i in outputList.splitlines():
|
||||||
menu.addAction(i, partial(infos, i))
|
menu.addAction(i, partial(infos, i))
|
||||||
global avail
|
global avail
|
||||||
|
@ -56,13 +60,6 @@ def infos(pkgString):
|
||||||
url = 'https://archlinux.org/packages/?q='+ pkg[0]
|
url = 'https://archlinux.org/packages/?q='+ pkg[0]
|
||||||
webbrowser.open_new_tab(url)
|
webbrowser.open_new_tab(url)
|
||||||
|
|
||||||
# Clear old update list when new list available
|
|
||||||
def clear():
|
|
||||||
menu.clear()
|
|
||||||
menu.addAction(option1)
|
|
||||||
menu.addAction(option2)
|
|
||||||
menu.addAction(quit)
|
|
||||||
|
|
||||||
# Run system updatehttps://archlinux.org/packages/?q='+ pkg[0]
|
# Run system updatehttps://archlinux.org/packages/?q='+ pkg[0]
|
||||||
def update():
|
def update():
|
||||||
cmd = [ term, opt, 'sudo', 'pacman', '-Syu' ]
|
cmd = [ term, opt, 'sudo', 'pacman', '-Syu' ]
|
||||||
|
@ -74,13 +71,9 @@ app = QApplication([])
|
||||||
app.setQuitOnLastWindowClosed(False)
|
app.setQuitOnLastWindowClosed(False)
|
||||||
|
|
||||||
# Set up timer to update count
|
# Set up timer to update count
|
||||||
clearTimer = QTimer()
|
|
||||||
clearTimer.timeout.connect(clear)
|
|
||||||
updateTimer = QTimer()
|
updateTimer = QTimer()
|
||||||
updateTimer.timeout.connect(count)
|
updateTimer.timeout.connect(count)
|
||||||
updateTimer.singleShot(1,count) # Initially populate available updates
|
updateTimer.singleShot(1,count) # Initially populate available updates
|
||||||
clearTimer.start(wait)
|
|
||||||
sleep(1)
|
|
||||||
updateTimer.start(wait)
|
updateTimer.start(wait)
|
||||||
|
|
||||||
# Adding items to the menu
|
# Adding items to the menu
|
||||||
|
@ -92,17 +85,14 @@ tray.setVisible(True)
|
||||||
|
|
||||||
# Creating the options
|
# Creating the options
|
||||||
menu = QMenu()
|
menu = QMenu()
|
||||||
option1 = QAction("Run Update")
|
runUpdate = QAction("Run Update")
|
||||||
option2 = QAction("Read the News")
|
readNews = QAction("Read the News")
|
||||||
option1.triggered.connect(update)
|
runUpdate.triggered.connect(update)
|
||||||
option2.triggered.connect(news)
|
readNews.triggered.connect(news)
|
||||||
menu.addAction(option1)
|
|
||||||
menu.addAction(option2)
|
|
||||||
|
|
||||||
# To quit the app
|
# To quit the app
|
||||||
quit = QAction("Quit")
|
quit = QAction("Quit")
|
||||||
quit.triggered.connect(app.quit)
|
quit.triggered.connect(app.quit)
|
||||||
menu.addAction(quit)
|
|
||||||
|
|
||||||
# Place the app in the System Tray
|
# Place the app in the System Tray
|
||||||
tray.setContextMenu(menu)
|
tray.setContextMenu(menu)
|
||||||
|
|
Loading…
Reference in New Issue