Compare commits

...

8 Commits

2 changed files with 29 additions and 24 deletions
+8 -2
View File
@@ -90,9 +90,16 @@ jobs:
}' }'
$json | Out-File -Encoding utf8 build_info.json $json | Out-File -Encoding utf8 build_info.json
- name: Download aria2c (Windows)
if: runner.os == 'Windows'
run: |
mkdir -p deps
C:\msys64\usr\bin\wget.exe https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip
unzip -j aria2-1.37.0-win-64bit-build1.zip aria2-1.37.0-win-64bit-build1/aria2c.exe -d deps/
- name: Build executable with PyInstaller (Windows) - name: Build executable with PyInstaller (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
run: pyinstaller --onefile --windowed --add-data "build_info.json:." --name ${{ env.APP_NAME }} main.py run: pyinstaller --onefile --windowed --add-data "build_info.json:." --add-data "deps/aria2c.exe:." --name ${{ env.APP_NAME }} main.py
- name: Build executable with PyInstaller (Unix) - name: Build executable with PyInstaller (Unix)
if: runner.os != 'Windows' if: runner.os != 'Windows'
@@ -143,7 +150,6 @@ jobs:
with: with:
tag_name: ${{ needs.build.outputs.version }} tag_name: ${{ needs.build.outputs.version }}
name: ${{ needs.build.outputs.version }} name: ${{ needs.build.outputs.version }}
prerelease: true
files: | files: |
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-linux release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-linux
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-windows.exe release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-windows.exe
+21 -22
View File
@@ -3,14 +3,14 @@ from PySide6 import QtCore
from PySide6.QtCore import Qt, QTimer, QModelIndex, QAbstractTableModel from PySide6.QtCore import Qt, QTimer, QModelIndex, QAbstractTableModel
from PySide6.QtWidgets import ( from PySide6.QtWidgets import (
QLineEdit, QLineEdit,
QTableView, QTableView,
QWidget, QWidget,
QVBoxLayout, QVBoxLayout,
QListWidget, QListWidget,
QToolBar, QToolBar,
QLabel, QLabel,
QHBoxLayout, QHBoxLayout,
QComboBox, QComboBox,
QTabWidget, QTabWidget,
QProgressBar, QProgressBar,
QHeaderView, QHeaderView,
@@ -38,12 +38,11 @@ from core.interface.utils.searchhelper import return_pressed
from core.interface.dialogs.settings import settings_dialog from core.interface.dialogs.settings import settings_dialog
from core.network.aria2_integration import dlprogress from core.network.aria2_integration import dlprogress
print(os.path.abspath(__file__))
def download_update(latest_version): def download_update(latest_version):
old_filename = f"SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe" old_filename = f"SoftwareManager-dev-{state.version.replace('-dev', '')}-windows.exe"
new_filename = f"SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe" new_filename = f"SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe"
url = f"https://github.com/KeksPirates/SoftwareManager/releases/latest/download/SoftwareManager-dev-{latest_version}-windows.exe" url = f"https://github.com/KeksPirates/SoftwareManager/releases/latest/download/SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe"
print("Downloading update...") print("Downloading update...")
if os.path.exists(old_filename): if os.path.exists(old_filename):
@@ -52,11 +51,12 @@ def download_update(latest_version):
with open(new_filename, "wb") as f: with open(new_filename, "wb") as f:
f.write(response.content) f.write(response.content)
if not os.path.exists(new_filename): if not os.path.exists(new_filename):
raise FileNotFoundError(f"Executable not found") raise FileNotFoundError("Executable not found")
subprocess.Popen([new_filename], shell=True) subprocess.Popen([new_filename], shell=True)
time.sleep(0.5) time.sleep(0.5)
sys.exit(0) sys.exit(0)
class MainWindow(QtWidgets.QMainWindow, QWidget): class MainWindow(QtWidgets.QMainWindow, QWidget):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@@ -77,7 +77,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
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("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)
@@ -97,7 +97,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.searchbar.setClearButtonEnabled(True) self.searchbar.setClearButtonEnabled(True)
self.searchbar.setMinimumHeight(30) 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(lambda: run_thread(threading.Thread(target=return_pressed, args=(self,)))) # Triggers data function thread on enter
self.dlbutton = QtWidgets.QPushButton("Download") self.dlbutton = QtWidgets.QPushButton("Download")
self.libraryList = QListWidget() self.libraryList = QListWidget()
@@ -105,7 +105,6 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.emptyResults.setAlignment(Qt.AlignCenter) self.emptyResults.setAlignment(Qt.AlignCenter)
self.emptyResults.hide() self.emptyResults.hide()
self.download_model = None self.download_model = None
self.downloadList = QTableView() self.downloadList = QTableView()
self.emptyLibrary = QLabel("No items in library.") self.emptyLibrary = QLabel("No items in library.")
@@ -134,13 +133,13 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.headers = ["Name", "Status", "Progress", "Speed", "Size", "Total Size"] self.headers = ["Name", "Status", "Progress", "Speed", "Size", "Total Size"]
def rowCount(self, parent=QModelIndex()): def rowCount(self, parent=QModelIndex()):
return len(state.downloads) return len(state.downloads)
def columnCount(self, parent=QModelIndex()): def columnCount(self, parent=QModelIndex()):
return len(self.headers) return len(self.headers)
def headerData(self, section, orientation, role=Qt.DisplayRole): def headerData(self, section, orientation, role=Qt.DisplayRole):
if role == Qt.DisplayRole and orientation == Qt.Horizontal: if role == Qt.DisplayRole and orientation == Qt.Horizontal:
return self.headers[section] return self.headers[section]
@@ -150,7 +149,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
if role == Qt.DisplayRole: if role == Qt.DisplayRole:
download = state.downloads[index.row()] download = state.downloads[index.row()]
col = index.column() col = index.column()
if col == 0: if col == 0:
return download.name return download.name
elif col == 1: elif col == 1:
@@ -185,12 +184,12 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.horizontal_layout = QHBoxLayout() self.horizontal_layout = QHBoxLayout()
self.horizontal_layout.addWidget(self.emptyResults, stretch=3) self.horizontal_layout.addWidget(self.emptyResults, stretch=3)
self.horizontal_layout.addWidget(self.qtablewidget) self.horizontal_layout.addWidget(self.qtablewidget)
self.tab1 = create_tab("Search", self.searchbar, self.qtablewidget, self.tabs, self.dlbutton, self.horizontal_layout) self.tab1 = create_tab("Search", self.searchbar, self.qtablewidget, self.tabs, self.dlbutton, self.horizontal_layout)
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)
@@ -199,7 +198,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
toolbar = QToolBar("Main Toolbar") toolbar = QToolBar("Main Toolbar")
self.addToolBar(toolbar) self.addToolBar(toolbar)
toolbar.setLayoutDirection(Qt.RightToLeft) toolbar.setLayoutDirection(Qt.RightToLeft)
self.tracker_list = QComboBox() self.tracker_list = QComboBox()
self.tracker_list.addItems(["rutracker", "uztracker", "m0nkrus"]) self.tracker_list.addItems(["rutracker", "uztracker", "m0nkrus"])
self.tracker_list.activated.connect(self.set_tracker) self.tracker_list.activated.connect(self.set_tracker)
@@ -217,7 +216,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.progressbar.setValue(0) self.progressbar.setValue(0)
containerLayout.addWidget(self.progressbar) containerLayout.addWidget(self.progressbar)
self.progress_timer = QTimer() self.progress_timer = QTimer()
self.progress_timer.timeout.connect(lambda: run_thread(threading.Thread(target=self.update_progress))) self.progress_timer.timeout.connect(lambda: run_thread(threading.Thread(target=self.update_progress)))
self.progress_timer.start(1000) self.progress_timer.start(1000)