# Path: VisPyCanvas.py
# class VisPyCanvas(scene.SceneCanvas):
# 
#     def __init__(self, config=None):
# 
#         scene.SceneCanvas.__init__(self, keys=None, config=config)
#         self.unfreeze()
# 
#         back_color = str(QPalette().color(QPalette.Window).name())
# 
#         self.central_widget.bgcolor = back_color
#         self.central_widget.border_color = back_color
# 
#         grid = self.central_widget.add_grid(margin=10)
#         grid.spacing = 0
# 
#         top_padding = grid.add_widget(row=0, col=0, col_span=2)
#         top_padding.height_max = 24
# 
#         yaxis = scene.AxisWidget(orientation='left', axis_color='black', text_color='black', font_size=12)
#         yaxis.width_max = 60
#         grid.add_widget(yaxis, row=1, col=0)
# 
#         xaxis = scene.AxisWidget(orientation='bottom', axis_color='black', text_color='black', font_size=12)
#         xaxis.height_max = 40
#         grid.add_widget(xaxis, row=2, col=1)
# 
#         right_padding = grid.add_widget(row=0, col=2, row_span=2)
#         right_padding.width_max = 24
# 
#         view = grid.add_view(row=1, col=1, border_color='black', bgcolor='white')
#         view.camera = Camera(aspect=1)
# 
#         # Following function was removed from 'prepare_draw()' of 'Grid' class by patch,
#         # it is necessary to call manually
#         grid._update_child_widget_dim()
# 
#         grid1 = scene.GridLines(parent=view.scene, color='gray')
#         grid1.set_gl_state(depth_test=False)
# 
#         xaxis.link_view(view)
#         yaxis.link_view(view)
# 
#         self.grid = grid1
#         self.view = view
#         self.freeze()
# 
#         self.measure_fps()
# 
#     def translate_coords(self, pos):
#         tr = self.grid.get_transform('canvas', 'visual')
#         return tr.map(pos)
# 
# Path: VisPyVisuals.py
# def _update_shape_buffers(data, triangulation='glu'):
# def _linearring_to_segments(arr):
# def _linestring_to_segments(arr):
#     def __init__(self, collection):
#     def add(self, **kwargs):
#     def clear(self, update=False):
#     def redraw(self):
#     def visible(self):
#     def visible(self, value):
#     def __init__(self, line_width=1, triangulation='gpc', layers=3, pool=None, **kwargs):
#     def add(self, shape=None, color=None, face_color=None, visible=True, update=False, layer=1, tolerance=0.01):
#     def remove(self, key, update=False):
#     def clear(self, update=False):
#     def __update(self):
#     def redraw(self, indexes=None):
#     def lock_updates(self):
#     def unlock_updates(self):
#     def __init__(self, collection):
#     def set(self, **kwargs):
#     def clear(self, update=False):
#     def redraw(self):
#     def visible(self):
#     def visible(self, value):
#     def __init__(self, **kwargs):
#     def add(self, text, pos, visible=True, update=True):
#     def remove(self, key, update=False):
#     def clear(self, update=False):
#     def __update(self):
#     def redraw(self):
# def create_fast_node(subclass):
#     def __init__(self, *args, **kwargs):
#     def get_enabled(self):
#     def set_enabled(self, enabled):
# class ShapeGroup(object):
# class ShapeCollectionVisual(CompoundVisual):
# class TextGroup(object):
# class TextCollectionVisual(TextVisual):


from PyQt4 import QtCore
from VisPyCanvas import VisPyCanvas
from VisPyVisuals import ShapeGroup, ShapeCollection, TextCollection, TextGroup, Cursor
from vispy.scene.visuals import InfiniteLine
from vispy.geometry import Rect
import logging
import numpy as np
        getattr(self.vispy_canvas.events, event_name).disconnect(callback)

    def zoom(self, factor, center=None):
        """
        Zooms the plot by factor around a given
        center point. Takes care of re-drawing.

        :param factor: Number by which to scale the plot.
        :type factor: float
        :param center: Coordinates [x, y] of the point around which to scale the plot.
        :type center: list
        :return: None
        """
        self.vispy_canvas.view.camera.zoom(factor, center)

    def new_shape_group(self):
        return ShapeGroup(self.shape_collection)

    def new_shape_collection(self, **kwargs):
        # sc = ShapeCollection(parent=self.vispy_canvas.view.scene, pool=self.app.pool, **kwargs)
        # self.shape_collections.append(sc)
        # return sc
        return ShapeCollection(parent=self.vispy_canvas.view.scene, pool=self.app.pool, **kwargs)

    def new_cursor(self):
        c = Cursor(pos=np.empty((0, 2)), parent=self.vispy_canvas.view.scene)
        c.antialias = 0
        return c

    def new_text_group(self):

