From 7d63ce33c62fdbb39341e21380be19d17c571c1b Mon Sep 17 00:00:00 2001 From: Juan Pablo Caram Date: Mon, 28 Dec 2015 18:08:25 -0500 Subject: [PATCH] Fix to skeleton for threaded bitmap cache. --- PlotCanvas.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/PlotCanvas.py b/PlotCanvas.py index be1e5c09..1046cded 100644 --- a/PlotCanvas.py +++ b/PlotCanvas.py @@ -20,7 +20,8 @@ import FlatCAMApp class CanvasCache(QtCore.QObject): - # Signals + # Signals: + # A bitmap is ready to be displayed. new_screen = QtCore.pyqtSignal() def __init__(self, plotcanvas, dpi=50): @@ -43,9 +44,16 @@ class CanvasCache(QtCore.QObject): def run(self): + print "CanvasCache Thread Started!" + self.plotcanvas.update_screen_request.connect(self.on_update_req) def on_update_req(self, extents): + """ + Event handler for an updated display request. + + :param extents: [xmin, xmax, ymin, ymax, zoom(optional)] + """ # Move the requested screen portion to the main thread # and inform about the update: @@ -60,7 +68,9 @@ class PlotCanvas(QtCore.QObject): Class handling the plotting area in the application. """ - # Signals + # Signals: + # Request for new bitmap to display. The parameter + # is a list with [xmin, xmax, ymin, ymax, zoom(optional)] update_screen_request = QtCore.pyqtSignal(list) def __init__(self, container): @@ -72,6 +82,9 @@ class PlotCanvas(QtCore.QObject): :param container: The parent container in which to draw plots. :rtype: PlotCanvas """ + + super(PlotCanvas, self).__init__() + # Options self.x_margin = 15 # pixels self.y_margin = 25 # Pixels