def undo(self):
     if len(self.undo_queue) > 0 and self.current_tool.undo():
         img = self.undo_queue.pop()
         graphics.set_color_extra(1,1,1,1)
         graphics.call_thrice(graphics.enter_canvas_mode)
         draw.image_extra(img,graphics.canvas_x,graphics.canvas_y)
         graphics.call_thrice(graphics.exit_canvas_mode)
         self.current_tool.canvas_changed()
         gc.collect()
 def save_3(self, dt=0, img = None, path = None):
     self.busy = False
     if img != None:
         self.current_tool.unselect()
         draw.clear(1,1,1,1)
         graphics.set_color_extra(1,1,1,1)
         graphics.call_thrice(graphics.enter_canvas_mode)
         draw.image_extra(img,graphics.canvas_x+1,graphics.canvas_y+1)
         graphics.call_thrice(graphics.exit_canvas_mode)
         #graphics.call_much_later(self.current_tool.select())
         graphics.call_much_later(self.current_tool.canvas_changed())
 def open_3(self, dt=0, path=None):
     self.busy = False
     if path != None:
         #self.current_tool.unselect()
         draw.clear(1,1,1,1)
         graphics.set_color_extra(1,1,1,1)
         graphics.call_thrice(graphics.enter_canvas_mode)
         graphics.call_thrice(pyglet.gl.glEnable, pyglet.gl.GL_BLEND)
         self.canvas_image = pyglet.image.load(path)
         draw.image_extra(self.canvas_image,graphics.canvas_x+1,graphics.canvas_y+1)
         graphics.call_thrice(pyglet.gl.glDisable, pyglet.gl.GL_BLEND)
         graphics.call_thrice(graphics.exit_canvas_mode)
         #graphics.call_much_later(self.current_tool.select())
         graphics.call_much_later(self.current_tool.canvas_changed)