Skip to content

Commit

Permalink
Fixed typo and Sonarlint analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpinet committed Jan 6, 2022
1 parent 4638435 commit e099de2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


unhandled_characters = ["\\", "/", ":", "*", "?", '"', "<", ">", "|"]
ICON_PATH = "ico\\nyaa.ico"


# ------------------------------CLASSES AND METHODS------------------------------
Expand All @@ -33,7 +34,7 @@ def setupUi(self, MainWindow) -> None:
"""

MainWindow.setObjectName("NyaaDownloader")
MainWindow.setWindowIcon(QtGui.QIcon("ico\\nyaa.ico"))
MainWindow.setWindowIcon(QtGui.QIcon(ICON_PATH))
MainWindow.resize(800, 440)
MainWindow.setMinimumSize(QtCore.QSize(800, 440))
MainWindow.setMaximumSize(QtCore.QSize(800, 440))
Expand Down Expand Up @@ -239,7 +240,7 @@ def show_error_popup(self, error_message: str) -> None:
msg.setIcon(QMessageBox.Critical)
msg.setText(error_message)
msg.setWindowTitle("NyaaDownloader")
msg.setWindowIcon(QtGui.QIcon("ico\\nyaa.ico"))
msg.setWindowIcon(QtGui.QIcon(ICON_PATH))
msg.exec_()

def show_info_popup(self, info_message: str):
Expand All @@ -255,7 +256,7 @@ def show_info_popup(self, info_message: str):
msg.setIcon(QMessageBox.Information)
msg.setText(info_message)
msg.setWindowTitle("NyaaDownloader")
msg.setWindowIcon(QtGui.QIcon("ico\\nyaa.ico"))
msg.setWindowIcon(QtGui.QIcon(ICON_PATH))
msg.exec_()

def set_widget_while_check(self) -> None:
Expand Down Expand Up @@ -314,8 +315,8 @@ def open_download_folder(self) -> None:
try:
os.startfile(f"{os.getcwd()}\DownloadedTorrents")

except:
self.show_error_popup("DownloadedTorrents folder not found")
except Exception as e:
self.show_error_popup("DownloadedTorrents folder not found because: " + str(e))

def notify(self, message: str) -> None:
"""Generate a windows 10 notifcation with a message
Expand Down Expand Up @@ -343,7 +344,7 @@ def save_logs(self) -> None:
if name != "":
with open(f"{name}.txt", "w") as f:
f.write(self.textBrowser.toPlainText())
except:
except Exception:
pass

def is_everything_good(self) -> None:
Expand Down Expand Up @@ -478,13 +479,12 @@ def run(self) -> None:
break

# I prefer this rather than a simple else because it's cleaner
elif option == 2:
if not nyaa.transfer(torrent):
self.error_popup.emit(
"No bittorrent client or web browser (that supports magnet links) found."
)
unexpected_end = True
break
elif option == 2 and not nyaa.transfer(torrent):
self.error_popup.emit(
"No bittorrent client or web browser (that supports magnet links) found."
)
unexpected_end = True
break

self.update_logs.emit(f"Found: {anime_name} - Episode {episode}")

Expand Down

0 comments on commit e099de2

Please sign in to comment.