mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 01:49:42 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b783d0a0cb | |||
| d057624548 |
@@ -13,6 +13,7 @@ from PySide6.QtWidgets import (
|
|||||||
QSpinBox,
|
QSpinBox,
|
||||||
QCheckBox,
|
QCheckBox,
|
||||||
)
|
)
|
||||||
|
import platform
|
||||||
|
|
||||||
|
|
||||||
def settings_dialog(self):
|
def settings_dialog(self):
|
||||||
@@ -32,14 +33,16 @@ def settings_dialog(self):
|
|||||||
update_checkbox_layout = QHBoxLayout()
|
update_checkbox_layout = QHBoxLayout()
|
||||||
|
|
||||||
# ignore updates checkbox
|
# ignore updates checkbox
|
||||||
update_checkbox = QCheckBox()
|
|
||||||
update_checkbox_container.setLayout(update_checkbox_layout)
|
if platform.system() == "Windows":
|
||||||
update_checkbox_layout.addWidget(QLabel("Ignore Updates: "))
|
update_checkbox = QCheckBox()
|
||||||
update_checkbox_layout.addStretch()
|
update_checkbox_container.setLayout(update_checkbox_layout)
|
||||||
update_checkbox.setChecked(state.ignore_updates)
|
update_checkbox_layout.addWidget(QLabel("Ignore Updates: "))
|
||||||
update_checkbox.toggled.connect(lambda checked: setattr(state, 'ignore_updates', checked))
|
update_checkbox_layout.addStretch()
|
||||||
update_checkbox_layout.addWidget(update_checkbox)
|
update_checkbox.setChecked(state.ignore_updates)
|
||||||
dialog.layout().addWidget(update_checkbox_container)
|
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
|
# auto-resume downloads checkbox
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -223,8 +225,10 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
download = state.downloads[row]
|
download = state.downloads[row]
|
||||||
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.DisplayRole, Qt.UserRole])
|
||||||
|
|
||||||
@@ -266,12 +270,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)
|
||||||
|
|||||||
Reference in New Issue
Block a user