mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
Fixed Aria2 Errors, Automatically kill it, make it work with VPNs
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
from core.ui.gui import MainWindow
|
||||
from core.ui.gui import state_debug
|
||||
|
||||
from core.downloading.aria2p_server import aria2server
|
||||
from PySide6 import QtWidgets
|
||||
import qdarktheme
|
||||
import darkdetect
|
||||
import subprocess
|
||||
import signal
|
||||
import atexit
|
||||
import sys
|
||||
|
||||
debug = True
|
||||
aria2process = None
|
||||
|
||||
def run_gui():
|
||||
state_debug(debug)
|
||||
@@ -19,5 +23,26 @@ def run_gui():
|
||||
widget.show()
|
||||
sys.exit(app.exec())
|
||||
|
||||
def kill_aria2server():
|
||||
global aria2process
|
||||
if aria2process:
|
||||
aria2process.kill()
|
||||
if debug:
|
||||
print("\nKilled Aria2")
|
||||
|
||||
def keyboardinterrupthandler(signum, frame):
|
||||
kill_aria2server()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
kill_aria2server()
|
||||
if debug:
|
||||
print("Starting Aria2 Server")
|
||||
aria2process = aria2server()
|
||||
signal.signal(signal.SIGINT, keyboardinterrupthandler)
|
||||
atexit.register(kill_aria2server)
|
||||
if debug:
|
||||
print("Launching GUI")
|
||||
run_gui()
|
||||
|
||||
Reference in New Issue
Block a user