Minor mods to Grapher to try and resolve issue with multiple plots being
added
This commit is contained in:
		
							parent
							
								
									c505e98bcf
								
							
						
					
					
						commit
						17609ce71b
					
				|  | @ -46,9 +46,15 @@ class GuiGraphViewer (threading.Thread): | ||||||
|         return self.mainHBox |         return self.mainHBox | ||||||
|     #end def get_vbox |     #end def get_vbox | ||||||
| 
 | 
 | ||||||
|  |     def clearGraphData(self): | ||||||
|  |         self.fig.clf() | ||||||
|  |         if self.canvas is not None: | ||||||
|  |             self.canvas.destroy() | ||||||
|  | 
 | ||||||
|  |         self.canvas = FigureCanvas(self.fig)  # a gtk.DrawingArea | ||||||
|  | 
 | ||||||
|     def generateGraph(self, widget, data): |     def generateGraph(self, widget, data): | ||||||
|         try: self.canvas.destroy() |         self.clearGraphData() | ||||||
|         except AttributeError: pass |  | ||||||
| 
 | 
 | ||||||
|         sitenos = [] |         sitenos = [] | ||||||
|         playerids = [] |         playerids = [] | ||||||
|  | @ -72,7 +78,6 @@ class GuiGraphViewer (threading.Thread): | ||||||
|             print "No player ids found" |             print "No player ids found" | ||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
|         self.fig = Figure(figsize=(5,4), dpi=100) |  | ||||||
| 
 | 
 | ||||||
|         #Set graph properties |         #Set graph properties | ||||||
|         self.ax = self.fig.add_subplot(111) |         self.ax = self.fig.add_subplot(111) | ||||||
|  | @ -104,7 +109,6 @@ class GuiGraphViewer (threading.Thread): | ||||||
|             #Draw plot |             #Draw plot | ||||||
|             self.ax.plot(line,) |             self.ax.plot(line,) | ||||||
| 
 | 
 | ||||||
|             self.canvas = FigureCanvas(self.fig)  # a gtk.DrawingArea |  | ||||||
|             self.graphBox.add(self.canvas) |             self.graphBox.add(self.canvas) | ||||||
|             self.canvas.show() |             self.canvas.show() | ||||||
|     #end of def showClicked |     #end of def showClicked | ||||||
|  | @ -372,6 +376,9 @@ class GuiGraphViewer (threading.Thread): | ||||||
|         self.leftPanelBox.show() |         self.leftPanelBox.show() | ||||||
|         self.graphBox.show() |         self.graphBox.show() | ||||||
| 
 | 
 | ||||||
|  |         self.fig = Figure(figsize=(5,4), dpi=100) | ||||||
|  |         self.canvas = None | ||||||
|  | 
 | ||||||
| ################################# | ################################# | ||||||
| # | # | ||||||
| #        self.db.cursor.execute("""select UNIX_TIMESTAMP(handStart) as time, id from Hands ORDER BY time""") | #        self.db.cursor.execute("""select UNIX_TIMESTAMP(handStart) as time, id from Hands ORDER BY time""") | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user