mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
fix a bunch of lsp errors
This commit is contained in:
+11
-12
@@ -1,5 +1,5 @@
|
|||||||
from PySide6 import QtWidgets, QtCore, QtGui
|
from PySide6 import QtWidgets
|
||||||
from PySide6.QtCore import Qt, QTimer, QModelIndex, QAbstractTableModel, Signal, QEvent, QSize
|
from PySide6.QtCore import QPersistentModelIndex, Qt, QTimer, QModelIndex, QAbstractTableModel, Signal, QEvent, QSize
|
||||||
from PySide6.QtWidgets import (
|
from PySide6.QtWidgets import (
|
||||||
QLineEdit,
|
QLineEdit,
|
||||||
QTableView,
|
QTableView,
|
||||||
@@ -41,7 +41,6 @@ from core.interface.dialogs.settings import settings_dialog
|
|||||||
from core.interface.assets.base64_icons import settings_black_base64
|
from core.interface.assets.base64_icons import settings_black_base64
|
||||||
from core.interface.assets.base64_icons import settings_white_base64
|
from core.interface.assets.base64_icons import settings_white_base64
|
||||||
from core.interface.assets.base64_icons import logo_base64
|
from core.interface.assets.base64_icons import logo_base64
|
||||||
from core.network.libtorrent_misc import cleanup_session
|
|
||||||
from core.utils.general.shutdown import closehelper
|
from core.utils.general.shutdown import closehelper
|
||||||
|
|
||||||
|
|
||||||
@@ -183,19 +182,19 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.headers = ["Action", "Name", "Status", "Progress", "Speed", "Size", "Total Size"]
|
self.headers = ["Action", "Name", "Status", "Progress", "Speed", "Size", "Total Size"]
|
||||||
|
|
||||||
def rowCount(self, parent=QModelIndex()):
|
def rowCount(self, parent: QModelIndex | QPersistentModelIndex = QModelIndex()) -> int:
|
||||||
return len(state.active_downloads)
|
return len(state.active_downloads)
|
||||||
|
|
||||||
def columnCount(self, parent=QModelIndex()):
|
def columnCount(self, parent: QModelIndex | QPersistentModelIndex = QModelIndex()):
|
||||||
return len(self.headers)
|
return len(self.headers)
|
||||||
|
|
||||||
def headerData(self, section, orientation, role=Qt.DisplayRole):
|
def headerData(self, section, orientation, role: int = Qt.ItemDataRole.DisplayRole):
|
||||||
if role == Qt.DisplayRole and orientation == Qt.Horizontal:
|
if role == Qt.ItemDataRole.DisplayRole and orientation == Qt.Orientation.Horizontal:
|
||||||
return self.headers[section]
|
return self.headers[section]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def data(self, index, role=Qt.DisplayRole):
|
def data(self, index: QModelIndex | QPersistentModelIndex, role: int = Qt.ItemDataRole.DisplayRole):
|
||||||
if role == Qt.DisplayRole:
|
if role == Qt.ItemDataRole.DisplayRole:
|
||||||
col = index.column()
|
col = index.column()
|
||||||
|
|
||||||
if index.row() >= len(state.active_downloads) or index.row() < 0:
|
if index.row() >= len(state.active_downloads) or index.row() < 0:
|
||||||
@@ -211,9 +210,9 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
elif col == 1:
|
elif col == 1:
|
||||||
return status.name if status.has_metadata else "Fetching metadata..."
|
return status.name if status.has_metadata else "Fetching metadata..."
|
||||||
elif col == 2:
|
elif col == 2:
|
||||||
if status.state == lt.torrent_status.downloading:
|
if status.state == lt.torrent_status.downloading:
|
||||||
return "Downloading"
|
return "Downloading"
|
||||||
elif status.state == lt.torrent_status.seeding:
|
elif status.state == lt.torrent_status.seeding:
|
||||||
return "Seeding"
|
return "Seeding"
|
||||||
elif status.paused:
|
elif status.paused:
|
||||||
return "Paused"
|
return "Paused"
|
||||||
@@ -257,7 +256,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
else:
|
else:
|
||||||
return "∞" if status.paused else "Stalled"
|
return "∞" if status.paused else "Stalled"
|
||||||
|
|
||||||
if role == Qt.UserRole and index.column() == 0:
|
if role == Qt.ItemDataRole.UserRole and index.column() == 0:
|
||||||
magnet_link = list(state.active_downloads.keys())[index.row()]
|
magnet_link = list(state.active_downloads.keys())[index.row()]
|
||||||
magnetdl = state.active_downloads[magnet_link]
|
magnetdl = state.active_downloads[magnet_link]
|
||||||
return magnetdl.status().paused
|
return magnetdl.status().paused
|
||||||
|
|||||||
@@ -57,4 +57,4 @@ def update_log(shutdown_event):
|
|||||||
updated.add(magnet_uri)
|
updated.add(magnet_uri)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class AppState(QObject):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.posts: List[Dict[str, Any]] = []
|
self.posts: List[Dict[str, Any]] = []
|
||||||
self.post_titles: List[str] = []
|
self.post_titles: Optional[List] = None
|
||||||
self.post_urls: List[str] = []
|
self.post_urls: Optional[List] = None
|
||||||
self.post_author: List[str] = []
|
self.post_author: List[str] = []
|
||||||
self.post_seeders: List[str] = []
|
self.post_seeders: List[str] = []
|
||||||
self.post_leechers: List[str] = []
|
self.post_leechers: List[str] = []
|
||||||
@@ -29,11 +29,11 @@ class AppState(QObject):
|
|||||||
self.max_downloads: int = 10
|
self.max_downloads: int = 10
|
||||||
self.settings_path: str = ""
|
self.settings_path: str = ""
|
||||||
self.dl_session: Any = None
|
self.dl_session: Any = None
|
||||||
self.active_downloads: List[str] = {}
|
self.active_downloads: Dict = {}
|
||||||
self.window_transparency: bool = False
|
self.window_transparency: bool = False
|
||||||
self.interfaces: List = []
|
self.interfaces: List = []
|
||||||
self.active_interfaces: List = []
|
self.active_interfaces: List = []
|
||||||
self.bound_interface: str = None
|
self.bound_interface: Any = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def image_path(self) -> str:
|
def image_path(self) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user