Lint picking
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from typing import Optional, Type, cast
|
||||
|
||||
from PyQt6.QtCore import QObject, Qt, QUrl, pyqtSlot
|
||||
from PyQt6.QtMultimedia import (
|
||||
QAudioDevice,
|
||||
@@ -13,13 +15,13 @@ from PyQt6.QtMultimedia import (
|
||||
class SoundOff(QObject):
|
||||
_instance = None
|
||||
|
||||
def __new__(cls):
|
||||
def __new__(cls: Type[SoundOff]) -> SoundOff:
|
||||
if cls._instance:
|
||||
return cls._instance
|
||||
cls._instance = super(SoundOff, cls).__new__(cls)
|
||||
return cls._instance
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
#
|
||||
# Setup devices
|
||||
@@ -61,36 +63,38 @@ class SoundOff(QObject):
|
||||
self.virtualPlayer.playbackStateChanged.connect(self.playbackState)
|
||||
|
||||
@pyqtSlot()
|
||||
def alert(self):
|
||||
def alert(self) -> None:
|
||||
self.alertEffect.play()
|
||||
return
|
||||
|
||||
@pyqtSlot(QMediaPlayer.Error, str)
|
||||
def mediaError(self, error, string):
|
||||
def mediaError(self, error: QMediaPlayer.Error, string: str) -> None:
|
||||
print(error)
|
||||
print(str)
|
||||
return
|
||||
|
||||
@pyqtSlot(QMediaPlayer.MediaStatus)
|
||||
def mediaStatus(self, status):
|
||||
def mediaStatus(self, status: QMediaPlayer.MediaStatus) -> None:
|
||||
if status == QMediaPlayer.MediaStatus.LoadedMedia:
|
||||
self.sender().play()
|
||||
player: Optional[QMediaPlayer] = cast(QMediaPlayer, self.sender())
|
||||
assert player is not None
|
||||
player.play()
|
||||
return
|
||||
|
||||
@pyqtSlot(QMediaPlayer.PlaybackState)
|
||||
def playbackState(self, state):
|
||||
def playbackState(self, state: QMediaPlayer.PlaybackState) -> None:
|
||||
return
|
||||
|
||||
#
|
||||
# Communications slots
|
||||
#
|
||||
@pyqtSlot()
|
||||
def soundAlert(self):
|
||||
def soundAlert(self) -> None:
|
||||
self.alertEffect.play()
|
||||
return
|
||||
|
||||
@pyqtSlot(str)
|
||||
def playSound(self, url):
|
||||
def playSound(self, url: str) -> None:
|
||||
src = QUrl(url)
|
||||
if not self.localPlayer.audioOutput():
|
||||
self.localPlayer.setAudioOutput(self.localOutput)
|
||||
|
||||
Reference in New Issue
Block a user