Skip to content

Commit 20989e6

Browse files
committed
Try fix issue #27
1 parent abc4fd1 commit 20989e6

File tree

6 files changed

+53
-807
lines changed

6 files changed

+53
-807
lines changed

Threads/Download.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def hook(self, li):
6363
self.speed,
6464
li.get("status"),
6565
]
66-
) # type: ignore
66+
)
6767

6868
elif li.get("status") == "finished":
6969
self.file_name = str(Path(_file_name).stem)
@@ -76,7 +76,7 @@ def hook(self, li):
7676
self.speed,
7777
"Converting",
7878
]
79-
) # type: ignore
79+
)
8080
else:
8181
self.bytes = self.format_bytes(li.get("total_bytes"))
8282
self.file_name = Path(_file_name).name
@@ -91,9 +91,9 @@ def hook(self, li):
9191
self.speed,
9292
"Finished",
9393
]
94-
) # type: ignore
95-
self.signals.status_bar_signal.emit("Already Downloaded") # type: ignore
96-
self.signals.remove_row_signal.emit() # type: ignore
94+
)
95+
self.signals.status_bar_signal.emit("Already Downloaded")
96+
self.signals.remove_row_signal.emit()
9797

9898
def _prepare_ytd_options(self):
9999
ydl_options = {
@@ -128,20 +128,20 @@ def download(self):
128128
youtube_dl.utils.UnavailableVideoError,
129129
) as e:
130130
self.error_occurred = True
131-
self.signals.remove_row_signal.emit() # type: ignore
132-
self.signals.remove_url_signal.emit(self.url) # type: ignore
133-
self.signals.status_bar_signal.emit(str(e)) # type: ignore
131+
self.signals.remove_row_signal.emit()
132+
self.signals.remove_url_signal.emit(self.url)
133+
self.signals.status_bar_signal.emit(str(e))
134134
except StopError:
135135
# import threading
136136
# print("Exiting thread:", threading.currentThread().getName())
137137
self.done = True
138-
self.signals.finished.emit() # type: ignore
138+
self.signals.finished.emit()
139139

140140
@QtCore.pyqtSlot()
141141
def run(self):
142142
self.signals.add_update_list_signal.emit(
143143
[self.local_rowcount, self.url, "", "", "", "Starting"]
144-
) # type: ignore
144+
)
145145

146146
self.download()
147147

@@ -155,12 +155,12 @@ def run(self):
155155
self.speed,
156156
"Finished",
157157
]
158-
) # type: ignore
158+
)
159159

160-
self.signals.status_bar_signal.emit("Done!") # type: ignore
161-
self.signals.remove_url_signal.emit(self.url) # type: ignore
160+
self.signals.status_bar_signal.emit("Done!")
161+
self.signals.remove_url_signal.emit(self.url)
162162
self.done = True
163-
self.signals.finished.emit() # type: ignore
163+
self.signals.finished.emit()
164164

165165
def stop(self):
166166
self.done = True

Threads/PostProcessor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def run(self):
8989
self.speed,
9090
"Converting...",
9191
]
92-
) # type: ignore
93-
self.signals.statusBar_Signal.emit("Converting...") # type: ignore
92+
)
93+
self.signals.statusBar_Signal.emit("Converting...")
9494
self.convert()
9595
self.signals.list_Signal.emit(
9696
[
@@ -101,8 +101,8 @@ def run(self):
101101
self.speed,
102102
"Finished",
103103
]
104-
) # type: ignore
105-
self.signals.statusBar_Signal.emit("Done!") # type: ignore
104+
)
105+
self.signals.statusBar_Signal.emit("Done!")
106106

107107
# TODO: Move to utils
108108
def format_bytes(self, _bytes=None):

UI/gui.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# -*- coding: utf-8 -*-
22