# Path: VisPyCanvas.py
# class VisPyCanvas(scene.SceneCanvas):
# 
#     def __init__(self, config=None):
# 
#         scene.SceneCanvas.__init__(self, keys=None, config=config)
#         self.unfreeze()
# 
#         back_color = str(QPalette().color(QPalette.Window).name())
# 
#         self.central_widget.bgcolor = back_color
#         self.central_widget.border_color = back_color
# 
#         grid = self.central_widget.add_grid(margin=10)
#         grid.spacing = 0
# 
#         top_padding = grid.add_widget(row=0, col=0, col_span=2)
#         top_padding.height_max = 24
# 
#         yaxis = scene.AxisWidget(orientation='left', axis_color='black', text_color='black', font_size=12)
#         yaxis.width_max = 60
#         grid.add_widget(yaxis, row=1, col=0)
# 
#         xaxis = scene.AxisWidget(orientation='bottom', axis_color='black', text_color='black', font_size=12)
#         xaxis.height_max = 40
#         grid.add_widget(xaxis, row=2, col=1)
# 
#         right_padding = grid.add_widget(row=0, col=2, row_span=2)
#         right_padding.width_max = 24
# 
#         view = grid.add_view(row=1, col=1, border_color='black', bgcolor='white')
#         view.camera = Camera(aspect=1)
# 
#         # Following function was removed from 'prepare_draw()' of 'Grid' class by patch,
#         # it is necessary to call manually
#         grid._update_child_widget_dim()
# 
#         grid1 = scene.GridLines(parent=view.scene, color='gray')
#         grid1.set_gl_state(depth_test=False)
# 
#         xaxis.link_view(view)
#         yaxis.link_view(view)
# 
#         self.grid = grid1
#         self.view = view
#         self.freeze()
# 
#         self.measure_fps()
# 
#     def translate_coords(self, pos):
#         tr = self.grid.get_transform('canvas', 'visual')
#         return tr.map(pos)
# 
# Path: VisPyVisuals.py
# def _update_shape_buffers(data, triangulation='glu'):
# def _linearring_to_segments(arr):
# def _linestring_to_segments(arr):
#     def __init__(self, collection):
#     def add(self, **kwargs):
#     def clear(self, update=False):
#     def redraw(self):
#     def visible(self):
#     def visible(self, value):
#     def __init__(self, line_width=1, triangulation='gpc', layers=3, pool=None, **kwargs):
#     def add(self, shape=None, color=None, face_color=None, visible=True, update=False, layer=1, tolerance=0.01):
#     def remove(self, key, update=False):
#     def clear(self, update=False):
#     def __update(self):
#     def redraw(self, indexes=None):
#     def lock_updates(self):
#     def unlock_updates(self):
#     def __init__(self, collection):
#     def set(self, **kwargs):
#     def clear(self, update=False):
#     def redraw(self):
#     def visible(self):
#     def visible(self, value):
#     def __init__(self, **kwargs):
#     def add(self, text, pos, visible=True, update=True):
#     def remove(self, key, update=False):
#     def clear(self, update=False):
#     def __update(self):
#     def redraw(self):
# def create_fast_node(subclass):
#     def __init__(self, *args, **kwargs):
#     def get_enabled(self):
#     def set_enabled(self, enabled):
# class ShapeGroup(object):
# class ShapeCollectionVisual(CompoundVisual):
# class TextGroup(object):
# class TextCollectionVisual(TextVisual):


# Path: PlotCanvas.py
from PyQt4 import QtCore
from VisPyCanvas import VisPyCanvas
from VisPyVisuals import ShapeGroup, ShapeCollection, TextCollection, TextGroup, Cursor
from vispy.scene.visuals import InfiniteLine
from vispy.geometry import Rect
import logging
import numpy as np

        getattr(self.vispy_canvas.events, event_name).disconnect(callback)

    def zoom(self, factor, center=None):
        """
        Zooms the plot by factor around a given
        center point. Takes care of re-drawing.

        :param factor: Number by which to scale the plot.
        :type factor: float
        :param center: Coordinates [x, y] of the point around which to scale the plot.
        :type center: list
        :return: None
        """
        self.vispy_canvas.view.camera.zoom(factor, center)

    def new_shape_group(self):
        return ShapeGroup(self.shape_collection)

    def new_shape_collection(self, **kwargs):
        # sc = ShapeCollection(parent=self.vispy_canvas.view.scene, pool=self.app.pool, **kwargs)
        # self.shape_collections.append(sc)
        # return sc
        return ShapeCollection(parent=self.vispy_canvas.view.scene, pool=self.app.pool, **kwargs)

    def new_cursor(self):
        c = Cursor(pos=np.empty((0, 2)), parent=self.vispy_canvas.view.scene)
        c.antialias = 0
        return c

    def new_text_group(self):

        return TextGroup(self.text_collection)