Separate some general code from GUI specific code - particularly for graph generators so that graphs can be generated from the CLI.

svn: r16838
This commit is contained in:
Brian Matherly
2011-03-17 03:02:36 +00:00
parent 12a01f6700
commit e6befe67b9
15 changed files with 959 additions and 1049 deletions

View File

@@ -76,6 +76,7 @@ from QuestionDialog import WarningDialog, ErrorDialog
from gen.plug.menu import PersonOption, FilterOption, FamilyOption
import ManagedWindow
from glade import Glade
from gui.utils import open_file_with_default_application
# Import from specific modules in ReportBase
from gen.plug.report import CATEGORY_BOOK, book_categories
@@ -1200,9 +1201,6 @@ class BookReportDialog(DocReportDialog):
report_class, item.option_class)
self.rptlist.append(obj)
self.doc.open(self.target_path)
if self.open_with_app.get_active():
self.doc.open_requested()
def make_report(self):
"""The actual book report. Start it out, then go through the item list
@@ -1217,6 +1215,9 @@ class BookReportDialog(DocReportDialog):
item.begin_report()
item.write_report()
self.doc.close()
if self.open_with_app.get_active():
open_file_with_default_application(self.target_path)
#------------------------------------------------------------------------
#

View File

@@ -35,11 +35,9 @@ from gen.ggettext import gettext as _
# Gramps modules
#
#------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
from gen.plug.docgen import (BaseDoc, TextDoc,
PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER)
import Errors
import Utils
#------------------------------------------------------------------------
#
@@ -165,9 +163,6 @@ class AsciiDoc(BaseDoc,TextDoc):
def close(self):
self.f.close()
if self.open_req:
open_file_with_default_application(self.filename)
def get_usable_width(self):
return _WIDTH_IN_CHARS

View File

@@ -45,7 +45,6 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
import ImgManip
import const
from gen.plug.docgen import BaseDoc, TextDoc, FONT_SANS_SERIF
@@ -239,10 +238,6 @@ class HtmlDoc(BaseDoc, TextDoc):
self._backend.close()
self.write_support_files()
if self.open_req:
import Utils
open_file_with_default_application(self._backend.getf())
def copy_file(self, from_fname, to_fname, to_dir=''):
"""
Copy a file from a source to a (report) destination.

View File

@@ -41,7 +41,6 @@ from bisect import bisect
# gramps modules
#
#------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
from gen.plug.docgen import BaseDoc, TextDoc, PAPER_LANDSCAPE, FONT_SANS_SERIF
from gen.plug.docbackend import DocBackend
import ImgManip
@@ -404,8 +403,6 @@ class LaTeXDoc(BaseDoc, TextDoc):
self._backend.write('\\end{enumerate}\n')
self._backend.write('\n\\end{document}\n')
self._backend.close()
if self.open_req:
open_file_with_default_application(self._backend.filename)
def end_page(self):
"""Issue a new page command"""

View File

@@ -78,7 +78,6 @@ from xml.sax.saxutils import escape
# Gramps modules
#
#-------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
from gen.plug.docgen import (BaseDoc, TextDoc, DrawDoc, graphicstyle,
FONT_SANS_SERIF, SOLID, PAPER_PORTRAIT,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,
@@ -809,8 +808,6 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
self._write_meta_file()
self._write_mimetype_file()
self._write_zip()
if self.open_req:
open_file_with_default_application(self.filename)
def add_styled_notes_fonts(self):
"""

View File

@@ -36,7 +36,6 @@ from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#Gramps modules
#-------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
from gen.plug.report import utils as ReportUtils
from gen.plug.docgen import BaseDoc, DrawDoc, FONT_SERIF, PAPER_PORTRAIT, SOLID
from gen.plug.utils import gformat
@@ -147,8 +146,6 @@ class PSDrawDoc(BaseDoc, DrawDoc):
'%%EOF\n'
)
self.file.close()
if self.open_req:
open_file_with_default_application(self.filename)
def write_text(self, text, mark=None):
pass

View File

@@ -37,7 +37,6 @@ import sys
# Gramps modules
#
#------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
import libcairodoc
#------------------------------------------------------------------------
@@ -124,6 +123,3 @@ class PdfDoc(libcairodoc.CairoDoc):
# if we don't restore the resolution.
fontmap.set_resolution(saved_resolution)
# load the result into an external viewer
if self.open_req:
open_file_with_default_application(self._backend.filename)

View File

@@ -35,7 +35,6 @@ from gen.ggettext import gettext as _
# Load the base BaseDoc class
#
#------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
from gen.plug.docgen import (BaseDoc, TextDoc, FONT_SERIF, PARA_ALIGN_RIGHT,
PARA_ALIGN_CENTER, PARA_ALIGN_JUSTIFY)
import ImgManip
@@ -134,9 +133,6 @@ class RTFDoc(BaseDoc,TextDoc):
self.f.write('}\n')
self.f.close()
if self.open_req:
open_file_with_default_application(self.filename)
#--------------------------------------------------------------------
#
# Force a section page break