3-
# Form implementation generated from reading ui file 'resources\gui_qt-designer-beta.ui'
3+
# Form implementation generated from reading ui file '.\resources\gui_qt-designer.ui'
44
#
5-
# Created by: PyQt5 UI code generator 5.9.2
5+
# Created by: PyQt5 UI code generator 5.15.4
66
#
7-
# WARNING! All changes made in this file will be lost!
7+
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
8+
# run again. Do not edit this file unless you know what you are doing.
9+
810

911
from PyQt5 import QtCore, QtGui, QtWidgets
1012

13+
1114
class Ui_MainWindow(object):
1215
def setupUi(self, MainWindow):
1316
MainWindow.setObjectName("MainWindow")
@@ -36,7 +39,6 @@ def setupUi(self, MainWindow):
3639
" border-top: 1px solid #C2C7CB;\n"
3740
" position: absolute;\n"
3841
" top: -0.5em;\n"
39-
" background: white;\n"
4042
" }\n"
4143
"\n"
4244
" QTabWidget::tab-bar {\n"
@@ -63,7 +65,6 @@ def setupUi(self, MainWindow):
6365
"\n"
6466
" QTabBar::tab:selected {\n"
6567
" border-color:#C4C4C3;\n"
66-
"\n"
6768
" }")
6869
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.North)
6970
self.tabWidget.setDocumentMode(False)
@@ -259,7 +260,7 @@ def setupUi(self, MainWindow):
259260
self.verticalLayout_2.addLayout(self.verticalLayout)
260261
MainWindow.setCentralWidget(self.centralwidget)
261262
self.menubar = QtWidgets.QMenuBar(MainWindow)
262-
self.menubar.setGeometry(QtCore.QRect(0, 0, 561, 19))
263+
self.menubar.setGeometry(QtCore.QRect(0, 0, 561, 21))
263264
self.menubar.setObjectName("menubar")
264265
self.menuFile = QtWidgets.QMenu(self.menubar)
265266
self.menuFile.setObjectName("menuFile")
@@ -292,7 +293,7 @@ def setupUi(self, MainWindow):
292293

293294
def retranslateUi(self, MainWindow):
294295
_translate = QtCore.QCoreApplication.translate
295-
MainWindow.setWindowTitle(_translate("MainWindow", "youtube-dl v0.4.1"))
296+
MainWindow.setWindowTitle(_translate("MainWindow", "youtube-dl v0.4.3"))
296297
self.groupBox.setTitle(_translate("MainWindow", "Enter url and download location"))
297298
self.label_2.setText(_translate("MainWindow", "Video URL:"))
298299
self.label_3.setText(_translate("MainWindow", "Save To:"))
@@ -341,5 +342,4 @@ def retranslateUi(self, MainWindow):
341342
self.actionLicense.setText(_translate("MainWindow", "License"))
342343
self.actionOptions.setText(_translate("MainWindow", "Options"))
343344
self.actionAbout.setText(_translate("MainWindow", "About"))
344-
345345
from UI import resource_rc

main.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ def __init__(self, parent=None, *args, **kwargs):
4242
self.ui.setupUi(self)
4343
# For getting the icon to work
4444
try:
45-
from PyQt5.QtWinExtras import QtWin # type: ignore
45+
from PyQt5.QtWinExtras import QtWin
4646

4747
myappid = "my_company.my_product.sub_product.version"
48-
QtWin.setCurrentProcessExplicitAppUserModelID(myappid)
48+
QtWin.setCurrentProcessExplicitAppUserModelID(myappid) # type: ignore
4949
except ImportError:
5050
pass
5151

@@ -59,7 +59,7 @@ def __init__(self, parent=None, *args, **kwargs):
5959
self.batch_dialog = BatchAddDialogue(self)
6060
self.ui.saveToLineEdit.setText(desktop_path)
6161
self.ui.BrowseConvertToLineEdit.setText(str(Path().cwd()))
62-
self.ui.BrowseConvertLineEdit.files = [] # type: ignore
62+
self.ui.BrowseConvertLineEdit.files = []
6363
self.ui.statusbar.showMessage("Ready.")
6464
self.set_connections()
6565

