From 18ba12011538fd79809636b2d45742aa48ab2e38 Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Tue, 6 Aug 2013 19:57:52 +0000 Subject: [PATCH] Rename PSDrawDoc to PsDoc, reduce .py file count. Follow-up to code review, see the bug# 6883. svn: r22808 --- po/POTFILES.in | 2 +- po/POTFILES.skip | 3 -- src/plugins/docgen/Makefile.am | 3 +- src/plugins/docgen/PSDrawDoc.py | 35 ------------------- src/plugins/docgen/PdfDoc.py | 34 ------------------ .../docgen/{_cairodoc.py => cairodoc.py} | 13 +++++++ src/plugins/docgen/docgen.gpr.py | 12 +++---- 7 files changed, 21 insertions(+), 81 deletions(-) delete mode 100644 src/plugins/docgen/PSDrawDoc.py delete mode 100644 src/plugins/docgen/PdfDoc.py rename src/plugins/docgen/{_cairodoc.py => cairodoc.py} (95%) diff --git a/po/POTFILES.in b/po/POTFILES.in index 3417b05bd..de69998ca 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -235,7 +235,7 @@ src/plugins/docgen/GtkPrint.py src/plugins/docgen/HtmlDoc.py src/plugins/docgen/LaTeXDoc.py src/plugins/docgen/ODFDoc.py -src/plugins/docgen/PSDrawDoc.py +src/plugins/docgen/cairodoc.py src/plugins/docgen/RTFDoc.py src/plugins/docgen/SvgDrawDoc.py diff --git a/po/POTFILES.skip b/po/POTFILES.skip index a9f52c0f0..159458c2a 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -283,9 +283,6 @@ src/Merge/test/merge_ref_test.py # plugins gpr directory src/plugins/sidebar/sidebar.gpr.py -# plugins/docgen directory -src/plugins/docgen/PdfDoc.py - # plugins/lib directory src/plugins/lib/libformatting.py src/plugins/lib/libgrampsxml.py diff --git a/src/plugins/docgen/Makefile.am b/src/plugins/docgen/Makefile.am index 806d4ae59..690031dc1 100644 --- a/src/plugins/docgen/Makefile.am +++ b/src/plugins/docgen/Makefile.am @@ -13,8 +13,7 @@ pkgpython_PYTHON = \ HtmlDoc.py \ LaTeXDoc.py \ ODFDoc.py \ - PdfDoc.py \ - PSDrawDoc.py \ + cairodoc.py \ RTFDoc.py \ SvgDrawDoc.py diff --git a/src/plugins/docgen/PSDrawDoc.py b/src/plugins/docgen/PSDrawDoc.py deleted file mode 100644 index abe3a39dc..000000000 --- a/src/plugins/docgen/PSDrawDoc.py +++ /dev/null @@ -1,35 +0,0 @@ -# -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2013 Vassilii Khachaturov -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -# $Id$ - -"""PS output generator based on Cairo. -""" - -import sys -import cairo -from _cairodoc import CairoDocgen - -class PSDrawDoc(CairoDocgen): - """Render the document into PS file using Cairo. - """ - EXT = 'ps' - def create_cairo_surface(self, fobj, width_in_points, height_in_points): - return cairo.PSSurface(fobj, width_in_points, height_in_points) diff --git a/src/plugins/docgen/PdfDoc.py b/src/plugins/docgen/PdfDoc.py deleted file mode 100644 index d592a60ba..000000000 --- a/src/plugins/docgen/PdfDoc.py +++ /dev/null @@ -1,34 +0,0 @@ -# -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2013 Vassilii Khachaturov -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -# $Id$ - -"""PDF output generator based on Cairo. -""" - -import sys -import cairo -from _cairodoc import CairoDocgen - -class PdfDoc(CairoDocgen): - """Render the document into PDF file using Cairo. - """ - def create_cairo_surface(self, fobj, width_in_points, height_in_points): - return cairo.PDFSurface(fobj, width_in_points, height_in_points) diff --git a/src/plugins/docgen/_cairodoc.py b/src/plugins/docgen/cairodoc.py similarity index 95% rename from src/plugins/docgen/_cairodoc.py rename to src/plugins/docgen/cairodoc.py index 107720e4c..eaf59edd7 100644 --- a/src/plugins/docgen/_cairodoc.py +++ b/src/plugins/docgen/cairodoc.py @@ -291,3 +291,16 @@ def write_index(index, doc): doc.end_cell() doc.end_row() doc.end_table() + +class PdfDoc(CairoDocgen): + """Render the document into PDF file using Cairo. + """ + def create_cairo_surface(self, fobj, width_in_points, height_in_points): + return cairo.PDFSurface(fobj, width_in_points, height_in_points) + +class PsDoc(CairoDocgen): + """Render the document into PS file using Cairo. + """ + EXT = 'ps' + def create_cairo_surface(self, fobj, width_in_points, height_in_points): + return cairo.PSSurface(fobj, width_in_points, height_in_points) diff --git a/src/plugins/docgen/docgen.gpr.py b/src/plugins/docgen/docgen.gpr.py index 207531a82..be523f87a 100644 --- a/src/plugins/docgen/docgen.gpr.py +++ b/src/plugins/docgen/docgen.gpr.py @@ -131,10 +131,10 @@ plg = newplugin() plg.id = 'pdfdoc' plg.name = _('PDF document') plg.description = _("Generates documents in PDF format (.pdf).") -plg.version = '1.0' +plg.version = '1.1' plg.gramps_target_version = '3.4' plg.status = STABLE -plg.fname = 'PdfDoc.py' +plg.fname = 'cairodoc.py' plg.ptype = DOCGEN plg.basedocclass = 'PdfDoc' plg.paper = True @@ -143,7 +143,7 @@ plg.extension = "pdf" #------------------------------------------------------------------------ # -# PSDrawDoc docgen +# PsDoc docgen # #------------------------------------------------------------------------ @@ -151,12 +151,12 @@ plg = newplugin() plg.id = 'psdrawdoc' plg.name = _('PostScript') plg.description = _("Generates documents in PostScript format (.ps).") -plg.version = '2.0' +plg.version = '2.1' plg.gramps_target_version = '3.4' plg.status = STABLE -plg.fname = 'PSDrawDoc.py' +plg.fname = 'cairodoc.py' plg.ptype = DOCGEN -plg.basedocclass = 'PSDrawDoc' +plg.basedocclass = 'PsDoc' plg.paper = True plg.style = True plg.extension = "ps"