fix imports to work with pillow
[imago.git] / src / manual.py
index 8e246d4..fb7f832 100644 (file)
@@ -1,7 +1,6 @@
 """Manual grid selection module"""
 
-import pygame
-import ImageDraw
+from PIL import ImageDraw
 from math import sqrt, acos, copysign
 
 from geometry import l2ad, line, intersection
@@ -24,6 +23,7 @@ class Screen:
 
 def find_lines(im_orig):
     # TODO rename, refactor, comment
+    import pygame
 
     im = im_orig.copy()
 
@@ -76,6 +76,8 @@ def find_lines(im_orig):
 
 def lines(corners):
     # TODO Error on triangle 
+    corners.sort() # TODO does this help?
+    # TODO refactor this vvv
     cor_d = [(corners[0], (c[0] - corners[0][0], c[1] - corners[0][1]), c) for c in
              corners[1:]]
     cor_d = [(float(a[0] * b[0] + a[1] * b[1]) / (sqrt(a[0] ** 2 + a[1] ** 2) *