Merge pull request #46 from KeksPirates/feat/improve-code-quality

feat: improve output statements on exception blocks
This commit is contained in:
shayaa
2026-03-15 23:20:19 +01:00
committed by GitHub
6 changed files with 15 additions and 13 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
from core.utils.logging.loghandler import consoleLog
from core.utils.logging.logs import consoleLog
import requests
import re
+4 -4
View File
@@ -86,8 +86,8 @@ class ContextMenu:
if state.dl_session:
try:
state.dl_session.remove_torrent(magnetdl)
except Exception:
pass
except Exception as e:
consoleLog(f"Exception while removing download from LibTorrent: {e}")
consoleLog(f"Cancelled download: {torrent_name}", True)
@@ -125,8 +125,8 @@ class ContextMenu:
try:
state.dl_session.remove_torrent(magnetdl)
time.sleep(0.5)
except Exception:
pass
except Exception as e:
consoleLog(f"Exception while removing download from LibTorrent: {e}")
if download_path and os.path.exists(download_path):
import shutil
last_error = None
+3 -2
View File
@@ -3,6 +3,7 @@ from core.interface.dialogs.hoverrowdelegate import HoverRowDelegate
from core.interface.dialogs.downloadmodel import DownloadModel
from core.interface.dialogs.theme import _table_stylesheet
from PySide6.QtWidgets import QTableView, QHeaderView
from core.utils.logging.logs import consoleLog
from PySide6 import QtWidgets
from PySide6.QtCore import Qt
@@ -84,5 +85,5 @@ def download_list_update(self):
if editor and delegate:
try:
delegate.setEditorData(editor, idx)
except RuntimeError:
pass
except RuntimeError as e:
consoleLog(f"Exception while updating download list: {e}")
+2 -2
View File
@@ -117,8 +117,8 @@ class DownloadModel(QAbstractTableModel):
subprocess.Popen(["xdg-open", save_path])
elif platform.system() == "Darwin":
subprocess.Popen(["open", save_path])
except Exception:
pass
except Exception as e:
consoleLog(f"Exception while opening file: {e}")
return
is_paused = status.paused
+3 -2
View File
@@ -1,3 +1,4 @@
from core.utils.logging.logs import consoleLog
from core.utils.data.state import state
from PySide6.QtCore import QEvent
@@ -30,6 +31,6 @@ def eventFilter(self, obj, event):
old_row = self._hovered_row
self._hovered_row = -1
self._invalidate_hover_row(old_row)
except (RuntimeError, AttributeError):
pass
except (RuntimeError, AttributeError) as e:
consoleLog(f"Exception in EventFilter: {e}")
return super(type(self), self).eventFilter(obj, event)
+2 -2
View File
@@ -86,7 +86,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
except Exception as e:
consoleLog(f"Could not set app ID: {e}")
core.interface.dialogs.update
# core.interface.dialogs.update
self.setWindowTitle("Software Manager")
self.setGeometry(100, 100, 800, 600)
@@ -131,7 +131,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
containerLayout.addWidget(self.searchbar)
containerLayout.addWidget(state.trackertable)
core.interface.dialogs.hoverrowdelegate
# core.interface.dialogs.hoverrowdelegate
self.download_model = DownloadModel()
self.downloadList = _create_download_list(self)
self.downloadList.viewport().installEventFilter(self)