diff --git a/beatplayer.py b/beatplayer.py index a0c177c..f7dc17a 100644 --- a/beatplayer.py +++ b/beatplayer.py @@ -1,6 +1,7 @@ from .item_selection import ItemSelection import pygame from .colors import * +from .fonts import * class BeatPlayer: @@ -26,14 +27,14 @@ class BeatPlayer: self.screen.blit(self.clip_selection.surface, ((self.screen.get_width()/4 + self.max_name_width) + 100, (self.screen.get_height() - self.clip_selection.surface.get_height())/2)) else: - if self.track_selection.selected_item_srf is not None: - self.screen.blit(self.track_selection.selected_item_srf, - ((self.screen.get_width()/4+10), self.screen.get_height() - 45)) - pygame.draw.rect(self.screen, color_primary_light, - (self.screen.get_width()/4, self.screen.get_height() - 50, self.max_name_width+20, 40), 2) - if self.clip_selection.selected_item_srf is not None: - self.screen.blit(self.clip_selection.selected_item_srf, - ((self.screen.get_width()/4 + self.max_name_width) + 110, self.screen.get_height() - 45)) - pygame.draw.rect(self.screen, color_primary_light, - ((self.screen.get_width()/4 + self.max_name_width) + 100, self.screen.get_height() - 50, - self.max_name_width+20, 40), 2) \ No newline at end of file + selected_track = self.track_selection.get_selected_item() + selected_clip = self.clip_selection.get_selected_item() + if len(selected_track) > 15: selected_track = selected_track[0:13] + '...' + if len(selected_clip) > 30: selected_clip = selected_clip[0:28] + '...' + track_surface = font_helvetica16.render(f"{selected_track}", + False, color_primary_dark) + clip_surface = font_helvetica16.render(f"/ {selected_clip}", + False, color_primary_dark) + self.screen.blit(clip_surface, (self.screen.get_width()/2, 15)) + self.screen.blit(track_surface, (self.screen.get_width()/2-track_surface.get_width()-10, 15)) + \ No newline at end of file diff --git a/item_selection.py b/item_selection.py index 9612957..7120d51 100644 --- a/item_selection.py +++ b/item_selection.py @@ -24,6 +24,9 @@ class ItemSelection: def get_count(self): return len(self.items) + def get_selected_item(self): + return self.items[self.index] + def update(self): self.surface.fill("black") for i in range(self.get_display_count()): diff --git a/main.py b/main.py index abcd8c9..8ed81dd 100755 --- a/main.py +++ b/main.py @@ -271,24 +271,22 @@ class GuiMain: if self.athmos.show_list: self.athmos.index -= 1 self.athmos.index %= self.athmos.get_count() - elif self.beatplayer.show_selection: + else: self.beatplayer.clip_selection.index -= 1 self.beatplayer.clip_selection.index %= self.beatplayer.clip_selection.get_count() if event.key == pygame.K_DOWN: if self.athmos.show_list: self.athmos.index += 1 self.athmos.index %= self.athmos.get_count() - elif self.beatplayer.show_selection: + else: self.beatplayer.clip_selection.index += 1 self.beatplayer.clip_selection.index %= self.beatplayer.clip_selection.get_count() if event.key == pygame.K_RIGHT: - if self.beatplayer.show_selection: - self.beatplayer.track_selection.index += 1 - self.beatplayer.track_selection.index %= self.beatplayer.track_selection.get_count() + self.beatplayer.track_selection.index += 1 + self.beatplayer.track_selection.index %= self.beatplayer.track_selection.get_count() if event.key == pygame.K_LEFT: - if self.beatplayer.show_selection: - self.beatplayer.track_selection.index -= 1 - self.beatplayer.track_selection.index %= self.beatplayer.track_selection.get_count() + self.beatplayer.track_selection.index -= 1 + self.beatplayer.track_selection.index %= self.beatplayer.track_selection.get_count() elif event.type == pygame.QUIT: self.running = False elif event.type == pygame.MOUSEBUTTONDOWN: