More UI changes

master
LEdoian 3 years ago
parent f80228681a
commit 4e6d04c9e5

@ -78,6 +78,7 @@ class Visualisation:
def reload(self):
self.mapfile.load()
self.histograms = None
self.squares = None
self.draw()
@ -94,8 +95,8 @@ class Visualisation:
def run(self, *, refresh=1800):
pygame.time.set_timer(pygame.USEREVENT, refresh * 1000)
pygame.event.set_blocked(None)
# pygame.event.set_allowed([pygame.USEREVENT, pygame.VIDEORESIZE, pygame.VIDEOEXPOSE, pygame.QUIT, pygame.KEYDOWN])
pygame.event.set_allowed([pygame.VIDEORESIZE, pygame.VIDEOEXPOSE, pygame.QUIT, pygame.KEYDOWN])
pygame.event.set_allowed([pygame.USEREVENT, pygame.VIDEORESIZE, pygame.VIDEOEXPOSE, pygame.QUIT, pygame.KEYDOWN])
# pygame.event.set_allowed([pygame.VIDEORESIZE, pygame.VIDEOEXPOSE, pygame.QUIT, pygame.KEYDOWN])
self.draw()
while True:
ev = pygame.event.wait()
@ -121,5 +122,11 @@ class Visualisation:
colors['+'] = (0, 0, 0)
self.squares = None
self.draw()
if ev.type == pygame.KEYDOWN and ev.key == pygame.K_x:
self.order = ['@', '+', '?', '-', '/', '*']
self.squares = None
self.draw()
if ev.type == pygame.USEREVENT:
self.reload()

Loading…
Cancel
Save