aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SoundListItemWidget.py27
-rw-r--r--main.py2
2 files changed, 23 insertions, 6 deletions
diff --git a/SoundListItemWidget.py b/SoundListItemWidget.py
index 92ba827..194b633 100644
--- a/SoundListItemWidget.py
+++ b/SoundListItemWidget.py
@@ -14,8 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
+import sys
+import shutil
+from pathlib import Path
+
from PySide6.QtCore import Signal
-from PySide6.QtWidgets import QFrame, QHBoxLayout, QLabel, QPushButton
+from PySide6.QtWidgets import QFrame, QHBoxLayout, QLabel, QPushButton, QFileDialog
from Soundboard import SoundboardSound
@@ -23,7 +27,7 @@ from Soundboard import SoundboardSound
class SoundListItemWidget(QFrame):
play_requested = Signal(SoundboardSound)
- def __init__(self, sound: SoundboardSound, parent=None): # noqa: F821
+ def __init__(self, sound: SoundboardSound, parent=None):
super().__init__(parent)
self.sound = sound
@@ -51,10 +55,23 @@ class SoundListItemWidget(QFrame):
self.title_label.setFont(font)
layout.addWidget(self.title_label, stretch=1)
- # self.btn_download = QPushButton("Download")
- # self.btn_download.clicked.connect(lambda: self.download_requested.emit(self.sound_data))
- # layout.addWidget(self.btn_download)
+ self.btn_download = QPushButton("Download")
+ self.btn_download.clicked.connect(self.download)
+ layout.addWidget(self.btn_download)
self.btn_play = QPushButton("Play")
self.btn_play.clicked.connect(lambda: self.play_requested.emit(self.sound))
layout.addWidget(self.btn_play)
+
+ def download(self):
+ selected_folder = QFileDialog.getSaveFileName(
+ self,
+ "Save Audio File",
+ self.sound.title + Path(self.sound.path).suffix,
+ "All Files (*)"
+ )
+ if selected_folder:
+ self.download_dest = Path(selected_folder[0])
+ print(self.download_dest)
+
+ shutil.copy2(self.sound.path, self.download_dest)
diff --git a/main.py b/main.py
index 7b035d5..f3aacac 100644
--- a/main.py
+++ b/main.py
@@ -25,7 +25,7 @@ from Soundboard import Soundboard
from SoundboardEngine import SoundboardEngineWindow
from SoundboardUpdater import SoundboardUpdaterWindow
-APP_VERSION = "0.2.0"
+APP_VERSION = "0.3.0"
if __name__ == "__main__":
config_path = (