mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
add downloading items to download tab
This commit is contained in:
@@ -109,6 +109,15 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
self.progress_timer.timeout.connect(lambda: run_thread(threading.Thread(target=self.update_progress)))
|
||||
self.progress_timer.start(1000)
|
||||
|
||||
self.download_timer = QTimer()
|
||||
self.download_timer.timeout.connect(lambda: run_thread(threading.Thread(target=self.download_list_update)))
|
||||
self.download_timer.start(5000)
|
||||
|
||||
def download_list_update(self):
|
||||
self.downloadList.clear()
|
||||
for download in state.downloads:
|
||||
self.downloadList.addItem(download.name)
|
||||
|
||||
def closeEvent(self, event: QCloseEvent):
|
||||
closehelper()
|
||||
event.accept()
|
||||
|
||||
@@ -38,7 +38,8 @@ def aria2server():
|
||||
|
||||
def dlprogress():
|
||||
try:
|
||||
downloads = state.aria2.get_downloads()
|
||||
state.downloads = state.aria2.get_downloads()
|
||||
downloads = state.downloads
|
||||
if downloads:
|
||||
for download in downloads:
|
||||
progress = download.progress_string(0)
|
||||
@@ -48,10 +49,11 @@ def dlprogress():
|
||||
except:
|
||||
return 0
|
||||
|
||||
|
||||
def send_notification(shutdown_event):
|
||||
while not shutdown_event.is_set():
|
||||
try:
|
||||
for download in state.aria2.get_downloads():
|
||||
for download in state.downloads:
|
||||
if dlprogress() == 100:
|
||||
notification.notify(
|
||||
title = "Download finished",
|
||||
|
||||
@@ -8,6 +8,7 @@ class AppState:
|
||||
post_titles: List[str]
|
||||
post_urls: List[str]
|
||||
post_author: List[str]
|
||||
downloads: List[str]
|
||||
debug: bool = False
|
||||
tracker: str = "rutracker"
|
||||
api_url: str = "https://api.michijackson.xyz"
|
||||
@@ -18,4 +19,4 @@ class AppState:
|
||||
aria2p: Any = None
|
||||
aria2_threads: int = 4
|
||||
|
||||
state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], download_path="")
|
||||
state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], downloads=[], download_path="")
|
||||
|
||||
Reference in New Issue
Block a user