@@ -130,7 +130,7 @@ def convert_file_browse(self):
130130
file_name = str(Path(file_names[0]).resolve())
131131
self.ui.BrowseConvertLineEdit.setText(file_name)
132132

133-
self.ui.BrowseConvertLineEdit.files = file_names # type: ignore
133+
self.ui.BrowseConvertLineEdit.files = file_names
134134

135135
def convert_file(self, file_path, out_path, preferred_format, delete_tmp=False):
136136
if Path(file_path).suffix == preferred_format:
@@ -148,9 +148,9 @@ def convert_file(self, file_path, out_path, preferred_format, delete_tmp=False):
148148
}
149149
# Using ThreadPool
150150
pprocessorThread = PostProcessor(options)
151-
pprocessorThread.signals.statusBar_Signal.connect(self.ui.statusbar.showMessage) # type: ignore
152-
pprocessorThread.signals.list_Signal.connect(self.add_to_table) # type: ignore
153-
pprocessorThread.signals.row_Signal.connect(self.decrease_rowcount) # type: ignore
151+
pprocessorThread.signals.statusBar_Signal.connect(self.ui.statusbar.showMessage)
152+
pprocessorThread.signals.list_Signal.connect(self.add_to_table)
153+
pprocessorThread.signals.row_Signal.connect(self.decrease_rowcount)
154154
self.threadpool.start(pprocessorThread)
155155

156156
self.ui.tabWidget.setCurrentIndex(2)
@@ -193,11 +193,11 @@ def download_url(self, url, row=None):
193193

194194
# Using ThreadPool
195195
downloadThread = Download(options)
196-
downloadThread.signals.status_bar_signal.connect(self.ui.statusbar.showMessage) # type: ignore
197-
downloadThread.signals.remove_url_signal.connect(self.remove_url) # type: ignore
198-
downloadThread.signals.add_update_list_signal.connect(self.add_to_table) # type: ignore
199-
downloadThread.signals.remove_row_signal.connect(self.decrease_rowcount) # type: ignore
200-
self.closing.closed.connect(downloadThread.stop) # type: ignore
196+
downloadThread.signals.status_bar_signal.connect(self.ui.statusbar.showMessage)
197+
downloadThread.signals.remove_url_signal.connect(self.remove_url)
198+
downloadThread.signals.add_update_list_signal.connect(self.add_to_table)
199+
downloadThread.signals.remove_row_signal.connect(self.decrease_rowcount)
200+
self.closing.closed.connect(downloadThread.stop)
201201
self.threadpool.start(downloadThread)
202202

203203
self.ui.tabWidget.setCurrentIndex(2)
@@ -286,7 +286,7 @@ def closeEvent(self, event):
286286
msgBox.setWindowTitle("Exit")
287287
msgBox.setText("Some files are currently being downloaded.")
288288
msgBox.setInformativeText("Do you really want to close?")
289-
msgBox.setStandardButtons(QtWidgets.QMessageBox.Close | QtWidgets.QMessageBox.Cancel) # type: ignore
289+
msgBox.setStandardButtons(QtWidgets.QMessageBox.Close | QtWidgets.QMessageBox.Cancel)
290290
msgBox.setDefaultButton(QtWidgets.QMessageBox.Cancel)
291291
ret = msgBox.exec_()
292292
if ret == QtWidgets.QMessageBox.Cancel:
@@ -297,7 +297,7 @@ def closeEvent(self, event):
297297
self.kill_all_threads()
298298

299299
def kill_all_threads(self):
300-
self.closing.closed.emit() # type: ignore
300+
self.closing.closed.emit()
301301
self.threadpool.waitForDone()
302302
self.close()
303303

0 commit comments

Comments
 (0)