Misc tidying
This commit is contained in:
parent
b389a348c1
commit
a1709e92ae
@ -404,22 +404,6 @@ def show_warning(parent: Optional[QMainWindow], title: str, msg: str) -> None:
|
|||||||
QMessageBox.warning(parent, title, msg, buttons=QMessageBox.StandardButton.Cancel)
|
QMessageBox.warning(parent, title, msg, buttons=QMessageBox.StandardButton.Cancel)
|
||||||
|
|
||||||
|
|
||||||
def singleton(cls):
|
|
||||||
"""
|
|
||||||
Make a class a Singleton class (see
|
|
||||||
https://realpython.com/primer-on-python-decorators/#creating-singletons)
|
|
||||||
"""
|
|
||||||
|
|
||||||
@functools.wraps(cls)
|
|
||||||
def wrapper_singleton(*args, **kwargs):
|
|
||||||
if not wrapper_singleton.instance:
|
|
||||||
wrapper_singleton.instance = cls(*args, **kwargs)
|
|
||||||
return wrapper_singleton.instance
|
|
||||||
|
|
||||||
wrapper_singleton.instance = None
|
|
||||||
return wrapper_singleton
|
|
||||||
|
|
||||||
|
|
||||||
def trailing_silence(
|
def trailing_silence(
|
||||||
audio_segment: AudioSegment,
|
audio_segment: AudioSegment,
|
||||||
silence_threshold: int = -50,
|
silence_threshold: int = -50,
|
||||||
|
|||||||
@ -72,7 +72,9 @@ class NoteColours(dbtables.NoteColoursTable):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_colour(session: Session, text: str, foreground: bool = False) -> Optional[str]:
|
def get_colour(
|
||||||
|
session: Session, text: str, foreground: bool = False
|
||||||
|
) -> Optional[str]:
|
||||||
"""
|
"""
|
||||||
Parse text and return background (foreground if foreground==True) colour
|
Parse text and return background (foreground if foreground==True) colour
|
||||||
string if matched, else None
|
string if matched, else None
|
||||||
@ -245,10 +247,7 @@ class Playlists(dbtables.PlaylistsTable):
|
|||||||
|
|
||||||
return session.scalars(
|
return session.scalars(
|
||||||
select(cls)
|
select(cls)
|
||||||
.where(
|
.where(cls.is_template.is_(True), cls.deleted.is_not(True))
|
||||||
cls.is_template.is_(True),
|
|
||||||
cls.deleted.is_not(True)
|
|
||||||
)
|
|
||||||
.order_by(cls.name)
|
.order_by(cls.name)
|
||||||
).all()
|
).all()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user