part 2 basedoc: move BaseDoc.py to /gen/plug/docgen and add /gen/plug/docbackend
that was missing in part 1 Still to come: makefiles and splitting new basedoc.py in small files svn: r12591
This commit is contained in:
@@ -35,7 +35,7 @@ from gettext import gettext as _
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import BaseDoc
|
||||
from gen.plug.docgen.basedoc import FONT_SERIF
|
||||
from docgen import SpreadSheetDoc
|
||||
|
||||
import const
|
||||
@@ -148,7 +148,7 @@ class ODSDoc(SpreadSheetDoc):
|
||||
self.f.write('fo:padding-left="%.3fcm" ' % style.get_padding())
|
||||
self.f.write('style:text-outline="false" ')
|
||||
self.f.write('style:text-crossing-out="none" ')
|
||||
if font.get_type_face() == BaseDoc.FONT_SERIF:
|
||||
if font.get_type_face() == FONT_SERIF:
|
||||
self.f.write('style:font-name="Times New Roman" ')
|
||||
else:
|
||||
self.f.write('style:font-name="Arial" ')
|
||||
|
@@ -35,7 +35,7 @@ from gettext import gettext as _
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import BaseDoc
|
||||
from gen.plug.docgen.basedoc import FONT_SERIF
|
||||
from SpreadSheetDoc import SpreadSheetDoc
|
||||
|
||||
import const
|
||||
@@ -142,7 +142,7 @@ class OpenSpreadSheet(SpreadSheetDoc):
|
||||
self.f.write('fo:padding-left="%.3fcm" ' % style.get_padding())
|
||||
self.f.write('style:text-outline="false" ')
|
||||
self.f.write('style:text-crossing-out="none" ')
|
||||
if font.get_type_face() == BaseDoc.FONT_SERIF:
|
||||
if font.get_type_face() == FONT_SERIF:
|
||||
self.f.write('style:font-name="Times New Roman" ')
|
||||
else:
|
||||
self.f.write('style:font-name="Arial" ')
|
||||
|
@@ -18,7 +18,9 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import BaseDoc
|
||||
from gen.plug.docgen import FontStyle, ParagraphStyle, TableStyle,\
|
||||
TableCellStyle
|
||||
from gen.plug.docgen.basedoc import PAPER_PORTRAIT
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@@ -26,9 +28,9 @@ import BaseDoc
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class SpreadSheetDoc(object):
|
||||
def __init__(self,type, orientation=BaseDoc.PAPER_PORTRAIT):
|
||||
def __init__(self,type, orientation=PAPER_PORTRAIT):
|
||||
self.orientation = orientation
|
||||
if orientation == BaseDoc.PAPER_PORTRAIT:
|
||||
if orientation == PAPER_PORTRAIT:
|
||||
self.width = type.get_width()
|
||||
self.height = type.get_height()
|
||||
else:
|
||||
@@ -39,7 +41,7 @@ class SpreadSheetDoc(object):
|
||||
self.lmargin = 2.54
|
||||
self.rmargin = 2.54
|
||||
|
||||
self.font = BaseDoc.FontStyle()
|
||||
self.font = FontStyle()
|
||||
self.actfont = self.font
|
||||
self.style_list = {}
|
||||
self.table_styles = {}
|
||||
@@ -56,16 +58,16 @@ class SpreadSheetDoc(object):
|
||||
self.name = name
|
||||
|
||||
def add_style(self, name,style):
|
||||
self.style_list[name] = BaseDoc.ParagraphStyle(style)
|
||||
self.style_list[name] = ParagraphStyle(style)
|
||||
|
||||
def add_table_style(self, name,style):
|
||||
self.table_styles[name] = BaseDoc.TableStyle(style)
|
||||
self.table_styles[name] = TableStyle(style)
|
||||
|
||||
def add_cell_style(self, name,style):
|
||||
self.cell_styles[name] = BaseDoc.TableCellStyle(style)
|
||||
self.cell_styles[name] = TableCellStyle(style)
|
||||
|
||||
def change_font(self,font):
|
||||
self.actfont = BaseDoc.FontStyle(font)
|
||||
self.actfont = FontStyle(font)
|
||||
|
||||
def restore_font(self):
|
||||
self.actfont = self.font
|
||||
|
@@ -35,7 +35,10 @@ import pango
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import BaseDoc
|
||||
from gen.plug.docgen import BaseDoc, TextDoc
|
||||
from gen.plug.docgen.basedoc import (FONT_SERIF, PARA_ALIGN_RIGHT,
|
||||
FONT_SANS_SERIF, FONT_MONOSPACE, PARA_ALIGN_CENTER,
|
||||
PARA_ALIGN_LEFT)
|
||||
import ManagedWindow
|
||||
|
||||
try:
|
||||
@@ -93,7 +96,7 @@ class DocumentManager(object):
|
||||
# TextBuf
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class TextBufDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc):
|
||||
class TextBufDoc(BaseDoc, TextDoc):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@@ -111,21 +114,21 @@ class TextBufDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc):
|
||||
|
||||
style = sheet.get_paragraph_style(name)
|
||||
font = style.get_font()
|
||||
if font.get_type_face() == BaseDoc.FONT_SERIF:
|
||||
if font.get_type_face() == FONT_SERIF:
|
||||
tag.set_property("family", "Serif")
|
||||
elif font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
|
||||
elif font.get_type_face() == FONT_SANS_SERIF:
|
||||
tag.set_property("family", "Sans")
|
||||
elif font.get_type_face() == BaseDoc.FONT_MONOSPACE:
|
||||
elif font.get_type_face() == FONT_MONOSPACE:
|
||||
tag.set_property("family", "MonoSpace")
|
||||
|
||||
tag.set_property("size-points", float(font.get_size()))
|
||||
if font.get_bold():
|
||||
tag.set_property("weight", pango.WEIGHT_BOLD)
|
||||
if style.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
|
||||
if style.get_alignment() == PARA_ALIGN_RIGHT:
|
||||
tag.set_property("justification", gtk.JUSTIFY_RIGHT)
|
||||
elif style.get_alignment() == BaseDoc.PARA_ALIGN_LEFT:
|
||||
elif style.get_alignment() == PARA_ALIGN_LEFT:
|
||||
tag.set_property("justification", gtk.JUSTIFY_LEFT)
|
||||
elif style.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
|
||||
elif style.get_alignment() == PARA_ALIGN_CENTER:
|
||||
tag.set_property("justification", gtk.JUSTIFY_CENTER)
|
||||
else:
|
||||
tag.set_property("justification", gtk.JUSTIFY_FILL)
|
||||
|
Reference in New Issue
Block a user