Added more paths to graph edit

Changed variable names to be more descriptive, added paths, converted to
metric.

Change-Id: Ic8474b567d1794082fe275a5e1a86e14688acb53
diff --git a/y2018/control_loops/python/basic_window.py b/y2018/control_loops/python/basic_window.py
index 7d93fe1..7caf299 100644
--- a/y2018/control_loops/python/basic_window.py
+++ b/y2018/control_loops/python/basic_window.py
@@ -8,108 +8,115 @@
 
 identity = cairo.Matrix()
 
+
 # Override the matrix of a cairo context.
 class OverrideMatrix(object):
-  def __init__(self, cr, matrix):
-    self.cr = cr
-    self.matrix = matrix
-  def __enter__(self):
-    self.cr.save()
-    self.cr.set_matrix(self.matrix)
+    def __init__(self, cr, matrix):
+        self.cr = cr
+        self.matrix = matrix
 
-  def __exit__(self, type, value, traceback):
-    self.cr.restore();
+    def __enter__(self):
+        self.cr.save()
+        self.cr.set_matrix(self.matrix)
+
+    def __exit__(self, type, value, traceback):
+        self.cr.restore()
+
 
 mainloop = GLib.MainLoop()
 
+
 def quit_main_loop(*args):
-  mainloop.quit()
+    mainloop.quit()
+
 
 def RunApp():
-  try:
-    mainloop.run();
-  except KeyboardInterrupt:
-    print('\nCtrl+C hit, quitting')
-    mainloop.quit()
+    try:
+        mainloop.run()
+    except KeyboardInterrupt:
+        print('\nCtrl+C hit, quitting')
+        mainloop.quit()
+
 
 # Create a GTK+ widget on which we will draw using Cairo
 class BaseWindow(Gtk.DrawingArea):
-  def method_connect(self, event, cb):
-    def handler(obj, *args):
-      cb(*args)
-    self.window.connect(event, handler)
+    def method_connect(self, event, cb):
+        def handler(obj, *args):
+            cb(*args)
 
-  # Draw in response to an expose-event
-  def __init__(self): 
-    super().__init__()
-    self.window = Gtk.Window()
-    self.window.set_title("DrawingArea")
-    self.window.connect("destroy", quit_main_loop)
-    self.window.set_events(Gdk.EventMask.BUTTON_PRESS_MASK |
-                        Gdk.EventMask.BUTTON_RELEASE_MASK |
-                        Gdk.EventMask.POINTER_MOTION_MASK |
-                        Gdk.EventMask.SCROLL_MASK |
-                        Gdk.EventMask.KEY_PRESS_MASK
-                        )
-    self.method_connect("key-press-event", self.do_key_press)
-    self.method_connect("button-press-event", self._do_button_press_internal)
-    self.method_connect("configure-event", self._do_configure)
+        self.window.connect(event, handler)
 
-    self.set_size_request(640, 400) #640 * 2, 1229)
-    self.window.add(self)
-    self.window.show_all()
-    self.center = (0, 0)
-    self.shape = (640, 400)
-    self.needs_redraw = False
+    # Draw in response to an expose-event
+    def __init__(self):
+        super(BaseWindow, self).__init__()
+        self.window = Gtk.Window()
+        self.window.set_title("DrawingArea")
+        self.window.connect("destroy", quit_main_loop)
+        self.window.set_events(Gdk.EventMask.BUTTON_PRESS_MASK
+                               | Gdk.EventMask.BUTTON_RELEASE_MASK
+                               | Gdk.EventMask.POINTER_MOTION_MASK
+                               | Gdk.EventMask.SCROLL_MASK
+                               | Gdk.EventMask.KEY_PRESS_MASK)
+        self.method_connect("key-press-event", self.do_key_press)
+        self.method_connect("button-press-event",
+                            self._do_button_press_internal)
+        self.method_connect("configure-event", self._do_configure)
 
-  def get_current_scale(self):
-    w_w, w_h = self.window_shape
-    w, h = self.shape
-    return min((w_w / w), (w_h / h))
+        self.set_size_request(640, 400)
+        self.window.add(self)
+        self.window.show_all()
+        self.center = (0, 0)
+        self.shape = (640, 400)
+        self.needs_redraw = False
 
-  def init_extents(self, center, shape):
-    self.center = center
-    self.shape = shape
+    def get_current_scale(self):
+        w_w, w_h = self.window_shape
+        w, h = self.shape
+        return min((w_w / w), (w_h / h))
 
-  # The gtk system creates cr which is a cairo_context_t (in the c docs), and then it 
-  # passes it as a function argument to the "draw" event.  do_draw is the default name.
-  def do_draw(self, cr):
-    cr.save()
-    cr.set_font_size(20)
-    cr.translate(self.window_shape[0] / 2, self.window_shape[1] / 2)
-    scale = self.get_current_scale()
-    cr.scale(scale, -scale)
-    cr.translate(-self.center[0], -self.center[1])
-    self.needs_redraw = False
-    self.handle_draw(cr)
-    cr.restore()
+    def init_extents(self, center, shape):
+        self.center = center
+        self.shape = shape
 
-  # Handle the expose-event by drawing
-  def handle_draw(self, cr):
-    pass
+    # The gtk system creates cr which is a cairo_context_t (in the c docs), and then it
+    # passes it as a function argument to the "draw" event.  do_draw is the default name.
+    def do_draw(self, cr):
+        cr.save()
+        cr.set_font_size(20)
+        cr.translate(self.window_shape[0] / 2, self.window_shape[1] / 2)
+        scale = self.get_current_scale()
+        cr.scale(scale, -scale)
+        cr.translate(-self.center[0], -self.center[1])
+        self.needs_redraw = False
+        self.handle_draw(cr)
+        cr.restore()
 
-  def do_key_press(self, event):
-    pass
+    # Handle the expose-event by drawing
+    def handle_draw(self, cr):
+        pass
 
-  def _do_button_press_internal(self, event):
-    o_x = event.x
-    o_y = event.y
-    x = event.x - self.window_shape[0] / 2
-    y = self.window_shape[1] / 2 - event.y
-    scale = self.get_current_scale()
-    event.x = x / scale + self.center[0]
-    event.y = y / scale + self.center[1]
-    self.do_button_press(event)
-    event.x = o_x
-    event.y = o_y
+    def do_key_press(self, event):
+        pass
 
-  def do_button_press(self, event):
-    pass
+    def _do_button_press_internal(self, event):
+        o_x = event.x
+        o_y = event.y
+        x = event.x - self.window_shape[0] / 2
+        y = self.window_shape[1] / 2 - event.y
+        scale = self.get_current_scale()
+        event.x = x / scale + self.center[0]
+        event.y = y / scale + self.center[1]
+        self.do_button_press(event)
+        event.x = o_x
+        event.y = o_y
 
-  def _do_configure(self, event):
-    self.window_shape = (event.width, event.height)
+    def do_button_press(self, event):
+        pass
 
-  def redraw(self):
-    if not self.needs_redraw:
-      self.needs_redraw = True
-      self.window.queue_draw()
+    def _do_configure(self, event):
+        self.window_shape = (event.width, event.height)
+
+    def redraw(self):
+        if not self.needs_redraw:
+            self.needs_redraw = True
+            self.window.queue_draw()