Compare commits

..

7 Commits

3 changed files with 66 additions and 23 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-22.04
artifact_name: SoftwareManager-dev-${{ github.sha }}-linux artifact_name: SoftwareManager-dev-${{ github.sha }}-linux
asset_name: SoftwareManager-dev-${{ github.sha }}-linux asset_name: SoftwareManager-dev-${{ github.sha }}-linux
- os: windows-latest - os: windows-latest
@@ -159,7 +159,7 @@ jobs:
release: release:
name: Create Release name: Create Release
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-22.04
if: success() if: success()
steps: steps:
@@ -172,7 +172,7 @@ jobs:
run: | run: |
mkdir -p release mkdir -p release
SHORT_SHA="${{ needs.build.outputs.short_sha }}" 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/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 cp artifacts/macos-latest-build/SoftwareManager-dev-*-macos release/SoftwareManager-dev-${SHORT_SHA}-macos
chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos
+22
View File
@@ -12,7 +12,9 @@ from PySide6.QtWidgets import (
QHBoxLayout, QHBoxLayout,
QSpinBox, QSpinBox,
QCheckBox, QCheckBox,
QFileDialog,
) )
import platform
def settings_dialog(self): def settings_dialog(self):
@@ -32,6 +34,8 @@ def settings_dialog(self):
update_checkbox_layout = QHBoxLayout() update_checkbox_layout = QHBoxLayout()
# ignore updates checkbox # ignore updates checkbox
if platform.system() == "Windows":
update_checkbox = QCheckBox() update_checkbox = QCheckBox()
update_checkbox_container.setLayout(update_checkbox_layout) update_checkbox_container.setLayout(update_checkbox_layout)
update_checkbox_layout.addWidget(QLabel("Ignore Updates: ")) update_checkbox_layout.addWidget(QLabel("Ignore Updates: "))
@@ -111,6 +115,15 @@ def settings_dialog(self):
download_path.setText(state.download_path) download_path.setText(state.download_path)
dialog.layout().addWidget(download_path_container) dialog.layout().addWidget(download_path_container)
def browse_download_path():
dir_path = QFileDialog.getExistingDirectory(dialog, "Select Download Directory", state.download_path)
if dir_path:
download_path.setText(dir_path)
browse_button = QPushButton("📁")
download_path_layout.addWidget(browse_button)
browse_button.clicked.connect(browse_download_path)
################## ##################
# SPEED LIMITING # # SPEED LIMITING #
################## ##################
@@ -144,6 +157,15 @@ def settings_dialog(self):
image_path.setText(state.image_path) image_path.setText(state.image_path)
dialog.layout().addWidget(image_path_container) dialog.layout().addWidget(image_path_container)
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)
############### ###############
# SAVE/CANCEL # # SAVE/CANCEL #
############### ###############
+29 -8
View File
@@ -210,9 +210,11 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
elif col == 4: elif col == 4:
return f"{download.download_speed_string()}" return f"{download.download_speed_string()}"
elif col == 5: elif col == 5:
pass return f"{download.completed_length_string()}"
elif col == 6: elif col == 6:
return f"{download.total_length_string()}" return f"{download.total_length_string()}"
elif col == 7:
return f"{download.eta_string()}"
if role == Qt.UserRole and col == 0: if role == Qt.UserRole and col == 0:
return download.is_paused return download.is_paused
@@ -221,12 +223,31 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def toggle_pause_resume(self, row): def toggle_pause_resume(self, row):
download = state.downloads[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])
elif platform.system() == "Darwin":
subprocess.Popen(["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()])
elif platform.system() == "Darwin":
subprocess.Popen(["open", os.getcwd()])
return
if download.is_paused: if download.is_paused:
download.resume() download.resume()
consoleLog(f"Resumed download: {download.name}", True)
else: else:
download.pause() download.pause()
consoleLog(f"Paused download: {download.name}", True)
idx = self.index(row, 0) 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): class PauseResumeDelegate(QStyledItemDelegate):
clicked = Signal(int) clicked = Signal(int)
@@ -237,10 +258,16 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
return return
paused = index.data(Qt.UserRole) paused = index.data(Qt.UserRole)
download = state.downloads[index.row()]
button = QStyleOptionButton() button = QStyleOptionButton()
button.rect = option.rect button.rect = option.rect
if download.progress == 100:
button.text = "📁"
else:
button.text = "▶︎" if paused else "⏸︎" button.text = "▶︎" if paused else "⏸︎"
button.state = QStyle.State_Enabled button.state = QStyle.State_Enabled
QApplication.style().drawControl( QApplication.style().drawControl(
@@ -266,12 +293,6 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def on_pause_resume_clicked(row): def on_pause_resume_clicked(row):
download_model.toggle_pause_resume(row) download_model.toggle_pause_resume(row)
download = state.downloads[row]
if download.is_paused:
download.pause()
else:
download.resume()
delegate = PauseResumeDelegate(self.downloadList) delegate = PauseResumeDelegate(self.downloadList)
self.downloadList.setItemDelegateForColumn(0, delegate) self.downloadList.setItemDelegateForColumn(0, delegate)
delegate.clicked.connect(on_pause_resume_clicked) delegate.clicked.connect(on_pause_resume_clicked)