display selected athmo and disappear after playback ends
This commit is contained in:
@ -10,6 +10,8 @@ class Athmos(ItemSelection):
|
||||
self.show_list = True
|
||||
self.max_name_width = 350
|
||||
super().__init__(self.max_name_width)
|
||||
self.current_duration = 0
|
||||
self.time_started = 0
|
||||
|
||||
def set_filenames(self,filenames):
|
||||
super().set_items(filenames)
|
||||
|
||||
7
main.py
7
main.py
@ -182,13 +182,15 @@ class GuiMain:
|
||||
def set_beat_track_index(self, index):
|
||||
self.beatplayer.track_selection.index = index
|
||||
|
||||
def set_selected_athmo(self):
|
||||
def set_selected_athmo(self, duration):
|
||||
"""
|
||||
name = self.athmos.get_name_by_index(self.athmos.index)
|
||||
if len(name) > 20: name = name[0:22] + '...'
|
||||
self.selected_athmo_srf = font_helvetica16.render(name, False, color_primary)
|
||||
"""
|
||||
self.selected_athmo_srf = self.athmos.selected_item_srf
|
||||
self.athmos.current_duration = duration * 1000 if duration is not None else 0
|
||||
self.athmos.time_started = pygame.time.get_ticks()
|
||||
|
||||
def set_athmo_filenames(self, filenames):
|
||||
self.athmos.set_filenames(filenames)
|
||||
@ -240,6 +242,9 @@ class GuiMain:
|
||||
self.screen.blit(self.selected_athmo_srf,
|
||||
(self.screenW*3 / 18,
|
||||
self.screenH - self.selected_athmo_srf.get_height()-10))
|
||||
|
||||
if pygame.time.get_ticks() - self.athmos.time_started >= self.athmos.current_duration:
|
||||
self.selected_athmo_srf = None
|
||||
|
||||
if self.loop_input_mode is not None:
|
||||
self.screen.blit(self.loop_input_mode,
|
||||
|
||||
Reference in New Issue
Block a user