From: Tomas Musil Date: Mon, 21 Jul 2014 21:32:18 +0000 (+0200) Subject: instructions in manual mode X-Git-Url: http://git.tomasm.cz/imago.git/commitdiff_plain/444c17ee7aa867e50bc23066a27b38e28f2152e1 instructions in manual mode --- diff --git a/src/manual.py b/src/manual.py index 9b22316..b761f5e 100644 --- a/src/manual.py +++ b/src/manual.py @@ -25,12 +25,42 @@ class Screen: def dst((x1, y1), (x2, y2)): return (x1 - x2) ** 2 + (y1 - y2) ** 2 +def display_instr(): + + while True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit() + raise UserQuitError + if event.type == pygame.MOUSEBUTTONDOWN or event.type == pygame.KEYDOWN: + return + def find_lines(im_orig): # TODO rename, refactor, comment im = im_orig.copy() - screen = Screen(im.size) + screen = Screen((620, 350)) + + font = pygame.font.Font(None, 25) + instructions = ["Imago manual mode", "", + "To set the grid position, click on the corners of the grid. Once you mark", + "all four corners, the grid will appear. To adjust it, just click on the new", + "position and the nearest corner will move there. Once you are content", + "with the alignment, press any key on your keyboard or close the window.", + "", "", "", + "Press any key to continue."] + y = 10 + for i in instructions: + text1 = font.render(i, True, [128, 255, 128]) + screen._screen.blit(text1, [10, y]) + y += 25 + + pygame.display.flip() + + display_instr() + + pygame.display.set_mode(im.size) clock = pygame.time.Clock() draw = ImageDraw.Draw(im) @@ -67,12 +97,12 @@ def find_lines(im_orig): for l in l_hor: draw.line(l, fill=color, width=line_width) # TODO sort by distance - l_vert.sort() - l_hor.sort() - for i in [3, 9, 15]: - for j in [3, 9, 15]: - hoshi(intersection(line(l_vert[i][0], l_vert[i][1]), - line(l_hor[j][0], l_hor[j][1]))) + #l_vert.sort() + #l_hor.sort() + #for i in [3, 9, 15]: + # for j in [3, 9, 15]: + # hoshi(intersection(line(l_vert[i][0], l_vert[i][1]), + # line(l_hor[j][0], l_hor[j][1]))) lines_r = [[l2ad(l, im.size) for l in l_vert], [l2ad(l, im.size) for l in l_hor]]