mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b5c36030d | |||
| cc5f6a804c | |||
| b783d0a0cb |
@@ -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
|
||||
|
||||
|
||||
+26
-3
@@ -20,7 +20,7 @@ from PySide6.QtWidgets import (
|
||||
QStyleOptionButton,
|
||||
QStyledItemDelegate,
|
||||
QApplication,
|
||||
)
|
||||
)
|
||||
|
||||
from PySide6.QtGui import QIcon, QAction, QCloseEvent, QImage, QPixmap
|
||||
import darkdetect
|
||||
@@ -223,6 +223,23 @@ 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])
|
||||
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:
|
||||
download.resume()
|
||||
consoleLog(f"Resumed download: {download.name}", True)
|
||||
@@ -230,7 +247,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
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)
|
||||
@@ -241,10 +258,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(
|
||||
|
||||
Reference in New Issue
Block a user