selected track and clip gets displayed at the bottom of the UI
This commit is contained in:
@ -1,4 +1,6 @@
|
|||||||
from .item_selection import ItemSelection
|
from .item_selection import ItemSelection
|
||||||
|
import pygame
|
||||||
|
from .colors import *
|
||||||
|
|
||||||
class BeatPlayer:
|
class BeatPlayer:
|
||||||
|
|
||||||
@ -23,3 +25,15 @@ class BeatPlayer:
|
|||||||
(self.screen.get_height() - self.track_selection.surface.get_height())/2))
|
(self.screen.get_height() - self.track_selection.surface.get_height())/2))
|
||||||
self.screen.blit(self.clip_selection.surface, ((self.screen.get_width()/4 + self.max_name_width) + 100,
|
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))
|
(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)
|
||||||
@ -11,6 +11,7 @@ class ItemSelection:
|
|||||||
self.surface = pygame.Surface((0,0), pygame.SRCALPHA)
|
self.surface = pygame.Surface((0,0), pygame.SRCALPHA)
|
||||||
self.max_item_width = max_item_width
|
self.max_item_width = max_item_width
|
||||||
self.max_display_count = max_display_count
|
self.max_display_count = max_display_count
|
||||||
|
self.selected_item_srf = None
|
||||||
|
|
||||||
def set_items(self, items):
|
def set_items(self, items):
|
||||||
self.items = items
|
self.items = items
|
||||||
@ -34,6 +35,7 @@ class ItemSelection:
|
|||||||
if i == math.floor(self.get_display_count()/2):
|
if i == math.floor(self.get_display_count()/2):
|
||||||
#if i == self.index:
|
#if i == self.index:
|
||||||
text_surface = font_helvetica16.render(text, False, color_primary_light)
|
text_surface = font_helvetica16.render(text, False, color_primary_light)
|
||||||
|
self.selected_item_srf = text_surface
|
||||||
else:
|
else:
|
||||||
text_surface = font_helvetica16.render(text, False, color_primary)
|
text_surface = font_helvetica16.render(text, False, color_primary)
|
||||||
opacity = -15 + math.floor((i+1) * 2 * 255 / self.max_display_count
|
opacity = -15 + math.floor((i+1) * 2 * 255 / self.max_display_count
|
||||||
|
|||||||
18
main.py
18
main.py
@ -62,7 +62,7 @@ class GuiMain:
|
|||||||
|
|
||||||
self.rec_button = BinaryButton(
|
self.rec_button = BinaryButton(
|
||||||
self.screen,
|
self.screen,
|
||||||
(self.screenW-70, self.screenH-40),
|
(self.screenW-70, 15),
|
||||||
(60, 30),
|
(60, 30),
|
||||||
"REC",
|
"REC",
|
||||||
False
|
False
|
||||||
@ -90,8 +90,8 @@ class GuiMain:
|
|||||||
"12_4hJ7dS1yP5cT8kL3wR0vX6mN9bQ2fZ",
|
"12_4hJ7dS1yP5cT8kL3wR0vX6mN9bQ2fZ",
|
||||||
"13_9jK5lM1nP6qR0sT8uV4wX3aB7eF2gH"
|
"13_9jK5lM1nP6qR0sT8uV4wX3aB7eF2gH"
|
||||||
]
|
]
|
||||||
self.beatplayer.set_clip_names(fnames)
|
self.beatplayer.set_clip_names(fnames[0:5])
|
||||||
self.beatplayer.set_track_names(fnames)
|
self.beatplayer.set_track_names(fnames[0:9])
|
||||||
self.set_athmo_filenames(fnames)
|
self.set_athmo_filenames(fnames)
|
||||||
self.selected_athmo_srf = None
|
self.selected_athmo_srf = None
|
||||||
|
|
||||||
@ -116,8 +116,10 @@ class GuiMain:
|
|||||||
self.athmos.show_list = show
|
self.athmos.show_list = show
|
||||||
self.show_knobs = not show
|
self.show_knobs = not show
|
||||||
self.beatplayer.show_selection = False
|
self.beatplayer.show_selection = False
|
||||||
|
"""
|
||||||
if show == False:
|
if show == False:
|
||||||
self.set_selected_athmo()
|
self.set_selected_athmo()
|
||||||
|
"""
|
||||||
|
|
||||||
def show_beatplayer(self, show=True):
|
def show_beatplayer(self, show=True):
|
||||||
self.beatplayer.show_selection = show
|
self.beatplayer.show_selection = show
|
||||||
@ -128,8 +130,12 @@ class GuiMain:
|
|||||||
self.athmos.index = index
|
self.athmos.index = index
|
||||||
|
|
||||||
def set_selected_athmo(self):
|
def set_selected_athmo(self):
|
||||||
self.selected_athmo_srf = font_helvetica16.render(
|
"""
|
||||||
self.athmos.get_name_by_index(self.athmos.index), False, color_primary)
|
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
|
||||||
|
|
||||||
def set_athmo_filenames(self, filenames):
|
def set_athmo_filenames(self, filenames):
|
||||||
self.athmos.set_filenames(filenames)
|
self.athmos.set_filenames(filenames)
|
||||||
@ -172,7 +178,7 @@ class GuiMain:
|
|||||||
|
|
||||||
if self.selected_athmo_srf is not None:
|
if self.selected_athmo_srf is not None:
|
||||||
self.screen.blit(self.selected_athmo_srf,
|
self.screen.blit(self.selected_athmo_srf,
|
||||||
((self.screenW/2 - self.selected_athmo_srf.get_width())/2,
|
(self.screenW*3 / 18,
|
||||||
self.screenH - self.selected_athmo_srf.get_height()-10))
|
self.screenH - self.selected_athmo_srf.get_height()-10))
|
||||||
|
|
||||||
if self.loop_input_mode is not None:
|
if self.loop_input_mode is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user