Skip to content

Commit

Permalink
Reenable start button after a second 1. Fixed profile corruption.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasedv committed Oct 30, 2018
1 parent 8c502be commit 2e721e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion Modules/download_tab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtWidgets import QWidget, QPushButton, QLabel, QTextBrowser, QCheckBox, \
QHBoxLayout, QVBoxLayout

Expand All @@ -14,6 +14,7 @@ def __init__(self, settings: SettingsClass, parent=None):

# Starts the program (Youtube-dl)
self.start_btn = QPushButton('Download')
self.start_btn.clicked.connect(self.start_button_timer)
# stops the program
self.stop_btn = QPushButton('Abort')
# Closes window (also stops the program)
Expand All @@ -28,6 +29,11 @@ def __init__(self, settings: SettingsClass, parent=None):
self.profile_dropdown = DropDown(self)
self.profile_dropdown.setFixedWidth(100)

self.timer = QTimer(self)
self.timer.setInterval(100)
self.timer.setSingleShot(True)
self.timer.timeout.connect(lambda: self.start_btn.setDisabled(False))

if settings.profiles:
for profile in settings.profiles:
self.profile_dropdown.addItem(profile)
Expand Down Expand Up @@ -90,6 +96,10 @@ def __init__(self, settings: SettingsClass, parent=None):

self.setLayout(self.QV)

def start_button_timer(self, state):
if not state:
self.timer.start(1000)


if __name__ == '__main__':
# Only visual aspects work here!!
Expand Down
4 changes: 2 additions & 2 deletions utils/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def change_profile(self, profile):
self._parameters[param]['options'] = data['options'] + \
[i for i in self._parameters[param]['options'] if
i not in data['options']]
del data['options']
self._parameters[param].update(data)
new_data = {k: v for k, v in data.items() if k != 'options'}
self._parameters[param].update(new_data)
else:
self._parameters[param].update(data)

Expand Down

0 comments on commit 2e721e3

Please sign in to comment.