aboutsummaryrefslogtreecommitdiff
path: root/src/components/sound.py
diff options
context:
space:
mode:
authortassaron2026-01-11 14:29:58 -0500
committertassaron2026-01-11 14:29:58 -0500
commit669756b391d26661cf2e2a97a304e73343ef6655 (patch)
tree9cf2d4858c209bdab9f44d5c7f95c2a30b37f7a6 /src/components/sound.py
parent9d45f7f1a986aaa5d3c084c7ae747442b94a61b1 (diff)
update to Qt 6 and Pillow 12
and yeah, I accidentally ran black on the codebase. I don't want to spend more free time fixing that. All of these changes are simple renames or removals, nothing too major.
Diffstat (limited to 'src/components/sound.py')
-rw-r--r--src/components/sound.py54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/components/sound.py b/src/components/sound.py
index 118ea23..2df8e38 100644
--- a/src/components/sound.py
+++ b/src/components/sound.py
@@ -1,4 +1,4 @@
-from PyQt5 import QtGui, QtCore, QtWidgets
+from PyQt6 import QtGui, QtCore, QtWidgets
import os
from ..component import Component
@@ -6,25 +6,28 @@ from ..toolkit.frame import BlankFrame
class Component(Component):
- name = 'Sound'
- version = '1.0.0'
+ name = "Sound"
+ version = "1.0.0"
def widget(self, *args):
super().widget(*args)
self.page.pushButton_sound.clicked.connect(self.pickSound)
- self.trackWidgets({
- 'sound': self.page.lineEdit_sound,
- 'chorus': self.page.checkBox_chorus,
- 'delay': self.page.spinBox_delay,
- 'volume': self.page.spinBox_volume,
- }, commandArgs={
- 'sound': None,
- })
+ self.trackWidgets(
+ {
+ "sound": self.page.lineEdit_sound,
+ "chorus": self.page.checkBox_chorus,
+ "delay": self.page.spinBox_delay,
+ "volume": self.page.spinBox_volume,
+ },
+ commandArgs={
+ "sound": None,
+ },
+ )
def properties(self):
- props = ['static', 'audio']
+ props = ["static", "audio"]
if not os.path.exists(self.sound):
- props.append('error')
+ props.append("error")
return props
def error(self):
@@ -36,20 +39,22 @@ class Component(Component):
def audio(self):
params = {}
if self.delay != 0.0:
- params['adelay'] = '=%s' % str(int(self.delay * 1000.00))
+ params["adelay"] = "=%s" % str(int(self.delay * 1000.00))
if self.chorus:
- params['chorus'] = \
- '=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3'
+ params["chorus"] = "=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3"
if self.volume != 1.0:
- params['volume'] = '=%s:replaygain_noclip=0' % str(self.volume)
+ params["volume"] = "=%s:replaygain_noclip=0" % str(self.volume)
return (self.sound, params)
def pickSound(self):
sndDir = self.settings.value("componentDir", os.path.expanduser("~"))
filename, _ = QtWidgets.QFileDialog.getOpenFileName(
- self.page, "Choose Sound", sndDir,
- "Audio Files (%s)" % " ".join(self.core.audioFormats))
+ self.page,
+ "Choose Sound",
+ sndDir,
+ "Audio Files (%s)" % " ".join(self.core.audioFormats),
+ )
if filename:
self.settings.setValue("componentDir", os.path.dirname(filename))
self.mergeUndo = False
@@ -57,14 +62,13 @@ class Component(Component):
self.mergeUndo = True
def commandHelp(self):
- print('Path to audio file:\n path=/filepath/to/sound.ogg')
+ print("Path to audio file:\n path=/filepath/to/sound.ogg")
def command(self, arg):
- if '=' in arg:
- key, arg = arg.split('=', 1)
- if key == 'path':
- if '*%s' % os.path.splitext(arg)[1] \
- not in self.core.audioFormats:
+ if "=" in arg:
+ key, arg = arg.split("=", 1)
+ if key == "path":
+ if "*%s" % os.path.splitext(arg)[1] not in self.core.audioFormats:
print("Not a supported audio format")
quit(1)
self.page.lineEdit_sound.setText(arg)