Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pozitronik committed Feb 27, 2024
1 parent 1ec72c7 commit 3bf5386
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sinner/gui/GUIForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def set_rotate_mode(mode: RotateMode) -> None:

self.SoundSubMenu: Menu = Menu(self.MainMenu, tearoff=False)
self.MainMenu.add(CASCADE, menu=self.SoundSubMenu, label='Sound') # type: ignore[no-untyped-call] # it is a library method
self.SoundSubMenu.add(CHECKBUTTON, variable=self.SoundEnabledVar, label='Enable sound', command=lambda: self.GUIModel.enable_sound(self.SoundEnabledVar)) # type: ignore[no-untyped-call] # it is a library method
self.SoundSubMenu.add(CHECKBUTTON, variable=self.SoundEnabledVar, label='Enable sound', command=lambda: self.GUIModel.enable_sound(self.SoundEnabledVar.get())) # type: ignore[no-untyped-call] # it is a library method
self.SoundSubMenu.add(SEPARATOR) # type: ignore[no-untyped-call] # it is a library method
self.SoundSubMenu.add(COMMAND, label='Volume up', command=lambda: increase_volume()) # type: ignore[no-untyped-call] # it is a library method
self.SoundSubMenu.add(COMMAND, label='Volume down', command=lambda: decrease_volume()) # type: ignore[no-untyped-call] # it is a library method
Expand Down
10 changes: 5 additions & 5 deletions sinner/models/audio/PygameAudioBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def media_path(self, media_path: str) -> None:
self._media_path = str(normalize_path(media_path))
self.update_status(f"Using audio backend for {self._media_path}")
self._clip = AudioFileClip(self.media_path)
self._audio_path = os.path.join(self._temp_dir, get_file_name(self.media_path) + '.wav')
self._audio_path = os.path.join(self._temp_dir, get_file_name(self.media_path) + '.wav') # type: ignore[arg-type] # self._media_path always have a value here
if not os.path.exists(self._audio_path):
try:
self._clip.write_audiofile(self._audio_path, codec='pcm_s32le')
Expand All @@ -46,7 +46,7 @@ def media_path(self, media_path: str) -> None:
except Exception as exception:
self.update_status(message=str(exception), mood=Mood.BAD)

def play(self):
def play(self) -> None:
"""Plays the loaded media from the current position."""
if self._media_loaded and not self._media_is_playing:
pygame.mixer.music.play()
Expand All @@ -55,17 +55,17 @@ def play(self):
pygame.mixer.music.set_pos(self._position)
self._position = None

def stop(self):
def stop(self) -> None:
"""Stops playback."""
if self._media_is_playing:
pygame.mixer.music.stop()
self._media_is_playing = False

def pause(self):
def pause(self) -> None:
"""Pauses playback."""
pygame.mixer.music.pause()

def unpause(self):
def unpause(self) -> None:
"""Resumes playback."""
pygame.mixer.music.unpause()

Expand Down

0 comments on commit 3bf5386

Please sign in to comment.