Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
grabWindowPixmap() broken for QCDATWidget #1276
The saveToPNG() implementation in QCDATWidget doesn't correctly handle the case where the filename argument is None, which makes VCS fail.
I'm not sure what is expected here.
referenced this issue
May 6, 2015
This was referenced
Jun 10, 2015
Traceback as of 2.2.0-45, vistrails 2.2.0-12
Second attempt at exporting causes segmentation fault:
This seems to work:
diff --git a/Packages/vcs/Lib/VTKPlots.py b/Packages/vcs/Lib/VTKPlots.py index 1c1f112..bd894b0 100644 --- a/Packages/vcs/Lib/VTKPlots.py +++ b/Packages/vcs/Lib/VTKPlots.py @@ -851,17 +851,18 @@ def gif(self,filename='noname.gif', merge='r', orientation=None, geometry='1600x def png(self, file, width=None,height=None,units=None,draw_white_background = True, **args ): +@ -854,13 +1583,14 @@ def png(self, file, width=None,height=None,units=None,draw_white_background = Tr if self.renWin is None: raise Exception,"Nothing to dump aborting" - if not file.split('.')[-1].lower() in ['png']: - file+='.png' - - try: - os.remove(file) - except: - pass + if file is not None: + if not file.split('.')[-1].lower() in ['png']: + file+='.png' + try: + os.remove(file) + except: + pass #if width is not None and height is not None: # self.renWin.SetSize(width,height) @@ -883,8 +884,16 @@ def png(self, file, width=None,height=None,units=None,draw_white_background = Tr writer = vtk.vtkPNGWriter() writer.SetInputConnection(imgfiltr.GetOutputPort()) - writer.SetFileName(file) + + if file is not None: + writer.SetFileName(file) + else: + writer.WriteToMemoryOn() writer.Write() + if file is not None: + return file + else: + return writer.GetResult()