  from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg,
                                                 NavigationToolbar2Tk)  # noqa
  
  from .tooltip import Tooltip  # noqa
  from .utils import get_config, get_images  # noqa
  
  logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
  
  
  class NavigationToolbar(NavigationToolbar2Tk):  # pylint: disable=too-many-ancestors
 
</s> remove from .utils import get_config, get_images
 </s> add from .utils import get_config, get_images, LongRunningTask </s> remove                 self.complete.set()
 </s> add         except Exception:  # pylint: disable=broad-except
            self.err = sys.exc_info()
            logger.debug("Error in thread (%s): %s", self._name,
                         self.err[1].with_traceback(self.err[2])) </s> remove         logger.debug("Updating plot")
        self.calcs.refresh()
        self.update_plot(initiate=False)
        self.plotcanvas.draw()
        get_config().tk_vars["refreshgraph"].set(False)
 </s> add         refresh_var = get_config().tk_vars["refreshgraph"]
        if not refresh_var.get() and self.thread is None:
            return

        if self.thread is None:
            logger.debug("Updating plot data")
            self.thread = LongRunningTask(target=self.calcs.refresh)
            self.thread.start()
            self.after(1000, self.refresh)
        elif not self.thread.complete.is_set():
            logger.debug("Graph Data not yet available")
            self.after(1000, self.refresh)
        else:
            logger.debug("Updating plot with data from background thread")
            self.calcs = self.thread.get_result()  # Terminate the LongRunningTask object
            self.thread = None
            self.update_plot(initiate=False)
            self.plotcanvas.draw()
            refresh_var.set(False) </s> remove         if self.complete.is_set():
            logger.debug("Getting result from thread")
            retval = self._queue.get()
 </s> add         if not self.complete.is_set():
            logger.warning("Aborting attempt to retrieve result from a LongRunningTask that is "
                           "still running")
            return None
        if self.err:
            logger.debug("Error caught in thread")
            self._config.set_cursor_default(widget=self.widget)
            raise self.err[1].with_traceback(self.err[2])

        logger.debug("Getting result from thread")
        retval = self._queue.get()
from .utils import get_config, get_images, LongRunningTask  # noqa
  from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg,
                                                 NavigationToolbar2Tk)  # noqa
  
  from .tooltip import Tooltip  # noqa
from .utils import get_config, get_images, LongRunningTask  # noqa
  
  logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
  
  
  class NavigationToolbar(NavigationToolbar2Tk):  # pylint: disable=too-many-ancestors
keep keep keep keep replace keep keep keep keep keep
 GUI responsiveness and feature updates

- Add error handling to LongRunningTask
- Analysis: Fix timestats bug for missing session data
- Training: Update training graph inside LongRunningTask
- Training: Smoothing Amount Slider geometry fix
- Training: Auto update Analysis tab on training start and save interval
- Scripts: Keep control of the UI when terminating by terminating using LongRunningTask 
lib/gui/display_graph.py