Fummeljob hierum darum
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
from .DbManager import DbManager
|
||||
from ..PyqcrmFlags import PyqcrmFlags
|
||||
from ..Vermasseln import Vermasseln
|
||||
from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
|
||||
#from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput : Not working well with Nuitka
|
||||
import soundfile as sf
|
||||
import sounddevice as sd
|
||||
from .UserDAO import UserDAO
|
||||
from PySide6.QtCore import Slot, QObject, Signal, QUrl
|
||||
from PySide6.QtCore import Slot, QObject, Signal, QUrl, QFile
|
||||
import tempfile
|
||||
|
||||
|
||||
|
||||
class UserManager(QObject):
|
||||
@@ -61,12 +65,24 @@ class UserManager(QObject):
|
||||
if user:
|
||||
self.__checkPassword(password, user[2])
|
||||
else:
|
||||
player = QMediaPlayer(self)
|
||||
audioOutput = QAudioOutput(self)
|
||||
player.setAudioOutput(audioOutput)
|
||||
player.setSource(QUrl("qrc:/sounds/fail2c.ogg"))
|
||||
audioOutput.setVolume(150)
|
||||
player.play()
|
||||
fail_src = ":/sounds/fail2c.ogg"
|
||||
with tempfile.NamedTemporaryFile(suffix='.ogg') as ogg_file:
|
||||
failure_sound = QFile(fail_src)
|
||||
if not failure_sound.open(QFile.ReadOnly):
|
||||
print(f"Failed to open resource file: {fail_src}")
|
||||
else:
|
||||
ogg_file.write(failure_sound.readAll())
|
||||
ogg_path = ogg_file.name
|
||||
fail, samplerate = sf.read(ogg_path)
|
||||
sd.play(fail, samplerate)
|
||||
|
||||
### Not working with Nuitka
|
||||
# player = QMediaPlayer(self)
|
||||
# audioOutput = QAudioOutput(self)
|
||||
# player.setAudioOutput(audioOutput)
|
||||
# player.setSource(QUrl("qrc:/sounds/fail2c.ogg"))
|
||||
# audioOutput.setVolume(150)
|
||||
# player.play()
|
||||
|
||||
def __checkPassword(self, password, hash_password):
|
||||
pw_list = hash_password.split("$")
|
||||
|
||||
Reference in New Issue
Block a user