Compare commits

...

5 Commits

3 changed files with 42 additions and 22 deletions
+4 -4
View File
@@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-22.04
artifact_name: SoftwareManager-dev-${{ github.sha }}-linux
asset_name: SoftwareManager-dev-${{ github.sha }}-linux
- os: windows-latest
@@ -159,7 +159,7 @@ jobs:
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: success()
steps:
@@ -172,7 +172,7 @@ jobs:
run: |
mkdir -p release
SHORT_SHA="${{ needs.build.outputs.short_sha }}"
cp artifacts/ubuntu-latest-build/SoftwareManager-dev-*-linux release/SoftwareManager-dev-${SHORT_SHA}-linux
cp artifacts/ubuntu-22.04-build/SoftwareManager-dev-*-linux release/SoftwareManager-dev-${SHORT_SHA}-linux
cp artifacts/windows-latest-build/SoftwareManager-dev-*-windows.exe release/SoftwareManager-dev-${SHORT_SHA}-windows.exe
cp artifacts/macos-latest-build/SoftwareManager-dev-*-macos release/SoftwareManager-dev-${SHORT_SHA}-macos
chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos
@@ -207,4 +207,4 @@ jobs:
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-windows.exe
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+11 -8
View File
@@ -13,6 +13,7 @@ from PySide6.QtWidgets import (
QSpinBox,
QCheckBox,
)
import platform
def settings_dialog(self):
@@ -32,14 +33,16 @@ def settings_dialog(self):
update_checkbox_layout = QHBoxLayout()
# ignore updates checkbox
update_checkbox = QCheckBox()
update_checkbox_container.setLayout(update_checkbox_layout)
update_checkbox_layout.addWidget(QLabel("Ignore Updates: "))
update_checkbox_layout.addStretch()
update_checkbox.setChecked(state.ignore_updates)
update_checkbox.toggled.connect(lambda checked: setattr(state, 'ignore_updates', checked))
update_checkbox_layout.addWidget(update_checkbox)
dialog.layout().addWidget(update_checkbox_container)
if platform.system() == "Windows":
update_checkbox = QCheckBox()
update_checkbox_container.setLayout(update_checkbox_layout)
update_checkbox_layout.addWidget(QLabel("Ignore Updates: "))
update_checkbox_layout.addStretch()
update_checkbox.setChecked(state.ignore_updates)
update_checkbox.toggled.connect(lambda checked: setattr(state, 'ignore_updates', checked))
update_checkbox_layout.addWidget(update_checkbox)
dialog.layout().addWidget(update_checkbox_container)
# auto-resume downloads checkbox
+27 -10
View File
@@ -20,7 +20,7 @@ from PySide6.QtWidgets import (
QStyleOptionButton,
QStyledItemDelegate,
QApplication,
)
)
from PySide6.QtGui import QIcon, QAction, QCloseEvent, QImage, QPixmap
import darkdetect
@@ -210,9 +210,11 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
elif col == 4:
return f"{download.download_speed_string()}"
elif col == 5:
pass
return f"{download.completed_length_string()}"
elif col == 6:
return f"{download.total_length_string()}"
elif col == 7:
return f"{download.eta_string()}"
if role == Qt.UserRole and col == 0:
return download.is_paused
@@ -221,12 +223,27 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def toggle_pause_resume(self, row):
download = state.downloads[row]
if download.progress == 100:
if state.download_path is not None and os.path.exists(state.download_path):
if platform.system() == "Windows":
os.startfile(os.path.normpath(state.download_path))
elif platform.system() == "Linux":
subprocess.Popen(["xdg-open", state.download_path])
else:
if platform.system() == "Windows":
os.startfile(os.path.normpath(os.getcwd()))
elif platform.system() == "Linux":
subprocess.Popen(["xdg-open", os.getcwd()])
return
if download.is_paused:
download.resume()
consoleLog(f"Resumed download: {download.name}", True)
else:
download.pause()
consoleLog(f"Paused download: {download.name}", True)
idx = self.index(row, 0)
self.dataChanged.emit(idx, idx, [Qt.DisplayRole, Qt.UserRole])
self.dataChanged.emit(idx, idx, [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.UserRole])
class PauseResumeDelegate(QStyledItemDelegate):
clicked = Signal(int)
@@ -237,10 +254,16 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
return
paused = index.data(Qt.UserRole)
download = state.downloads[index.row()]
button = QStyleOptionButton()
button.rect = option.rect
button.text = "▶︎" if paused else "⏸︎"
if download.progress == 100:
button.text = "📁"
else:
button.text = "▶︎" if paused else "⏸︎"
button.state = QStyle.State_Enabled
QApplication.style().drawControl(
@@ -266,12 +289,6 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def on_pause_resume_clicked(row):
download_model.toggle_pause_resume(row)
download = state.downloads[row]
if download.is_paused:
download.pause()
else:
download.resume()
delegate = PauseResumeDelegate(self.downloadList)
self.downloadList.setItemDelegateForColumn(0, delegate)
delegate.clicked.connect(on_pause_resume_clicked)