changed GuiMain in order to make it testable with laptop

This commit is contained in:
2025-08-03 17:58:42 +02:00
parent 6dc72353d7
commit 8265ba0f0a

39
main.py
View File

@ -72,6 +72,22 @@ class GuiMain:
self.athmos = Athmos(self.screen)
self.athmos.show_list = False
self.set_athmo_filenames([
"01_7Qp3xL8gK2tA5mR9eZ1vC4bN6sH0jF",
"02_yP5cT8kL3wR0vX6mN9bQ2fZ4hJ7dS1",
"03_3aB7eF2gH9jK5lM1nP6qR0sT8uV4B7eF2gH9jK5lM1nP6qR0sT8uV4wX",
"04_6mV0cX8zL5jH7gF2dS9aP1oI3uY4tR",
"05_2pQ8oR3iK6jL1fH7gK9wL0q3xZ4jL1fH7gK9wL0q3xZ4rE5",
"06_9eZ1vC4bN6sH0jF7Qp3xL8gK2tA5mR",
"07_0vX6mN9bQ2fZ4hJ7dS1yP5cT8kL3wR",
"08_1nP6qR0sT8uV4wX3aB7eF2gH9jK5lM",
"09_5jH7gF2dS9aP1oI3uY4tR6mV0cX8zL",
"10_6jL1fH7gK9wL0q3xZ4rE5pQ8oR3iK2",
"11_0jF7Qp3xL8gK2tA5mR9eZ1vC4bN6sH",
"12_4hJ7dS1yP5cT8kL3wR0vX6mN9bQ2fZ",
"13_9jK5lM1nP6qR0sT8uV4wX3aB7eF2gH",
])
self.selected_athmo_srf = None
self.clock = pygame.time.Clock()
self.running = True
@ -93,10 +109,15 @@ class GuiMain:
def show_athmos(self, show=True):
self.athmos.show_list = show
self.show_knobs = not show
if show == False:
self.set_selected_athmo()
def set_athmo_index(self, index):
self.athmos.index = index
def set_selected_athmo(self):
self.selected_athmo_srf = font_helvetica16.render(self.athmos.filenames[self.athmos.index], False, color_primary)
def set_athmo_filenames(self, filenames):
self.athmos.set_filenames(filenames)
@ -134,6 +155,11 @@ class GuiMain:
self.lloop_button.display()
self.rloop_button.display()
self.rec_button.display()
if self.selected_athmo_srf is not None:
self.screen.blit(self.selected_athmo_srf,
((self.screenW/2 - self.selected_athmo_srf.get_width())/2,
self.screenH - self.selected_athmo_srf.get_height()-10))
if self.loop_input_mode is not None:
self.screen.blit(self.loop_input_mode,
@ -151,6 +177,19 @@ class GuiMain:
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.running = False
if event.key == pygame.K_INSERT:
if not self.athmos.show_list:
self.show_athmos()
else:
self.show_athmos(False)
if event.key == pygame.K_UP:
if self.athmos.show_list:
self.athmos.index -= 1
self.athmos.index %= len(self.athmos.filenames)
if event.key == pygame.K_DOWN:
if self.athmos.show_list:
self.athmos.index += 1
self.athmos.index %= len(self.athmos.filenames)
elif event.type == pygame.QUIT:
self.running = False
elif event.type == pygame.MOUSEBUTTONDOWN: