Update systrayUpdater

This commit is contained in:
Eric Lay 2023-12-07 20:45:12 -06:00 committed by GitHub
parent dc9b629382
commit 6fc3ffc611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -70,31 +70,29 @@ def update():
app = QApplication([]) app = QApplication([])
app.setQuitOnLastWindowClosed(False) app.setQuitOnLastWindowClosed(False)
# Set up timer to update count # Set up timer
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
updateTimer.start(wait) updateTimer.start(wait)
# Adding items to the menu # Adding items to the tray
tray = QSystemTrayIcon() tray = QSystemTrayIcon()
icon = QIcon(icn) icon = QIcon(icn)
tray.setIcon(icon) tray.setIcon(icon)
tray.setToolTip(avail) tray.setToolTip(avail)
tray.setVisible(True) tray.setVisible(True)
# Creating the options # Creating the menu/options
menu = QMenu() menu = QMenu()
runUpdate = QAction("Run Update") runUpdate = QAction("Run Update")
readNews = QAction("Read the News") readNews = QAction("Read the News")
quit = QAction("Quit")
runUpdate.triggered.connect(update) runUpdate.triggered.connect(update)
readNews.triggered.connect(news) readNews.triggered.connect(news)
# To quit the app
quit = QAction("Quit")
quit.triggered.connect(app.quit) quit.triggered.connect(app.quit)
# Place the app in the System Tray # Place the menu in the System Tray
tray.setContextMenu(menu) tray.setContextMenu(menu)
app.exec_() app.exec_()