# Path: sktracker/ui/mpl/matplotlib_widget.py
# class MatplotlibWidget(FigureCanvas):
# 
#     def __init__(self, figure, parent):
#         """
#         """
#         super(MatplotlibWidget, self).__init__(figure)
#         self.setParent(parent)
# 
#         self.fig = figure
# 
#     def close_figure(self):
#         """
#         """
#         if self.fig:
#             self.fig.clf()
#             plt.close(self.fig)
#             self.fig = None


import sys
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
from . import MatplotlibWidget

        self.next_figure_button.clicked.connect(self.next_figure)
        self.previous_figure_button.clicked.connect(self.previous_figure)

        self.plot_canvas = None
        self.nav_toolbar = None
        self.fig_generator = None
        self.current_fig = None
        self.figures_list = []
        self.i = -1

    def add_figures(self, fig_generator):
        """
        """
        self.fig_generator = fig_generator
        self.next_figure()

    def add_figure(self, args):
        """
        """
        figure, title = args

        mess = "{} | Figure n°{}"
        self.status.setText(mess.format(title, self.i))

        self.current_fig = figure
        if figure not in self.figures_list:
            self.figures_list.append(args)
        self.remove_figure()


# Path: sktracker/ui/mpl/matplotlib_widget.py
# class MatplotlibWidget(FigureCanvas):
# 
#     def __init__(self, figure, parent):
#         """
#         """
#         super(MatplotlibWidget, self).__init__(figure)
#         self.setParent(parent)
# 
#         self.fig = figure
# 
#     def close_figure(self):
#         """
#         """
#         if self.fig:
#             self.fig.clf()
#             plt.close(self.fig)
#             self.fig = None


# Path: sktracker/ui/mpl/display_figures_widget.py
import sys
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
from . import MatplotlibWidget


        self.next_figure_button.clicked.connect(self.next_figure)
        self.previous_figure_button.clicked.connect(self.previous_figure)

        self.plot_canvas = None
        self.nav_toolbar = None
        self.fig_generator = None
        self.current_fig = None
        self.figures_list = []
        self.i = -1

    def add_figures(self, fig_generator):
        """
        """
        self.fig_generator = fig_generator
        self.next_figure()

    def add_figure(self, args):
        """
        """
        figure, title = args

        mess = "{} | Figure n°{}"
        self.status.setText(mess.format(title, self.i))

        self.current_fig = figure
        if figure not in self.figures_list:
            self.figures_list.append(args)
        self.remove_figure()


        self.plot_canvas = MatplotlibWidget(figure, self)