changed the display style of the selected beat

This commit is contained in:
2025-09-01 20:31:01 +02:00
parent ce9b7c39ec
commit 0448355401
3 changed files with 21 additions and 19 deletions

View File

@ -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)
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))

View File

@ -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()):

14
main.py
View File

@ -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: