-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bugs #416
Fix bugs #416
Changes from all commits
18893c5
5a233ea
95f4aaf
0b4e661
036a5d7
dd0d977
558a33a
c6b09d4
b794739
7a41c9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
from __future__ import print_function | ||
|
||
import os | ||
import os.path | ||
|
||
from apptools.persistence import state_pickler | ||
|
@@ -683,6 +684,10 @@ def save_gl2ps(self, file_name, exp=None): | |
self._exporter_write(ex) | ||
else: | ||
ex.write() | ||
# Work around for a bug in VTK where it saves the file as a | ||
# .pdf.gz when the file is really a PDF file. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this bug known to the VTK developers? If so, it would be useful to have a reference to a VTK issue, so that future readers of this code have a way to determine whether the upstream bug has been fixed or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know and its hard for me to find the time to follow up but I will try to do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked at the sources and it seems the GL2PS code has changed considerably with VTK 7.0 The GL2PS exporter has been completely changed and looks like the bug shouldn't be there -- but I did not test as I do not have a VTK 7 build with GL2PS enabled on my system. |
||
if f_ext == '.pdf' and os.path.exists(f_prefix + '.pdf.gz'): | ||
os.rename(f_prefix + '.pdf.gz', file_name) | ||
|
||
def save_x3d(self, file_name): | ||
"""Save scene to an X3D file (http://www.web3d.org/x3d/). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Collection of utility functions common to different toolkits. | ||
""" | ||
|
||
def popup_save(parent=None): | ||
"""Popup a dialog asking for an image name to save the scene to. | ||
This is used mainly to save a scene in full screen mode. Returns a | ||
filename, returns empty string if action was cancelled. `parent` is | ||
the parent widget over which the dialog will be popped up. | ||
""" | ||
from pyface.api import FileDialog, OK | ||
|
||
extensions = ['*.png', '*.jpg', '*.tiff', '*.bmp', '*.ps', | ||
'*.eps', '*.pdf', '*.tex', '*.rib', '*.wrl', | ||
'*.oogl', '*.vrml', '*.obj', '*.iv', '*.pov', | ||
'*.x3d'] | ||
descriptions = ["PNG", "JPG", "TIFF", "Bitmap", "PostScript", | ||
"EPS", "PDF", "Tex", "RIB", "WRL", | ||
"Geomview", "VRML", "Wavefront", "Open Inventor", | ||
"Povray", "X3D"] | ||
wildcard = "" | ||
for description, extension in zip(descriptions, extensions): | ||
wildcard += "{} ({})|{}|".format(description, | ||
extension, | ||
extension) | ||
wildcard += "Determine by extension (*.*)|(*.*)" | ||
|
||
dialog = FileDialog( | ||
parent=parent, title='Save scene to image', | ||
action='save as', default_filename="snapshot.png", | ||
wildcard=wildcard | ||
) | ||
if dialog.open() == OK: | ||
return dialog.path | ||
else: | ||
return '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't
import os
makeimport os.path
redundant?