Add graph preview based on MIME type.
svn: r6319
This commit is contained in:
parent
a5a961584b
commit
0eb3838f92
@ -1,3 +1,6 @@
|
|||||||
|
2006-04-12 Brian Matherly <pez4brian@users.sourceforge.net>
|
||||||
|
* src/plugins/GraphViz.py: Add graph preview based on mime (Bug 1449796)
|
||||||
|
|
||||||
2006-04-12 Alex Roitman <shura@gramps-project.org>
|
2006-04-12 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/plugins/Check.py (Check.__init__): Typo.
|
* src/plugins/Check.py (Check.__init__): Typo.
|
||||||
|
|
||||||
|
@ -69,12 +69,12 @@ from QuestionDialog import ErrorDialog
|
|||||||
class _options:
|
class _options:
|
||||||
# internal ID, english option name (for cli), localized option name (for gui)
|
# internal ID, english option name (for cli), localized option name (for gui)
|
||||||
formats = (
|
formats = (
|
||||||
("ps", "Postscript", _("Postscript")),
|
("ps", "Postscript", _("Postscript"), "application/postscript"),
|
||||||
("svg", "Structured Vector Graphics (SVG)", _("Structured Vector Graphics (SVG)")),
|
("svg", "Structured Vector Graphics (SVG)", _("Structured Vector Graphics (SVG)"), "image/svg"),
|
||||||
("svgz", "Compressed Structured Vector Graphics (SVG)", _("Compressed Structured Vector Graphics (SVG)")),
|
("svgz", "Compressed Structured Vector Graphics (SVG)", _("Compressed Structured Vector Graphs (SVG)"), "image/svgz"),
|
||||||
("png", "PNG image", _("PNG image")),
|
("png", "PNG image", _("PNG image"), "image/png"),
|
||||||
("jpg", "JPEG image", _("JPEG image")),
|
("jpg", "JPEG image", _("JPEG image"), "image/jpeg"),
|
||||||
("gif", "GIF image", _("GIF image")),
|
("gif", "GIF image", _("GIF image"), "image/gif"),
|
||||||
)
|
)
|
||||||
fonts = (
|
fonts = (
|
||||||
# Last items tells whether strings need to be converted to Latin1
|
# Last items tells whether strings need to be converted to Latin1
|
||||||
@ -878,7 +878,20 @@ class GraphicsFormatComboBox(gtk.ComboBox):
|
|||||||
return _options.formats[self.get_active()][0]
|
return _options.formats[self.get_active()][0]
|
||||||
|
|
||||||
def get_printable(self):
|
def get_printable(self):
|
||||||
return None
|
_apptype = _options.formats[self.get_active()][3]
|
||||||
|
print_label = None
|
||||||
|
try:
|
||||||
|
import Utils
|
||||||
|
import GrampsMime
|
||||||
|
mprog = GrampsMime.get_application(_apptype)
|
||||||
|
if Utils.search_for(mprog[0]):
|
||||||
|
print_label = _("Open in %(program_name)s") % { 'program_name':
|
||||||
|
mprog[1]}
|
||||||
|
else:
|
||||||
|
print_label = None
|
||||||
|
except:
|
||||||
|
print_label = None
|
||||||
|
return print_label
|
||||||
|
|
||||||
def get_clname(self):
|
def get_clname(self):
|
||||||
return 'print'
|
return 'print'
|
||||||
@ -890,11 +903,15 @@ class GraphicsFormatComboBox(gtk.ComboBox):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class EmptyDoc:
|
class EmptyDoc:
|
||||||
def __init__(self,styles,type,template,orientation,source=None):
|
def __init__(self,styles,type,template,orientation,source=None):
|
||||||
|
self.print_req = 0
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def print_requested(self):
|
||||||
|
self.print_req = 1
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -939,6 +956,22 @@ class GraphVizGraphics(Report.Report):
|
|||||||
(self.the_format,self.user_output,
|
(self.the_format,self.user_output,
|
||||||
self.junk_output,self.junk_output))
|
self.junk_output,self.junk_output))
|
||||||
|
|
||||||
|
if self.doc.print_req:
|
||||||
|
_apptype = None
|
||||||
|
for format in _options.formats:
|
||||||
|
if format[0] == self.the_format:
|
||||||
|
_apptype = format[3]
|
||||||
|
break
|
||||||
|
if _apptype:
|
||||||
|
try:
|
||||||
|
import Utils
|
||||||
|
import GrampsMime
|
||||||
|
app = GrampsMime.get_application(_apptype)
|
||||||
|
os.environ["FILE"] = self.user_output
|
||||||
|
os.system ('%s "$FILE" &' % app[0])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user