* src/docgen/PdfDoc.py: add the ability to open the document in the
default viewer * src/docgen/AbiWord2Doc.py: add the ability to open the document in AbiWord * src/docgen/OpenOfficeDoc.py: fixed the search for default viewer * src/docgen/RTFDoc.py: add the ability to open the document in the default viewer * src/docgen/HtmlDoc.py: add the ability to open the document in the default viewer * src/docgen/KwordDoc.py: add comment svn: r2575
This commit is contained in:
parent
f085ad7013
commit
2582bec96c
@ -31,6 +31,7 @@ Provides a BaseDoc based interface to the AbiWord document format.
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import base64
|
import base64
|
||||||
import string
|
import string
|
||||||
|
import os
|
||||||
|
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
import Errors
|
import Errors
|
||||||
@ -175,6 +176,14 @@ class AbiWordDoc(BaseDoc.BaseDoc):
|
|||||||
self.f.write('</abiword>\n')
|
self.f.write('</abiword>\n')
|
||||||
self.f.close()
|
self.f.close()
|
||||||
|
|
||||||
|
if self.print_req:
|
||||||
|
import grampslib
|
||||||
|
|
||||||
|
apptype = 'application/x-abiword'
|
||||||
|
prog = grampslib.default_application_command(apptype)
|
||||||
|
os.environ["FILE"] = self.filename
|
||||||
|
os.system ('%s "$FILE" &' % prog)
|
||||||
|
|
||||||
def add_photo(self,name,pos,x_cm,y_cm):
|
def add_photo(self,name,pos,x_cm,y_cm):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -297,4 +306,20 @@ class AbiWordDoc(BaseDoc.BaseDoc):
|
|||||||
def end_cell(self):
|
def end_cell(self):
|
||||||
self.f.write('</cell>\n')
|
self.f.write('</cell>\n')
|
||||||
|
|
||||||
Plugins.register_text_doc(_("AbiWord"),AbiWordDoc,1,1,1,".abw")
|
#--------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Register plugins
|
||||||
|
#
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
try:
|
||||||
|
import grampslib
|
||||||
|
import Utils
|
||||||
|
|
||||||
|
prog = grampslib.default_application_command("application/x-abiword")
|
||||||
|
if Utils.search_for(prog):
|
||||||
|
print_label=_("Open in AbiWord")
|
||||||
|
except:
|
||||||
|
print_label = None
|
||||||
|
|
||||||
|
Plugins.register_text_doc(_("AbiWord"),AbiWordDoc,1,1,1,".abw", print_label)
|
||||||
|
@ -333,6 +333,14 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
self.f.close()
|
self.f.close()
|
||||||
self.write_support_files()
|
self.write_support_files()
|
||||||
|
|
||||||
|
if self.print_req:
|
||||||
|
import grampslib
|
||||||
|
|
||||||
|
apptype = 'text/html'
|
||||||
|
prog = grampslib.default_application_command(apptype)
|
||||||
|
os.environ["FILE"] = self.filename
|
||||||
|
os.system ('%s "$FILE" &' % prog)
|
||||||
|
|
||||||
def write_support_files(self):
|
def write_support_files(self):
|
||||||
if self.map:
|
if self.map:
|
||||||
for name in self.map.keys():
|
for name in self.map.keys():
|
||||||
@ -457,4 +465,21 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
self.empty = 0
|
self.empty = 0
|
||||||
self.f.write(text)
|
self.f.write(text)
|
||||||
|
|
||||||
Plugins.register_text_doc(_("HTML"),HtmlDoc,1,0,1,".html")
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Register the document generator with the GRAMPS plugin system
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
|
try:
|
||||||
|
import grampslib
|
||||||
|
import Utils
|
||||||
|
|
||||||
|
prog = grampslib.default_application_command("text/html")
|
||||||
|
desc = grampslib.default_application_name("text/html")
|
||||||
|
if Utils.search_for(prog):
|
||||||
|
print_label=_("Open in %s") % desc
|
||||||
|
except:
|
||||||
|
print_label = None
|
||||||
|
|
||||||
|
Plugins.register_text_doc(_("HTML"),HtmlDoc,1,0,1,".html", print_label)
|
||||||
|
@ -476,4 +476,10 @@ class KwordDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
self.text = self.text + text
|
self.text = self.text + text
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Register the document generator with the GRAMPS plugin system
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
Plugins.register_text_doc(_("KWord"),KwordDoc,1,1,1,".kwd")
|
Plugins.register_text_doc(_("KWord"),KwordDoc,1,1,1,".kwd")
|
||||||
|
@ -967,16 +967,21 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
#
|
#
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
print_label = None
|
print_label = None
|
||||||
if os.access ("/usr/bin/oowriter", os.X_OK):
|
try:
|
||||||
print_label = _("Open in OpenOffice.org")
|
import grampslib
|
||||||
|
import Utils
|
||||||
|
|
||||||
|
apptype = 'application/vnd.sun.xml.writer'
|
||||||
|
prog = grampslib.default_application_command(apptype)
|
||||||
|
|
||||||
|
if Utils.search_for(prog):
|
||||||
|
print_label = _("Open in OpenOffice.org")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
Plugins.register_text_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,
|
Plugins.register_text_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,
|
||||||
".sxw",print_label)
|
".sxw",print_label)
|
||||||
Plugins.register_book_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,".sxw")
|
Plugins.register_book_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,".sxw")
|
||||||
|
|
||||||
print_label = None
|
|
||||||
if os.access ("/usr/bin/oodraw", os.X_OK):
|
|
||||||
print_label = _("Open in OpenOffice.org")
|
|
||||||
|
|
||||||
Plugins.register_draw_doc(_("OpenOffice.org Draw"),OpenOfficeDoc,1,1,".sxd",
|
Plugins.register_draw_doc(_("OpenOffice.org Draw"),OpenOfficeDoc,1,1,".sxd",
|
||||||
print_label);
|
print_label);
|
||||||
|
@ -175,7 +175,14 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
except:
|
except:
|
||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
# raise Errors.ReportError(_("Could not create %s") % self.filename)
|
|
||||||
|
if self.print_req:
|
||||||
|
import grampslib
|
||||||
|
|
||||||
|
apptype = 'application/pdf'
|
||||||
|
prog = grampslib.default_application_command(apptype)
|
||||||
|
os.environ["FILE"] = self.filename
|
||||||
|
os.system ('%s "$FILE" &' % prog)
|
||||||
|
|
||||||
def page_break(self):
|
def page_break(self):
|
||||||
self.story.append(PageBreak())
|
self.story.append(PageBreak())
|
||||||
@ -565,12 +572,24 @@ def make_color(c):
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
|
try:
|
||||||
|
import grampslib
|
||||||
|
import Utils
|
||||||
|
|
||||||
|
prog = grampslib.default_application_command("application/pdf")
|
||||||
|
desc = grampslib.default_application_name("application/pdf")
|
||||||
|
if Utils.search_for(prog):
|
||||||
|
print_label=_("Open in %s") % desc
|
||||||
|
except:
|
||||||
|
print_label = None
|
||||||
|
|
||||||
Plugins.register_draw_doc(
|
Plugins.register_draw_doc(
|
||||||
_("PDF"),
|
_("PDF"),
|
||||||
PdfDoc,
|
PdfDoc,
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
".pdf"
|
".pdf",
|
||||||
|
print_label
|
||||||
)
|
)
|
||||||
|
|
||||||
Plugins.register_text_doc(
|
Plugins.register_text_doc(
|
||||||
@ -579,7 +598,8 @@ Plugins.register_text_doc(
|
|||||||
table=1,
|
table=1,
|
||||||
paper=1,
|
paper=1,
|
||||||
style=1,
|
style=1,
|
||||||
ext=".pdf"
|
ext=".pdf",
|
||||||
|
print_report_label=print_label
|
||||||
)
|
)
|
||||||
|
|
||||||
Plugins.register_book_doc(
|
Plugins.register_book_doc(
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import string
|
import string
|
||||||
|
import os
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -124,6 +125,14 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
self.f.write('}\n')
|
self.f.write('}\n')
|
||||||
self.f.close()
|
self.f.close()
|
||||||
|
|
||||||
|
if self.print_req:
|
||||||
|
import grampslib
|
||||||
|
|
||||||
|
apptype = 'application/rtf'
|
||||||
|
prog = grampslib.default_application_command(apptype)
|
||||||
|
os.environ["FILE"] = self.filename
|
||||||
|
os.system ('%s "$FILE" &' % prog)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Force a section page break
|
# Force a section page break
|
||||||
@ -402,4 +411,20 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
self.text = self.text.replace('<super>','{{\*\updnprop5801}\up10 ')
|
self.text = self.text.replace('<super>','{{\*\updnprop5801}\up10 ')
|
||||||
self.text = self.text.replace('</super>','}')
|
self.text = self.text.replace('</super>','}')
|
||||||
|
|
||||||
Plugins.register_text_doc(_("Rich Text Format (RTF)"),RTFDoc,1,1,1,".rtf")
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Register the document generator with the GRAMPS plugin system
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
try:
|
||||||
|
import grampslib
|
||||||
|
import Utils
|
||||||
|
|
||||||
|
prog = grampslib.default_application_command("application/rtf")
|
||||||
|
desc = grampslib.default_application_name("application/rtf")
|
||||||
|
if Utils.search_for(prog):
|
||||||
|
print_label=_("Open in %s") % desc
|
||||||
|
except:
|
||||||
|
print_label = None
|
||||||
|
|
||||||
|
Plugins.register_text_doc(_("Rich Text Format (RTF)"),RTFDoc,1,1,1,".rtf", print_label)
|
||||||
|
Loading…
Reference in New Issue
Block a user