def start(self):
        # set default gl modes
        set_gl_defaults(self.mainapp.POINT_SIZE)

        # try to render a smooth line (if supported by driver)
        gl_enable_line_smoothing()

        # hide mouse - disabled.
        # self.set_mouse_visible(False)

        # Create a font for our FPS clock
        ft = pyglet.font.load('Arial', 28)
        self.mainapp.fps_display = pyglet.clock.ClockDisplay(font = ft, interval=0.125, format='FPS %(fps).2f')

        self.mainapp.window.push_handlers(on_key_press = self.kpf_change_y_lims)
    def start(self):
        # set default gl modes
        set_gl_defaults(self.mainapp.POINT_SIZE)

        # try to render a smooth line (if supported by driver)
        gl_enable_line_smoothing()

        # hide mouse - disabled.
        # self.set_mouse_visible(False)

        # Create a font for our FPS clock
        ft = pyglet.font.load('Arial', 28)
        self.mainapp.fps_display = pyglet.clock.ClockDisplay(
            font=ft, interval=0.125, format='FPS %(fps).2f')

        self.mainapp.window.push_handlers(on_key_press=self.kpf_change_y_lims)
    def setup(self):
        ''' set variables based on init() values. '''
        self.Y_LIMS = [0, self.SETTINGS.WINDOW_HEIGHT_DEFAULT]
        self.SETTINGS.WINDOW_WIDTH_CURRENT = self.SETTINGS.WINDOW_WIDTH_DEFAULT
        self.SETTINGS.WINDOW_HEIGHT_CURRENT = self.SETTINGS.WINDOW_HEIGHT_DEFAULT

        # add 'abs_plugin_ID' to plugin name.
        self.PLUGIN_NAME = self.PLUGIN_NAME + '-' + str(self.abs_plugin_ID)
        ''' setup mmap or random data interface '''
        status, self.MMAP, self.DATA = setup_incoming_data_interface(
            self.USE_MMAP, self.PLUGIN_NAME, self.NBR_CHANNELS,
            self.nPointsToUpdate, self.nPoints,
            self.SETTINGS.WINDOW_WIDTH_CURRENT,
            self.SETTINGS.WINDOW_HEIGHT_CURRENT)
        if not status:
            sys.exit(1)
        ''' setup plot queue '''
        self.plot_queue = setup_plotting_queue()
        ''' generate initial positions & colors, and setup VOBs '''
        self.vbo_data, self.vbo_colors, self.x_coords = \
         gl_setup_initial_data_and_color_and_vbos(self.nPoints, n_COORDINATES_PER_COLOR, self.NBR_CHANNELS, self.SETTINGS.WINDOW_WIDTH_DEFAULT, self.SETTINGS.WINDOW_HEIGHT_DEFAULT)
        ''' horizontal and vertical lines '''
        # horizontal line showing the threshold
        if self.SHOW_HORIZONTAL_LINE:
            self.line_hor = line_default_horizontal(self)

        # vertical line showing which data point is going to be update next
        if self.SHOW_VERTICAL_LINE:
            self.line_ver = line_default_vertical(self)
        ''' axes '''
        if self.SHOW_AXES:
            self.coord_axes, self.y_axis_tics = axes_default_with_y_ticks(self)
        ''' other stuff '''
        # is Tkinter installed and running?
        self.SETTINGS = tkinter_register_with_settings(self.SETTINGS)

        # set default gl modes
        set_gl_defaults(self.POINT_SIZE)

        # try to render a smooth line (if supported by driver)
        gl_enable_line_smoothing()

        # set window title
        win_title = 'generating random data'
        if self.USE_MMAP:
            win_title = 'receiving data from matlab'
        nbr_points_shown = ' -- showing %s points per panel.' % self.nPoints
        self.set_caption(self.PLUGIN_NAME + ' -- ' + win_title +
                         nbr_points_shown)

        # hide mouse - disabled.
        # self.set_mouse_visible(False)

        # schedule the 'update()' method to be called each 'update_interval'
        pyglet.clock.schedule_interval(self.update, self.update_interval)

        # Create a font for our FPS clock
        ft = pyglet.font.load('Arial', 28)
        self.fps_display = pyglet.clock.ClockDisplay(font=ft,
                                                     interval=0.125,
                                                     format='FPS %(fps).2f')
    def setup(self):

        """ set variables based on init() values. """
        self.Y_LIMS = [0, self.SETTINGS.WINDOW_HEIGHT_DEFAULT]
        self.SETTINGS.WINDOW_WIDTH_CURRENT = self.SETTINGS.WINDOW_WIDTH_DEFAULT
        self.SETTINGS.WINDOW_HEIGHT_CURRENT = self.SETTINGS.WINDOW_HEIGHT_DEFAULT

        # add 'abs_plugin_ID' to plugin name.
        self.PLUGIN_NAME = self.PLUGIN_NAME + "-" + str(self.abs_plugin_ID)

        """ setup mmap or random data interface """
        status, self.MMAP, self.DATA = setup_incoming_data_interface(
            self.USE_MMAP,
            self.PLUGIN_NAME,
            self.NBR_CHANNELS,
            self.nPointsToUpdate,
            self.nPoints,
            self.SETTINGS.WINDOW_WIDTH_CURRENT,
            self.SETTINGS.WINDOW_HEIGHT_CURRENT,
        )
        if not status:
            sys.exit(1)

        """ setup plot queue """
        self.plot_queue = setup_plotting_queue()

        """ generate initial positions & colors, and setup VOBs """
        self.vbo_data, self.vbo_colors, self.x_coords = gl_setup_initial_data_and_color_and_vbos(
            self.nPoints,
            n_COORDINATES_PER_COLOR,
            self.NBR_CHANNELS,
            self.SETTINGS.WINDOW_WIDTH_DEFAULT,
            self.SETTINGS.WINDOW_HEIGHT_DEFAULT,
        )

        """ horizontal and vertical lines """
        # horizontal line showing the threshold
        if self.SHOW_HORIZONTAL_LINE:
            self.line_hor = line_default_horizontal(self)

            # vertical line showing which data point is going to be update next
        if self.SHOW_VERTICAL_LINE:
            self.line_ver = line_default_vertical(self)

        """ axes """
        if self.SHOW_AXES:
            self.coord_axes, self.y_axis_tics = axes_default_with_y_ticks(self)

        """ other stuff """
        # is Tkinter installed and running?
        self.SETTINGS = tkinter_register_with_settings(self.SETTINGS)

        # set default gl modes
        set_gl_defaults(self.POINT_SIZE)

        # try to render a smooth line (if supported by driver)
        gl_enable_line_smoothing()

        # set window title
        win_title = "generating random data"
        if self.USE_MMAP:
            win_title = "receiving data from matlab"
        nbr_points_shown = " -- showing %s points per panel." % self.nPoints
        self.set_caption(self.PLUGIN_NAME + " -- " + win_title + nbr_points_shown)

        # hide mouse - disabled.
        # self.set_mouse_visible(False)

        # schedule the 'update()' method to be called each 'update_interval'
        pyglet.clock.schedule_interval(self.update, self.update_interval)

        # Create a font for our FPS clock
        ft = pyglet.font.load("Arial", 28)
        self.fps_display = pyglet.clock.ClockDisplay(font=ft, interval=0.125, format="FPS %(fps).2f")