mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
merged
This commit is contained in:
@@ -121,24 +121,24 @@ def settings_dialog(self):
|
||||
# IMAGE PATH #
|
||||
###############
|
||||
|
||||
image_path_container = QWidget()
|
||||
image_path_layout = QHBoxLayout()
|
||||
# image_path_container = QWidget()
|
||||
# image_path_layout = QHBoxLayout()
|
||||
|
||||
image_path = QLineEdit()
|
||||
image_path_layout.addWidget(QLabel("Image Path (requires restart):"))
|
||||
image_path_layout.addWidget(image_path)
|
||||
image_path_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
image_path_container.setLayout(image_path_layout)
|
||||
image_path.setText(state.image_path)
|
||||
# image_path = QLineEdit()
|
||||
# image_path_layout.addWidget(QLabel("Image Path (requires restart):"))
|
||||
# image_path_layout.addWidget(image_path)
|
||||
# image_path_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
# image_path_container.setLayout(image_path_layout)
|
||||
# image_path.setText(state.image_path)
|
||||
|
||||
def browse_image_path():
|
||||
file_path = QFileDialog.getOpenFileName(dialog, "Select Image File", state.image_path, "Image Files (*.png *.jpg)")[0]
|
||||
if file_path:
|
||||
image_path.setText(file_path)
|
||||
# def browse_image_path():
|
||||
# file_path = QFileDialog.getOpenFileName(dialog, "Select Image File", state.image_path, "Image Files (*.png *.jpg)")[0]
|
||||
# if file_path:
|
||||
# image_path.setText(file_path)
|
||||
|
||||
browse_button = QPushButton("📁")
|
||||
image_path_layout.addWidget(browse_button)
|
||||
browse_button.clicked.connect(browse_image_path)
|
||||
# browse_button = QPushButton("📁")
|
||||
# image_path_layout.addWidget(browse_button)
|
||||
# browse_button.clicked.connect(browse_image_path)
|
||||
|
||||
##################
|
||||
# SPEED LIMITING #
|
||||
@@ -224,8 +224,6 @@ def settings_dialog(self):
|
||||
else:
|
||||
interface_select.setCurrentIndex(0)
|
||||
|
||||
interface_select.setFixedWidth(180)
|
||||
interface_select.setFixedHeight(30)
|
||||
interface_select.setFixedWidth(180)
|
||||
interface_select.setFixedHeight(30)
|
||||
interface_layout.addWidget(interface_select)
|
||||
@@ -246,7 +244,7 @@ def settings_dialog(self):
|
||||
download_path.text(),
|
||||
down_speed_limit.value(),
|
||||
up_speed_limit.value(),
|
||||
image_path.text(),
|
||||
None,
|
||||
autoresume_checkbox.isChecked(),
|
||||
max_connections.value(),
|
||||
max_downloads.value(),
|
||||
@@ -258,7 +256,7 @@ def settings_dialog(self):
|
||||
|
||||
self.tabs = QTabWidget()
|
||||
self.tab1 = general_tab("General", autoresume_container, update_checkbox_container, transparent_window_container, self.tabs)
|
||||
self.tab2 = paths_tab("Paths", download_path_container, image_path_container, self.tabs)
|
||||
self.tab2 = paths_tab("Paths", download_path_container, self.tabs)
|
||||
self.tab3 = network_tab("Network", interface_container, max_connections_container, max_downloads_container, up_speed_limit_container, down_speed_limit_container, api_url_container, self.tabs)
|
||||
|
||||
dialog.layout().addWidget(self.tabs)
|
||||
|
||||
+51
-15
@@ -28,7 +28,6 @@ import requests as r
|
||||
import os
|
||||
import subprocess
|
||||
import libtorrent as lt
|
||||
import time
|
||||
import sys
|
||||
import json
|
||||
import base64
|
||||
@@ -86,10 +85,16 @@ def _table_stylesheet(view_type="QTableWidget"):
|
||||
{view_type}::item {{
|
||||
border-bottom: 1px solid {c["border"]};
|
||||
padding: 6px 14px;
|
||||
outline: none;
|
||||
{color_rule}
|
||||
}}
|
||||
{view_type}::item:selected {{
|
||||
background: {c["selected"]};
|
||||
outline: none;
|
||||
}}
|
||||
{view_type}::item:focus {{
|
||||
outline: none;
|
||||
border: none;
|
||||
}}
|
||||
QHeaderView {{
|
||||
background: transparent;
|
||||
@@ -136,25 +141,46 @@ SVG_FOLDER = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path
|
||||
|
||||
|
||||
def download_update(latest_version):
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
new_filename = f"SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows-setup.exe"
|
||||
url = f"https://github.com/KeksPirates/SoftwareManager/releases/latest/download/SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows-setup.exe"
|
||||
installer_path = os.path.join(tempfile.gettempdir(), new_filename)
|
||||
|
||||
print("Downloading update...", True)
|
||||
response = r.get(url, allow_redirects=True)
|
||||
with open(new_filename, "wb") as f:
|
||||
f.write(response.content)
|
||||
if not os.path.exists(new_filename):
|
||||
progress = QtWidgets.QProgressDialog("Downloading installer...", None, 0, 0)
|
||||
progress.setWindowTitle("Updating")
|
||||
progress.setWindowModality(Qt.WindowModality.ApplicationModal)
|
||||
progress.setCancelButton(None)
|
||||
progress.setMinimumDuration(0)
|
||||
progress.setAutoClose(False)
|
||||
progress.setAutoReset(False)
|
||||
progress.setRange(0, 100)
|
||||
progress.setValue(0)
|
||||
progress.show()
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
response = r.get(url, allow_redirects=True, stream=True)
|
||||
total = int(response.headers.get("content-length", 0))
|
||||
downloaded = 0
|
||||
with open(installer_path, "wb") as f:
|
||||
for chunk in response.iter_content(chunk_size=65536):
|
||||
f.write(chunk)
|
||||
downloaded += len(chunk)
|
||||
if total > 0:
|
||||
progress.setValue(int(downloaded * 100 / total))
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
if not os.path.exists(installer_path):
|
||||
progress.close()
|
||||
raise FileNotFoundError("Executable not found")
|
||||
subprocess.run([new_filename, "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART", "/SP-"])
|
||||
time.sleep(0.5)
|
||||
|
||||
msg = QMessageBox()
|
||||
msg.setIcon(QMessageBox.Icon.Information)
|
||||
msg.setWindowTitle("New Version")
|
||||
msg.setText("New version installed.")
|
||||
msg.setInformativeText("Please remove the old exe.")
|
||||
msg.setStandardButtons(QMessageBox.StandardButton.Ok)
|
||||
progress.setLabelText("Installing update...")
|
||||
progress.setValue(100)
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
subprocess.Popen([installer_path, "/VERYSILENT", "/SUPPRESSMSGBOXES", "/SP-", "/CLOSEAPPLICATIONS"])
|
||||
time.sleep(1)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@@ -219,7 +245,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
self.searchbar.setPlaceholderText("Search for software...")
|
||||
self.searchbar.setClearButtonEnabled(True)
|
||||
self.searchbar.setMinimumHeight(30)
|
||||
self.searchbar.returnPressed.connect(lambda: run_thread(threading.Thread(target=return_pressed, args=(self,)))) # Triggers data function thread on enter
|
||||
self.searchbar.returnPressed.connect(self._start_search)
|
||||
|
||||
self.dlbutton = QtWidgets.QPushButton("Download")
|
||||
self.dlbutton.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
@@ -269,6 +295,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
containerLayout = QVBoxLayout()
|
||||
containerLayout.addWidget(self.searchbar)
|
||||
containerLayout.addWidget(state.trackertable)
|
||||
search_row = QHBoxLayout()
|
||||
search_row.addWidget(self.searchbar)
|
||||
|
||||
class DownloadModel(QAbstractTableModel):
|
||||
def __init__(self):
|
||||
@@ -630,6 +658,12 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
self.context_menu.addAction("Cancel Download", self.cancelDownloadAction)
|
||||
self.context_menu.addAction("Delete File", self.deleteFileAction)
|
||||
|
||||
def _start_search(self):
|
||||
self.searchbar.setEnabled(False)
|
||||
def _search_thread():
|
||||
return_pressed(self)
|
||||
run_thread(threading.Thread(target=_search_thread))
|
||||
|
||||
@staticmethod
|
||||
def add_log(text):
|
||||
if MainWindow._instance:
|
||||
@@ -659,6 +693,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
self._resize_tracker_columns()
|
||||
|
||||
self.show_empty_results(False)
|
||||
self.searchbar.setEnabled(True)
|
||||
self.searchbar.setFocus()
|
||||
|
||||
def update_image_overlay(self, new_image_path):
|
||||
self.image = QImage(new_image_path)
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
from PySide6.QtWidgets import QTableWidgetItem, QHeaderView
|
||||
from core.utils.logging.logs import consoleLog
|
||||
from core.data.scrapers.rutracker import scrape_rutracker
|
||||
from core.data.scrapers.uztracker import scrape_uztracker
|
||||
from core.data.scrapers.monkrus import scrape_m0nkrus
|
||||
from core.data.scrapers.steamrip import filter_steamrip
|
||||
from core.data.scrapers.rutracker import init_rutracker
|
||||
from core.data.scrapers.uztracker import init_uztracker
|
||||
from core.data.scrapers.monkrus import init_m0nkrus
|
||||
from core.data.scrapers.steamrip import init_steamrip
|
||||
from core.utils.data.state import state
|
||||
from core.interface.gui import MainWindow
|
||||
|
||||
init_rutracker()
|
||||
init_uztracker()
|
||||
init_m0nkrus()
|
||||
init_steamrip()
|
||||
|
||||
def return_pressed(self):
|
||||
self.show_empty_results(False)
|
||||
@@ -21,4 +25,5 @@ def return_pressed(self):
|
||||
|
||||
state.posts = scrapefunc(search_text)
|
||||
|
||||
from core.interface.gui import MainWindow
|
||||
MainWindow._instance.search_results_signal.emit(tracker["headers"])
|
||||
|
||||
@@ -30,11 +30,11 @@ def general_tab(title, autoresume, update_checkbox, transparent_window, tabs):
|
||||
tabs.addTab(tab, title)
|
||||
return tab
|
||||
|
||||
def paths_tab(title, download_path, image_path, tabs):
|
||||
def paths_tab(title, download_path, tabs):
|
||||
tab = QWidget()
|
||||
layout = QVBoxLayout()
|
||||
layout.addWidget(download_path)
|
||||
layout.addWidget(image_path)
|
||||
# layout.addWidget(image_path)
|
||||
layout.addStretch()
|
||||
tab.setLayout(layout)
|
||||
tabs.addTab(tab, title)
|
||||
|
||||
Reference in New Issue
Block a user