X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=run.py;h=b486c503e7d1a2d73f65a8e5a51f704c03df94c9;hb=7df12958bed6544b36bc946cdbb185ff2011733c;hp=9797c918073f4baa8033f85634b9c5163efc34e9;hpb=d8ab67c745b78d0b2f5896cf6642004b3951433c;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git diff --git a/run.py b/run.py index 9797c91..b486c50 100644 --- a/run.py +++ b/run.py @@ -1,59 +1,3 @@ -import sys - -if getattr(sys, 'frozen', False): - os.chdir(sys._MEIPASS) - -import pygame -import pydub -import helpers - -pygame.mixer.pre_init(frequency = 44100) -pygame.init() - -size = width, height = 1024, 600 - -screen = pygame.display.set_mode(size) -background = pygame.Surface(screen.get_size()) -background = background.convert() -background.fill((250, 250, 250)) - -action_surface = pygame.Surface((600, 250)).convert() -action_surface.fill((0,0,0)) -helpers.parse_config() - -for key_name in helpers.Mapping.KEYS: - key = helpers.Mapping.KEYS[key_name] - key.draw(background) - -screen.blit(background, (0, 0)) -screen.blit(action_surface, (10, 330)) - -pygame.display.flip() - -contexts = [ - 'normal' -] - -context = 'normal' - -while 1: - event = pygame.event.wait() - if event.type == pygame.QUIT or ( - event.type == pygame.KEYDOWN and - event.mod == 4160 and - event.key == pygame.K_c): - pygame.quit() - sys.exit() - - if context == 'normal': - if event.type == pygame.KEYDOWN: - key = helpers.Key.find_by_key_num(event.key) - if key is not None: - key.do_actions() - elif event.type == pygame.MOUSEBUTTONUP: - key = helpers.Key.find_by_collidepoint(pygame.mouse.get_pos()) - if key is not None: - key.list_actions(action_surface) - - pygame.display.flip() +import music_sampler +music_sampler.app.main()