mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
Merge branch 'main' of https://github.com/KeksPirates/SoftwareManager
This commit is contained in:
+36
-6
@@ -14,7 +14,6 @@ from PySide6.QtWidgets import (
|
|||||||
QSpinBox,
|
QSpinBox,
|
||||||
QTabWidget,
|
QTabWidget,
|
||||||
QProgressBar,
|
QProgressBar,
|
||||||
QTextEdit,
|
|
||||||
)
|
)
|
||||||
from PySide6.QtGui import QIcon, QAction
|
from PySide6.QtGui import QIcon, QAction
|
||||||
import darkdetect
|
import darkdetect
|
||||||
@@ -209,7 +208,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
api_url_container = QWidget()
|
api_url_container = QWidget()
|
||||||
api_url_layout = QHBoxLayout()
|
api_url_layout = QHBoxLayout()
|
||||||
|
|
||||||
api_url = QTextEdit()
|
api_url = QLineEdit()
|
||||||
api_url_layout.addWidget(QLabel("API Server URL:"))
|
api_url_layout.addWidget(QLabel("API Server URL:"))
|
||||||
api_url_layout.addWidget(api_url)
|
api_url_layout.addWidget(api_url)
|
||||||
api_url_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
api_url_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
@@ -224,7 +223,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
download_path_container = QWidget()
|
download_path_container = QWidget()
|
||||||
download_path_layout = QHBoxLayout()
|
download_path_layout = QHBoxLayout()
|
||||||
|
|
||||||
download_path = QTextEdit()
|
download_path = QLineEdit()
|
||||||
download_path_layout.addWidget(QLabel("Download Path:"))
|
download_path_layout.addWidget(QLabel("Download Path:"))
|
||||||
download_path_layout.addWidget(download_path)
|
download_path_layout.addWidget(download_path)
|
||||||
download_path_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
download_path_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
@@ -258,9 +257,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
|
|
||||||
save_btn = QPushButton("Save")
|
save_btn = QPushButton("Save")
|
||||||
cancel_btn = QPushButton("Cancel")
|
cancel_btn = QPushButton("Cancel")
|
||||||
save_btn.clicked.connect(lambda: save_settings(thread_box.value(), close_settings, api_url.toPlainText(), download_path.toPlainText(), speed_limit.value()))
|
save_btn.clicked.connect(lambda: save_settings(thread_box.value(), close_settings, api_url.text(), download_path.text(), speed_limit.value()))
|
||||||
|
|
||||||
|
|
||||||
cancel_btn.clicked.connect(dialog.reject)
|
cancel_btn.clicked.connect(dialog.reject)
|
||||||
print(thread_box.value())
|
print(thread_box.value())
|
||||||
layout.addWidget(cancel_btn)
|
layout.addWidget(cancel_btn)
|
||||||
@@ -270,5 +268,37 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
|
|
||||||
dialog.exec()
|
dialog.exec()
|
||||||
|
|
||||||
|
# this needs a cleanup
|
||||||
|
def return_pressed(self):
|
||||||
|
search_text = self.searchbar.text()
|
||||||
|
if search_text == "":
|
||||||
|
if state.debug:
|
||||||
|
print("Error: Can't search for nothing")
|
||||||
|
return
|
||||||
|
if state.debug:
|
||||||
|
print("User searched for:", search_text)
|
||||||
|
if state.tracker == "uztracker":
|
||||||
|
response = asyncio.run(scrape_uztracker(search_text))
|
||||||
|
if state.tracker == "rutracker":
|
||||||
|
response = scrape_rutracker(search_text)
|
||||||
|
if response:
|
||||||
|
if state.tracker == "uztracker":
|
||||||
|
state.post_titles, state.post_urls, = response
|
||||||
|
self.softwareList.clear()
|
||||||
|
if state.post_titles:
|
||||||
|
self.softwareList.addItems(state.post_titles)
|
||||||
|
if state.tracker == "rutracker":
|
||||||
|
_, state.posts, _, _ = split_data(response)
|
||||||
|
state.post_titles, _ = format_data(state.posts)
|
||||||
|
self.softwareList.clear()
|
||||||
|
self.softwareList.addItems(state.post_titles)
|
||||||
|
if not response:
|
||||||
|
if state.debug:
|
||||||
|
print(f"No Results found for \"{search_text}\"")
|
||||||
|
self.softwareList.clear()
|
||||||
|
self.softwareList.addItem("No Results") # replace with no results text in center
|
||||||
|
|
||||||
|
|
||||||
|
def update_progress(self):
|
||||||
|
progress = dlprogress()
|
||||||
|
self.progressbar.setValue(progress)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import aria2p
|
import aria2p
|
||||||
import subprocess
|
import subprocess
|
||||||
from core.utils.data.state import state
|
from core.utils.data.state import state
|
||||||
|
from plyer import notification
|
||||||
|
import time
|
||||||
|
|
||||||
def run_aria2p():
|
def run_aria2p():
|
||||||
global aria2
|
global aria2
|
||||||
@@ -37,12 +39,27 @@ def aria2server():
|
|||||||
|
|
||||||
def dlprogress():
|
def dlprogress():
|
||||||
try:
|
try:
|
||||||
download2 = aria2.get_downloads()
|
downloads = aria2.get_downloads()
|
||||||
if download2:
|
if downloads:
|
||||||
for download in download2:
|
for download in downloads:
|
||||||
progress = download.progress_string(0)
|
progress = download.progress_string(0)
|
||||||
progress_int = int(progress.strip('%'))
|
progress_int = int(progress.strip('%'))
|
||||||
return progress_int
|
return progress_int
|
||||||
return 0
|
return 0
|
||||||
except:
|
except:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def send_notification():
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
downloads = aria2.get_downloads()
|
||||||
|
if downloads:
|
||||||
|
for download in downloads:
|
||||||
|
if download.is_complete:
|
||||||
|
# notification.notify("Download Complete"
|
||||||
|
print("yet")
|
||||||
|
time.sleep(5)
|
||||||
|
except Exception as e:
|
||||||
|
if state.debug:
|
||||||
|
print(f"Notification Error: {e}")
|
||||||
|
break
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
from core.interface.gui import MainWindow
|
from core.interface.gui import MainWindow
|
||||||
from core.utils.data.state import state
|
from core.utils.data.state import state
|
||||||
from core.network.aria2_integration import aria2server
|
from core.network.aria2_integration import aria2server
|
||||||
|
from core.network.aria2_integration import send_notification
|
||||||
|
from core.utils.wrappers import run_thread
|
||||||
|
import threading
|
||||||
from core.utils.config.config import read_config
|
from core.utils.config.config import read_config
|
||||||
from PySide6 import QtWidgets
|
from PySide6 import QtWidgets
|
||||||
import qdarktheme
|
import qdarktheme
|
||||||
@@ -23,6 +26,7 @@ def run_gui():
|
|||||||
sys.exit(app.exec())
|
sys.exit(app.exec())
|
||||||
|
|
||||||
def run_aria2server():
|
def run_aria2server():
|
||||||
|
run_thread(threading.Thread(target=send_notification))
|
||||||
aria2process = aria2server()
|
aria2process = aria2server()
|
||||||
return aria2process
|
return aria2process
|
||||||
|
|
||||||
|
|||||||
@@ -6,3 +6,4 @@ aria2p==0.12.1
|
|||||||
pyinstaller==6.15.0
|
pyinstaller==6.15.0
|
||||||
pyqtdarktheme==0.1.7
|
pyqtdarktheme==0.1.7
|
||||||
aiohttp==3.13.0
|
aiohttp==3.13.0
|
||||||
|
plyer==2.1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user