mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 01:49:42 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 95a687ddd9 | |||
| 813d2b31c4 | |||
| deb5ce5b88 | |||
| a11c1d7129 | |||
| dcc78ade44 |
@@ -10,12 +10,10 @@ from PySide6.QtWidgets import (
|
|||||||
QLabel,
|
QLabel,
|
||||||
QHBoxLayout,
|
QHBoxLayout,
|
||||||
QSpinBox,
|
QSpinBox,
|
||||||
|
QCheckBox,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def settings_dialog(self):
|
def settings_dialog(self):
|
||||||
|
|
||||||
if state.debug:
|
if state.debug:
|
||||||
@@ -30,6 +28,19 @@ def settings_dialog(self):
|
|||||||
def close_settings():
|
def close_settings():
|
||||||
dialog.reject()
|
dialog.reject()
|
||||||
|
|
||||||
|
checkbox_container = QWidget()
|
||||||
|
checkbox_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
# ignore updates checkbox
|
||||||
|
checkbox = QCheckBox()
|
||||||
|
checkbox_container.setLayout(checkbox_layout)
|
||||||
|
checkbox_layout.addWidget(QLabel("Ignore Updates: "))
|
||||||
|
checkbox_layout.addStretch()
|
||||||
|
checkbox.setChecked(state.ignore_updates)
|
||||||
|
checkbox.toggled.connect(lambda checked: setattr(state, 'ignore_updates', checked))
|
||||||
|
checkbox_layout.addWidget(checkbox)
|
||||||
|
dialog.layout().addWidget(checkbox_container)
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# THREAD SETTING #
|
# THREAD SETTING #
|
||||||
##################
|
##################
|
||||||
|
|||||||
+24
-15
@@ -16,9 +16,10 @@ from PySide6.QtWidgets import (
|
|||||||
QHeaderView,
|
QHeaderView,
|
||||||
QMessageBox,
|
QMessageBox,
|
||||||
QTableWidget,
|
QTableWidget,
|
||||||
QTableWidgetItem,
|
QTableWidgetItem
|
||||||
)
|
)
|
||||||
from PySide6.QtGui import QIcon, QAction, QCloseEvent
|
|
||||||
|
from PySide6.QtGui import QIcon, QAction, QCloseEvent, QPalette
|
||||||
import darkdetect
|
import darkdetect
|
||||||
import threading
|
import threading
|
||||||
import platform
|
import platform
|
||||||
@@ -60,21 +61,22 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
# Check for updates on Windows
|
# Check for updates on Windows
|
||||||
if platform.system() == "Windows":
|
if state.ignore_updates is False:
|
||||||
result = check_for_updates()
|
if platform.system() == "Windows":
|
||||||
assets, latest_version = result
|
result = check_for_updates()
|
||||||
|
assets, latest_version = result
|
||||||
|
|
||||||
if assets:
|
if assets:
|
||||||
msg = QMessageBox()
|
msg = QMessageBox()
|
||||||
msg.setIcon(QMessageBox.Information)
|
msg.setIcon(QMessageBox.Information)
|
||||||
msg.setWindowTitle("Update Available")
|
msg.setWindowTitle("Update Available")
|
||||||
msg.setText(f"A new version is available.")
|
msg.setText(f"A new version is available.")
|
||||||
msg.setInformativeText("Please visit the GitHub releases page to download the latest version.")
|
msg.setInformativeText("Please visit the GitHub releases page to download the latest version.")
|
||||||
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Ignore)
|
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Ignore)
|
||||||
|
|
||||||
response = msg.exec_()
|
response = msg.exec_()
|
||||||
if response == QMessageBox.Ok:
|
if response == QMessageBox.Ok:
|
||||||
download_update(latest_version)
|
download_update(latest_version)
|
||||||
|
|
||||||
self.setWindowTitle("Software Manager")
|
self.setWindowTitle("Software Manager")
|
||||||
self.setGeometry(100, 100, 800, 600)
|
self.setGeometry(100, 100, 800, 600)
|
||||||
@@ -109,6 +111,9 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
self.qtablewidget.verticalHeader().setVisible(False)
|
self.qtablewidget.verticalHeader().setVisible(False)
|
||||||
self.qtablewidget.setHorizontalHeaderLabels(["Post Title", "Author"])
|
self.qtablewidget.setHorizontalHeaderLabels(["Post Title", "Author"])
|
||||||
self.qtablewidget.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
|
self.qtablewidget.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
|
||||||
|
self.qtablewidget.setAttribute(Qt.WA_TranslucentBackground)
|
||||||
|
self.qtablewidget.viewport().setAttribute(Qt.WA_TranslucentBackground)
|
||||||
|
|
||||||
header = self.qtablewidget.horizontalHeader()
|
header = self.qtablewidget.horizontalHeader()
|
||||||
header.setSectionResizeMode(1, QHeaderView.Fixed)
|
header.setSectionResizeMode(1, QHeaderView.Fixed)
|
||||||
header.resizeSection(1, 500)
|
header.resizeSection(1, 500)
|
||||||
@@ -158,6 +163,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
self.downloadList.horizontalHeader().setStretchLastSection(False)
|
self.downloadList.horizontalHeader().setStretchLastSection(False)
|
||||||
self.downloadList.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
|
self.downloadList.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
|
||||||
self.downloadList.setSelectionBehavior(QTableView.SelectRows)
|
self.downloadList.setSelectionBehavior(QTableView.SelectRows)
|
||||||
|
self.downloadList.setAttribute(Qt.WA_TranslucentBackground)
|
||||||
|
self.downloadList.viewport().setAttribute(Qt.WA_TranslucentBackground)
|
||||||
|
|
||||||
# download button triggers
|
# download button triggers
|
||||||
self.dlbutton.clicked.connect(lambda: run_thread(threading.Thread(target=download_selected, args=(self.qtablewidget.currentItem(), state.posts, state.post_titles))))
|
self.dlbutton.clicked.connect(lambda: run_thread(threading.Thread(target=download_selected, args=(self.qtablewidget.currentItem(), state.posts, state.post_titles))))
|
||||||
@@ -176,6 +183,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
self.tab2 = create_tab("Library", self.emptyLibrary, self.libraryList, self.tabs, None, None)
|
self.tab2 = create_tab("Library", self.emptyLibrary, self.libraryList, self.tabs, None, None)
|
||||||
self.tab3 = create_tab("Downloads", self.emptyDownload, self.downloadList, self.tabs, None, None)
|
self.tab3 = create_tab("Downloads", self.emptyDownload, self.downloadList, self.tabs, None, None)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
containerLayout.addWidget(self.tabs)
|
containerLayout.addWidget(self.tabs)
|
||||||
|
|
||||||
containerLayout.setAlignment(Qt.AlignmentFlag.AlignBottom)
|
containerLayout.setAlignment(Qt.AlignmentFlag.AlignBottom)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ def create_config():
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
|
|
||||||
config["General"] = {"debug": True, "api_url": f"{state.api_url}", "aria2_threads": f"{state.aria2_threads}", "download_path": f"{state.download_path}", f"speed_limit": f"{state.speed_limit}",
|
config["General"] = {"debug": True, "api_url": f"{state.api_url}", "aria2_threads": f"{state.aria2_threads}", "download_path": f"{state.download_path}", f"speed_limit": f"{state.speed_limit}",
|
||||||
"version": f"{state.version}"}
|
"version": f"{state.version}", "ignore_updates": f"{state.ignore_updates}"}
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
|
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
|
||||||
@@ -43,3 +43,4 @@ def read_config():
|
|||||||
state.download_path = config.get("General", "download_path")
|
state.download_path = config.get("General", "download_path")
|
||||||
state.speed_limit = config.getint("General", "speed_limit")
|
state.speed_limit = config.getint("General", "speed_limit")
|
||||||
state.version = config.get("General", "version")
|
state.version = config.get("General", "version")
|
||||||
|
state.ignore_updates = config.getboolean("General", "ignore_updates")
|
||||||
|
|||||||
@@ -1,37 +1,17 @@
|
|||||||
from core.utils.data.state import state
|
from core.utils.data.state import state
|
||||||
|
from core.utils.general.shutdown import kill_aria2server
|
||||||
from .config import create_config
|
from .config import create_config
|
||||||
|
|
||||||
def restart_aria2c():
|
def restart_aria2c():
|
||||||
import main # had to do this because of circle import :(
|
import main # had to do this because of circle import :(
|
||||||
import signal
|
import signal
|
||||||
import atexit
|
import atexit
|
||||||
import time
|
kill_aria2server()
|
||||||
|
state.aria2process.wait()
|
||||||
try:
|
state.aria2process = main.run_aria2server()
|
||||||
main.kill_aria2server()
|
signal.signal(signal.SIGINT, main.keyboardinterrupthandler)
|
||||||
except Exception as e:
|
atexit.unregister(kill_aria2server)
|
||||||
print(f"Warning: aria2server kill failed: {e}")
|
atexit.register(kill_aria2server)
|
||||||
|
|
||||||
try:
|
|
||||||
if state.aria2process:
|
|
||||||
state.aria2process.wait(timeout=3)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Warning: aria2process wait failed: {e}")
|
|
||||||
|
|
||||||
time.sleep(0.5)
|
|
||||||
|
|
||||||
try:
|
|
||||||
state.aria2process = main.run_aria2server()
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error: failed to restart aria2server: {e}")
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
signal.signal(signal.SIGINT, main.keyboardinterrupthandler)
|
|
||||||
atexit.unregister(main.kill_aria2server)
|
|
||||||
atexit.register(main.kill_aria2server)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Warning: signal/atexit setup failed: {e}")
|
|
||||||
|
|
||||||
def save_settings(thread_count=None, close=lambda: None, apiurl=None, download_path=None, speed_limit=None, version=None):
|
def save_settings(thread_count=None, close=lambda: None, apiurl=None, download_path=None, speed_limit=None, version=None):
|
||||||
if thread_count is not None:
|
if thread_count is not None:
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class AppState:
|
|||||||
post_author: List[str]
|
post_author: List[str]
|
||||||
downloads: List[str]
|
downloads: List[str]
|
||||||
version: str
|
version: str
|
||||||
|
ignore_updates: bool = False
|
||||||
debug: bool = False
|
debug: bool = False
|
||||||
tracker: str = "rutracker"
|
tracker: str = "rutracker"
|
||||||
api_url: str = "https://api.michijackson.xyz"
|
api_url: str = "https://api.michijackson.xyz"
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ def check_for_updates():
|
|||||||
latest_version = latest_release["name"]
|
latest_version = latest_release["name"]
|
||||||
assets = latest_release["assets"]
|
assets = latest_release["assets"]
|
||||||
|
|
||||||
if latest_version != state.version:
|
|
||||||
|
if state.version == "dev":
|
||||||
|
if state.debug:
|
||||||
|
print("Dev release detected, skipping version check")
|
||||||
|
return None, None
|
||||||
|
elif latest_version != state.version:
|
||||||
if state.debug:
|
if state.debug:
|
||||||
print(f"New release available: {latest_version}")
|
print(f"New release available: {latest_version}")
|
||||||
if assets:
|
if assets:
|
||||||
|
|||||||
Reference in New Issue
Block a user