2004-02-29 21:05:44 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
|
|
|
# Copyright (C) 2000-2004 Donald N. Allingham
|
|
|
|
#
|
|
|
|
# Modifications and feature additions:
|
|
|
|
# 2002 Donald A. Peterson
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2004-02-29 23:12:38 +05:30
|
|
|
# Written by Billy C. Earney, 2003-2004
|
|
|
|
# Modified by Alex Roitman, 2004
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
"""LPR document generator"""
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# python modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
import string
|
|
|
|
|
|
|
|
import pygtk
|
|
|
|
|
|
|
|
import gnomeprint, gnomeprint.ui, gtk
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
import BaseDoc
|
|
|
|
import Plugins
|
|
|
|
import ImgManip
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Constants
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Spacing in points (distance between the bottoms of two adjacent lines)
|
|
|
|
_LINE_SPACING = 20
|
|
|
|
|
|
|
|
# Font constants -- specific for gnome-print
|
|
|
|
_FONT_SANS_SERIF = "Serif"
|
|
|
|
_FONT_SERIF = "Sans"
|
|
|
|
_FONT_MONOSPACE = "Monospace"
|
|
|
|
_FONT_BOLD = "Bold"
|
|
|
|
_FONT_ITALIC = "Italic"
|
|
|
|
_FONT_BOLD_ITALIC = "Bold Italic"
|
|
|
|
_FONT_REGULAR = "Regular"
|
|
|
|
|
|
|
|
# Formatting directive constants
|
2004-03-04 02:20:06 +05:30
|
|
|
_LINE_BREAK = "Break"
|
|
|
|
_BOLD = "Bold"
|
|
|
|
_SUPER = "Super"
|
2004-03-03 11:24:26 +05:30
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Units conversion
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2004-03-01 22:20:23 +05:30
|
|
|
def u2cm(unit):
|
2004-02-29 21:05:44 +05:30
|
|
|
"""
|
|
|
|
Convert gnome-print units to cm
|
|
|
|
"""
|
|
|
|
return 2.54 * unit / 72.0
|
|
|
|
|
2004-03-01 22:20:23 +05:30
|
|
|
def cm2u(cm):
|
2004-02-29 21:05:44 +05:30
|
|
|
"""
|
2004-03-01 22:20:23 +05:30
|
|
|
Convert cm to gnome-print units
|
2004-02-29 21:05:44 +05:30
|
|
|
"""
|
2004-03-01 22:20:23 +05:30
|
|
|
return cm * 72.0 / 2.54
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
2004-03-03 11:24:26 +05:30
|
|
|
# font lookup function
|
2004-03-01 22:20:23 +05:30
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2004-03-03 11:24:26 +05:30
|
|
|
def find_font_from_fontstyle(fontstyle):
|
|
|
|
"""
|
|
|
|
This function returns the gnomeprint.Font() object instance
|
2004-03-04 02:20:06 +05:30
|
|
|
corresponding to the parameters of BaseDoc.FontStyle() object.
|
2004-03-03 11:24:26 +05:30
|
|
|
|
|
|
|
fontstyle - a BaseDoc.FontStyle() instance
|
|
|
|
"""
|
2004-03-01 22:20:23 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
if fontstyle.get_type_face() == BaseDoc.FONT_SANS_SERIF:
|
|
|
|
face = _FONT_SANS_SERIF
|
|
|
|
elif fontstyle.get_type_face() == BaseDoc.FONT_SERIF:
|
|
|
|
face = _FONT_SERIF
|
|
|
|
elif fontstyle.get_type_face() == BaseDoc.FONT_MONOSPACE:
|
|
|
|
face = _FONT_MONOSPACE
|
|
|
|
|
|
|
|
if fontstyle.get_bold():
|
|
|
|
modifier = _FONT_BOLD
|
|
|
|
if fontstyle.get_italic():
|
|
|
|
modifier = _FONT_BOLD_ITALIC
|
|
|
|
elif fontstyle.get_italic():
|
|
|
|
modifier = _FONT_ITALIC
|
|
|
|
else:
|
|
|
|
modifier = _FONT_REGULAR
|
|
|
|
|
|
|
|
size = fontstyle.get_size()
|
|
|
|
|
|
|
|
return gnomeprint.font_find_closest("%s %s" % (face, modifier),size)
|
|
|
|
|
2004-03-04 02:20:06 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# basic font-specific text formatting functions
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2004-03-03 11:24:26 +05:30
|
|
|
def get_text_width(text,fontstyle):
|
2004-03-04 02:20:06 +05:30
|
|
|
"""
|
|
|
|
This function returns the width of text using given fontstyle
|
|
|
|
when not formatted.
|
|
|
|
|
|
|
|
text - a text whose width to find
|
|
|
|
fontstyle - a BaseDoc.FontStyle() instance
|
|
|
|
"""
|
2004-03-03 11:24:26 +05:30
|
|
|
font = find_font_from_fontstyle(fontstyle)
|
|
|
|
return font.get_width_utf8(text)
|
|
|
|
|
|
|
|
def get_text_height(text, width, fontstyle):
|
2004-03-04 02:20:06 +05:30
|
|
|
"""
|
|
|
|
This function returns the height of text using given fontstyle
|
|
|
|
when formatted to specified width.
|
|
|
|
|
|
|
|
text - a text whose height to find
|
|
|
|
width - formatting width
|
|
|
|
fontstyle - a BaseDoc.FontStyle() instance
|
|
|
|
"""
|
2004-03-03 11:24:26 +05:30
|
|
|
|
|
|
|
nlines = 0
|
|
|
|
|
|
|
|
if text and width > get_text_width(text,fontstyle):
|
|
|
|
nlines += 1
|
|
|
|
elif width <= get_text_width(text,fontstyle):
|
|
|
|
#divide up text and print
|
|
|
|
textlist = string.split(text)
|
|
|
|
the_text = ""
|
|
|
|
for element in textlist:
|
|
|
|
if get_text_width(the_text + element + " ",fontstyle) < width:
|
|
|
|
the_text = the_text + element + " "
|
|
|
|
else:
|
|
|
|
#__text contains as many words as this __width allows
|
|
|
|
nlines = nlines + 1
|
|
|
|
the_text = element + " "
|
2004-03-02 06:06:53 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
return nlines * _LINE_SPACING
|
|
|
|
|
|
|
|
def get_min_width(text,fontstyle):
|
2004-03-04 02:20:06 +05:30
|
|
|
"""
|
|
|
|
This function returns the minimal width of text using given fontstyle.
|
|
|
|
This is actually determined by the width of the longest word.
|
|
|
|
|
|
|
|
text - a text whose width to find
|
|
|
|
fontstyle - a BaseDoc.FontStyle() instance
|
|
|
|
"""
|
2004-03-03 11:24:26 +05:30
|
|
|
max_word_size = 0
|
|
|
|
for word in text.split():
|
|
|
|
length = get_text_width(word,fontstyle)
|
|
|
|
if length > max_word_size:
|
|
|
|
max_word_size = length
|
|
|
|
|
|
|
|
return max_word_size
|
|
|
|
|
2004-03-04 02:20:06 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# add to paragraph taking care of the newline characters
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def append_to_paragraph(paragraph,directive,text):
|
|
|
|
"""
|
|
|
|
Add a piece to the paragraph while
|
|
|
|
taking care of the newline characters.
|
|
|
|
|
|
|
|
paragraph - a GnomePrintParagraph() instance
|
|
|
|
directive - what to do with this piece
|
|
|
|
text - the text of the corresponding piece
|
|
|
|
"""
|
|
|
|
text_list = text.split('\n')
|
|
|
|
for the_text in text_list[:-1]:
|
|
|
|
paragraph.add_piece(directive,the_text)
|
|
|
|
paragraph.add_piece(_LINE_BREAK,"")
|
|
|
|
paragraph.add_piece(directive,text_list[-1:][0])
|
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Paragraph class
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
class GnomePrintParagraph:
|
|
|
|
"""
|
|
|
|
A paragraph abstraction which provides the means for in-paragraph
|
|
|
|
formatting.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self,paragraph_style):
|
|
|
|
"""
|
|
|
|
Creates a GnomePrintParapgrah instance.
|
|
|
|
|
|
|
|
paragraph_style - an instance of BaseDoc paragraph style object
|
|
|
|
"""
|
|
|
|
self.style = paragraph_style
|
|
|
|
self.fontstyle = self.style.get_font()
|
|
|
|
self.piece_list = []
|
|
|
|
|
|
|
|
def add_piece(self,directive,text):
|
|
|
|
"""
|
|
|
|
Add a piece to the paragraph.
|
|
|
|
|
|
|
|
directive - what to do with this piece
|
2004-03-04 02:20:06 +05:30
|
|
|
text - the text of the corresponding piece
|
2004-03-03 11:24:26 +05:30
|
|
|
"""
|
|
|
|
self.piece_list.append((directive,text))
|
|
|
|
|
|
|
|
def get_piece_list(self):
|
|
|
|
"""
|
|
|
|
Return a list of pieces for the paragraph.
|
|
|
|
"""
|
|
|
|
return self.piece_list
|
|
|
|
|
|
|
|
def get_fontstyle(self):
|
|
|
|
"""
|
|
|
|
Return fontstyle for the paragraph
|
|
|
|
"""
|
|
|
|
return self.fontstyle
|
|
|
|
|
2004-03-04 05:08:48 +05:30
|
|
|
def get_alignment(self):
|
|
|
|
"""
|
|
|
|
Return requested alignment of the paragraph
|
|
|
|
"""
|
|
|
|
return self.style.get_alignment()
|
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
def get_width(self):
|
|
|
|
"""
|
|
|
|
Determine the width of the paragraph if not formatted.
|
|
|
|
"""
|
|
|
|
width = 0
|
|
|
|
|
|
|
|
for (directive,text) in self.piece_list:
|
|
|
|
fontstyle = BaseDoc.FontStyle(self.fontstyle)
|
2004-03-04 02:20:06 +05:30
|
|
|
if directive == _BOLD:
|
2004-03-03 11:24:26 +05:30
|
|
|
fontstyle.set_bold(1)
|
2004-03-04 02:20:06 +05:30
|
|
|
elif directive == _SUPER:
|
2004-03-03 21:42:26 +05:30
|
|
|
size = fontstyle.get_size()
|
|
|
|
fontstyle.set_size(size-2)
|
2004-03-03 11:24:26 +05:30
|
|
|
|
2004-03-04 02:20:06 +05:30
|
|
|
font = find_font_from_fontstyle(fontstyle)
|
2004-03-03 11:24:26 +05:30
|
|
|
width += font.get_width_utf8(text)
|
|
|
|
|
|
|
|
return width
|
|
|
|
|
|
|
|
def get_min_width(self):
|
|
|
|
"""
|
|
|
|
Determine the minimal width of the paragraph (longest word)
|
|
|
|
"""
|
|
|
|
max_word_size = 0
|
|
|
|
|
|
|
|
for (directive,text) in self.piece_list:
|
|
|
|
fontstyle = BaseDoc.FontStyle(self.fontstyle)
|
2004-03-04 02:20:06 +05:30
|
|
|
if directive == _BOLD:
|
2004-03-03 11:24:26 +05:30
|
|
|
fontstyle.set_bold(1)
|
2004-03-04 02:20:06 +05:30
|
|
|
elif directive == _SUPER:
|
2004-03-03 21:42:26 +05:30
|
|
|
size = fontstyle.get_size()
|
|
|
|
fontstyle.set_size(size-2)
|
2004-03-03 11:24:26 +05:30
|
|
|
|
|
|
|
for word in text.split():
|
|
|
|
length = get_text_width(word,fontstyle)
|
|
|
|
if length > max_word_size:
|
|
|
|
max_word_size = length
|
|
|
|
|
|
|
|
return max_word_size
|
|
|
|
|
|
|
|
def get_height(self,width):
|
|
|
|
"""
|
|
|
|
Determine the height the paragraph would have
|
|
|
|
if formatted for a given width.
|
|
|
|
|
|
|
|
width - required formatting width
|
|
|
|
"""
|
|
|
|
nlines = 0
|
|
|
|
avail_width = width
|
|
|
|
|
|
|
|
for (directive,text) in self.piece_list:
|
|
|
|
fontstyle = BaseDoc.FontStyle(self.fontstyle)
|
2004-03-04 02:20:06 +05:30
|
|
|
if directive == _BOLD:
|
2004-03-03 11:24:26 +05:30
|
|
|
fontstyle.set_bold(1)
|
2004-03-04 02:20:06 +05:30
|
|
|
elif directive == _SUPER:
|
2004-03-03 21:42:26 +05:30
|
|
|
size = fontstyle.get_size()
|
|
|
|
fontstyle.set_size(size-2)
|
2004-03-03 11:24:26 +05:30
|
|
|
|
|
|
|
if text and avail_width > get_text_width(text,fontstyle):
|
|
|
|
avail_width -= get_text_width(text,fontstyle)
|
|
|
|
elif directive == _LINE_BREAK:
|
|
|
|
nlines += 1
|
|
|
|
avail_width = width
|
|
|
|
elif text and avail_width <= get_text_width(text,fontstyle):
|
|
|
|
#divide up text and print
|
|
|
|
textlist = text.split()
|
|
|
|
the_text = ""
|
|
|
|
for element in textlist:
|
|
|
|
if get_text_width(the_text + element + " ",fontstyle) < avail_width:
|
|
|
|
the_text = the_text + element + " "
|
|
|
|
else:
|
|
|
|
#__text contains as many words as this __width allows
|
|
|
|
nlines += 1
|
|
|
|
the_text = element + " "
|
|
|
|
avail_width = width
|
|
|
|
|
|
|
|
#if __text still contains data, we will want to print it out
|
|
|
|
if the_text:
|
|
|
|
avail_width = width - get_text_width(the_text,fontstyle)
|
|
|
|
|
|
|
|
return nlines * _LINE_SPACING
|
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
2004-03-01 22:20:23 +05:30
|
|
|
# LPRDoc class
|
2004-02-29 21:05:44 +05:30
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
class LPRDoc(BaseDoc.BaseDoc):
|
|
|
|
"""Gnome-print document interface class. Derived from BaseDoc"""
|
|
|
|
|
|
|
|
def open(self,filename):
|
|
|
|
"""Sets up initialization"""
|
|
|
|
#set up variables needed to keep track of which state we are in
|
2004-03-02 06:06:53 +05:30
|
|
|
self.__in_table = 0
|
|
|
|
self.__in_cell = 0
|
|
|
|
self.__page_count = 0
|
|
|
|
self.__page_open = 0
|
2004-02-29 21:05:44 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
self.paragraph = None
|
|
|
|
self.__cell_data = []
|
2004-03-02 06:06:53 +05:30
|
|
|
self.__table_data = []
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
#create main variables for this print job
|
|
|
|
self.__job = gnomeprint.Job(gnomeprint.config_default())
|
|
|
|
self.__pc = self.__job.get_context()
|
|
|
|
|
|
|
|
#find out what the width and height of the page is
|
2004-03-03 11:24:26 +05:30
|
|
|
width, height = gnomeprint.job_get_page_size_from_config(self.__job.get_config())
|
2004-03-02 06:06:53 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
self.left_margin = cm2u(self.get_left_margin())
|
|
|
|
self.right_margin = width - cm2u(self.get_right_margin())
|
|
|
|
self.top_margin = height - cm2u(self.get_top_margin())
|
|
|
|
self.bottom_margin = cm2u(self.get_bottom_margin())
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
self.start_page(self)
|
|
|
|
|
2004-03-02 07:05:53 +05:30
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
def close(self):
|
|
|
|
"""Clean up and close the document"""
|
|
|
|
#gracefully end page before we close the doc if a page is open
|
|
|
|
if self.__page_open:
|
|
|
|
self.end_page()
|
|
|
|
|
|
|
|
self.__job.close()
|
|
|
|
self.__show_print_dialog()
|
|
|
|
|
|
|
|
def line_break(self):
|
|
|
|
"Forces a line break within a paragraph"
|
2004-03-04 02:20:06 +05:30
|
|
|
# Add previously held text to the paragraph,
|
|
|
|
# then add line break directive,
|
|
|
|
# then start accumulating further text
|
|
|
|
append_to_paragraph(self.paragraph,self.__paragraph_directive,self.__paragraph_text)
|
|
|
|
self.paragraph.add_piece(_LINE_BREAK,"")
|
|
|
|
self.__paragraph_text = ""
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def page_break(self):
|
|
|
|
"Forces a page break, creating a new page"
|
2004-03-04 02:20:06 +05:30
|
|
|
# If we're already at the very top, relax and do nothing
|
|
|
|
if self.__y != self.top_margin:
|
|
|
|
self.end_page()
|
|
|
|
self.start_page()
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def start_page(self,orientation=None):
|
|
|
|
"""Create a new page"""
|
|
|
|
#reset variables dealing with opening a page
|
|
|
|
if (self.__page_open):
|
2004-03-04 02:20:06 +05:30
|
|
|
self.end_page()
|
2004-02-29 21:05:44 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__page_open = 1
|
|
|
|
self.__page_count += 1
|
|
|
|
self.__x = self.left_margin
|
|
|
|
self.__y = self.top_margin
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
self.__pc.beginpage(str(self.__page_count))
|
|
|
|
self.__pc.moveto(self.__x, self.__y)
|
|
|
|
|
|
|
|
def end_page(self):
|
|
|
|
"""Close the current page"""
|
|
|
|
if (self.__page_open):
|
2004-03-04 02:20:06 +05:30
|
|
|
self.__page_open = 0
|
|
|
|
self.__pc.showpage()
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def start_paragraph(self,style_name,leader=None):
|
|
|
|
"""Paragraphs handling - A Gramps paragraph is any
|
|
|
|
single body of text, from a single word, to several sentences.
|
|
|
|
We assume a linebreak at the end of each paragraph."""
|
2004-03-04 02:20:06 +05:30
|
|
|
# Instantiate paragraph object and initialize buffers
|
2004-03-03 11:24:26 +05:30
|
|
|
self.paragraph = GnomePrintParagraph(self.style_list[style_name])
|
2004-03-04 02:20:06 +05:30
|
|
|
self.__paragraph_directive = ""
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__paragraph_text = ""
|
2004-03-03 22:29:47 +05:30
|
|
|
if leader:
|
|
|
|
self.__paragraph_text += leader + " "
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def end_paragraph(self):
|
|
|
|
"""End the current paragraph"""
|
2004-03-04 02:20:06 +05:30
|
|
|
# Add current text/directive to paragraoh,
|
|
|
|
# then either add paragrah to the list of cell's paragraphs
|
|
|
|
# or print it right away if not in cell
|
|
|
|
append_to_paragraph(self.paragraph,self.__paragraph_directive,self.__paragraph_text)
|
2004-03-03 11:24:26 +05:30
|
|
|
if self.__in_cell:
|
|
|
|
# We're inside cell. Add paragrah to celldata
|
|
|
|
self.__cell_data.append(self.paragraph)
|
|
|
|
else:
|
|
|
|
# paragraph not in table: write it right away
|
|
|
|
self.__x, self.__y = self.write_paragraph(self.paragraph,
|
|
|
|
self.__x, self.__y,
|
|
|
|
self.left_margin, self.right_margin)
|
|
|
|
self.__y = self.__advance_line(self.__y)
|
|
|
|
self.paragraph = None
|
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
def start_bold(self):
|
|
|
|
"""Bold face"""
|
2004-03-04 02:20:06 +05:30
|
|
|
append_to_paragraph(self.paragraph,self.__paragraph_directive,self.__paragraph_text)
|
|
|
|
self.__paragraph_directive = _BOLD
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__paragraph_text = ""
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def end_bold(self):
|
|
|
|
"""End bold face"""
|
2004-03-04 02:20:06 +05:30
|
|
|
append_to_paragraph(self.paragraph,self.__paragraph_directive,self.__paragraph_text)
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__paragraph_directive = ""
|
|
|
|
self.__paragraph_text = ""
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def start_superscript(self):
|
2004-03-04 02:20:06 +05:30
|
|
|
append_to_paragraph(self.paragraph,self.__paragraph_directive,self.__paragraph_text)
|
|
|
|
self.__paragraph_directive = _SUPER
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__paragraph_text = ""
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def end_superscript(self):
|
2004-03-04 02:20:06 +05:30
|
|
|
append_to_paragraph(self.paragraph,self.__paragraph_directive,self.__paragraph_text)
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__paragraph_directive = ""
|
|
|
|
self.__paragraph_text = ""
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def start_listing(self,style_name):
|
|
|
|
"""
|
|
|
|
Starts a new listing block, using the specified style name.
|
|
|
|
|
|
|
|
style_name - name of the ParagraphStyle to use for the block.
|
|
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def end_listing(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def start_table(self,name,style_name):
|
|
|
|
"""Begin new table"""
|
2004-03-04 02:20:06 +05:30
|
|
|
# initialize table, compute its width, find number of columns
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__table_data = []
|
|
|
|
self.__in_table = 1
|
2004-02-29 23:12:38 +05:30
|
|
|
self.__tbl_style = self.table_styles[style_name]
|
|
|
|
self.__ncols = self.__tbl_style.get_columns()
|
2004-03-02 06:06:53 +05:30
|
|
|
self.rownum = -1
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__table_width = (self.right_margin - self.left_margin) * \
|
2004-03-01 22:20:23 +05:30
|
|
|
self.__tbl_style.get_width() / 100.0
|
2004-03-02 10:27:00 +05:30
|
|
|
self.__cell_widths = []
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def end_table(self):
|
|
|
|
"""Close the table environment"""
|
2004-03-04 02:20:06 +05:30
|
|
|
# output table contents
|
2004-02-29 21:05:44 +05:30
|
|
|
self.__output_table()
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__in_table = 0
|
|
|
|
self.__y = self.__advance_line(self.__y)
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def start_row(self):
|
|
|
|
"""Begin a new row"""
|
2004-03-04 02:20:06 +05:30
|
|
|
# Initialize row, compute cell widths
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__row_data = []
|
2004-03-02 06:06:53 +05:30
|
|
|
self.rownum = self.rownum + 1
|
|
|
|
self.cellnum = -1
|
2004-03-02 10:27:00 +05:30
|
|
|
self.__span = 1
|
|
|
|
self.__cell_widths.append([0] * self.__ncols)
|
|
|
|
for cell in range(self.__ncols):
|
|
|
|
self.__cell_widths[self.rownum][cell] = self.__table_width * \
|
|
|
|
self.__tbl_style.get_column_width(cell) / 100.0
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def end_row(self):
|
|
|
|
"""End the row (new line)"""
|
2004-03-04 02:20:06 +05:30
|
|
|
# add row data to the data we have for the current table
|
2004-02-29 21:05:44 +05:30
|
|
|
self.__table_data.append(self.__row_data)
|
|
|
|
|
|
|
|
def start_cell(self,style_name,span=1):
|
2004-03-04 02:20:06 +05:30
|
|
|
"""Add an entry to the table."""
|
|
|
|
# Initialize a cell, take care of span>1 cases
|
2004-03-02 10:27:00 +05:30
|
|
|
self.__in_cell = 1
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__cell_data = []
|
2004-03-02 10:27:00 +05:30
|
|
|
self.cellnum = self.cellnum + self.__span
|
|
|
|
self.__span = span
|
|
|
|
for __extra_cell in range(1,span):
|
|
|
|
self.__cell_widths[self.rownum][self.cellnum] += \
|
|
|
|
self.__cell_widths[self.rownum][self.cellnum + __extra_cell]
|
|
|
|
self.__cell_widths[self.rownum][self.cellnum + __extra_cell] = 0
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def end_cell(self):
|
|
|
|
"""Prepares for next cell"""
|
2004-03-04 02:20:06 +05:30
|
|
|
# append the cell text to the row data
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__in_cell = 0
|
2004-02-29 21:05:44 +05:30
|
|
|
self.__row_data.append(self.__cell_data)
|
|
|
|
|
|
|
|
def add_photo(self,name,pos,x,y):
|
|
|
|
"""Add photo to report"""
|
2004-03-03 11:24:26 +05:30
|
|
|
pass
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def horizontal_line(self):
|
|
|
|
self.__pc.moveto(self.__x, self.__y)
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__pc.lineto(self.right_margin, self.__y)
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def write_cmdstr(self,text):
|
|
|
|
"""
|
|
|
|
Writes the text in the current paragraph. Should only be used after a
|
|
|
|
start_paragraph and before an end_paragraph.
|
|
|
|
|
|
|
|
text - text to write.
|
|
|
|
"""
|
2004-03-03 11:24:26 +05:30
|
|
|
pass
|
|
|
|
# if not self.paragraph:
|
|
|
|
# self.start_paragraph()
|
|
|
|
#
|
|
|
|
# self.write(text)
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
def draw_arc(self,style,x1,y1,x2,y2,angle,extent):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def draw_path(self,style,path):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def draw_box(self,style,text,x,y):
|
2004-03-02 06:06:53 +05:30
|
|
|
box_style = self.draw_styles[style]
|
|
|
|
para_style = box_style.get_paragraph_style()
|
|
|
|
fontstyle = para_style.get_font()
|
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
#assuming that we start drawing box from current position
|
|
|
|
__width=x-self.__x
|
|
|
|
__height=y-self.__y
|
|
|
|
self.__pc.rect_stroked(self.__x, self.__y)
|
|
|
|
|
|
|
|
if text != None:
|
2004-03-02 06:06:53 +05:30
|
|
|
__text_width=self.__get_text_width(text,fontstyle)
|
2004-02-29 21:05:44 +05:30
|
|
|
#try to center text in box
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__pc.setfont(find_font_from_fontstyle(fontstyle))
|
2004-02-29 21:05:44 +05:30
|
|
|
self.__pc.moveto(self.__x+(__width/2)-(__text_width/2),
|
|
|
|
self.__y+(__height/2))
|
|
|
|
self.__pc.show(text)
|
|
|
|
|
|
|
|
def write_at (self, style, text, x, y):
|
2004-03-02 06:06:53 +05:30
|
|
|
box_style = self.draw_styles[style]
|
|
|
|
para_style = box_style.get_paragraph_style()
|
|
|
|
fontstyle = para_style.get_font()
|
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__pc.setfont(find_font_from_fontstyle(fontstyle))
|
2004-02-29 21:05:44 +05:30
|
|
|
self.__pc.moveto(x, y)
|
|
|
|
self.__pc.show(text)
|
|
|
|
|
|
|
|
def draw_bar(self, style, x1, y1, x2, y2):
|
|
|
|
self.__pc.moveto(x1, y1)
|
|
|
|
self.__pc.lineto(x2, y2)
|
|
|
|
|
|
|
|
def draw_text(self,style,text,x1,y1):
|
2004-03-02 06:06:53 +05:30
|
|
|
box_style = self.draw_styles[style]
|
|
|
|
para_style = box_style.get_paragraph_style()
|
|
|
|
fontstyle = para_style.get_font()
|
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__pc.setfont(find_font_from_fontstyle(fontstyle))
|
2004-02-29 21:05:44 +05:30
|
|
|
self.__pc.moveto(x1,y1)
|
|
|
|
self.__pc.show(text)
|
|
|
|
|
|
|
|
def center_text(self,style,text,x1,y1):
|
2004-03-02 06:06:53 +05:30
|
|
|
box_style = self.draw_styles[style]
|
|
|
|
para_style = box_style.get_paragraph_style()
|
|
|
|
fontstyle = para_style.get_font()
|
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
#not sure how x1, y1 fit into this
|
|
|
|
#should we assume x1 y1 is the starting location
|
|
|
|
#and that the right margin is the right edge?
|
|
|
|
__width=self.get_text_width(text)
|
2004-03-03 11:24:26 +05:30
|
|
|
__center=self.right_margin-self.left_margin
|
2004-02-29 21:05:44 +05:30
|
|
|
__center-=__width/2
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__pc.setfont(find_font_from_fontstyle(fontstyle))
|
2004-02-29 21:05:44 +05:30
|
|
|
self.__pc.moveto(__center, self.__y)
|
|
|
|
self.__pc.show(text)
|
|
|
|
|
|
|
|
def rotate_text(self,style,text,x,y,angle):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def draw_line(self,style,x1,y1,x2,y2):
|
|
|
|
self.__pc.line_stroked(x1,y1,x2,y2)
|
|
|
|
|
|
|
|
def write_text(self,text):
|
2004-03-03 11:24:26 +05:30
|
|
|
"""Add the text to the paragraph"""
|
2004-03-04 02:20:06 +05:30
|
|
|
# Take care of superscript tags
|
2004-03-03 21:42:26 +05:30
|
|
|
super_count = text.count('<super>')
|
|
|
|
for num in range(super_count):
|
|
|
|
start = text.find('<super>')
|
|
|
|
self.__paragraph_text = self.__paragraph_text + text[:start]
|
2004-03-04 02:20:06 +05:30
|
|
|
append_to_paragraph(self.paragraph,self.__paragraph_directive,self.__paragraph_text)
|
2004-03-03 21:42:26 +05:30
|
|
|
self.__paragraph_text = ""
|
|
|
|
text = text[start+7:]
|
|
|
|
|
|
|
|
start = text.find('</super>')
|
|
|
|
self.__paragraph_text = self.__paragraph_text + text[:start]
|
2004-03-04 02:20:06 +05:30
|
|
|
append_to_paragraph(self.paragraph,_SUPER,self.__paragraph_text)
|
2004-03-03 21:42:26 +05:30
|
|
|
self.__paragraph_text = ""
|
|
|
|
text = text[start+8:]
|
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__paragraph_text = self.__paragraph_text + text
|
2004-02-29 21:05:44 +05:30
|
|
|
|
2004-03-02 10:27:00 +05:30
|
|
|
def write_note(self,text,format,style_name):
|
|
|
|
if format == 1:
|
|
|
|
for line in text.split('\n'):
|
|
|
|
self.start_paragraph(style_name)
|
|
|
|
self.write_text(line)
|
|
|
|
self.end_paragraph()
|
|
|
|
elif format == 0:
|
|
|
|
for line in text.split('\n\n'):
|
|
|
|
self.start_paragraph(style_name)
|
|
|
|
line = line.replace('\n',' ')
|
|
|
|
line = string.join(string.split(line))
|
|
|
|
self.write_text(line)
|
|
|
|
self.end_paragraph()
|
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
#function to help us advance a line
|
|
|
|
def __advance_line(self, y):
|
2004-03-03 11:24:26 +05:30
|
|
|
new_y = y - _LINE_SPACING
|
|
|
|
if y < self.bottom_margin:
|
2004-03-03 22:29:47 +05:30
|
|
|
x = self.__x
|
2004-03-03 11:24:26 +05:30
|
|
|
self.end_page()
|
|
|
|
self.start_page()
|
|
|
|
new_y = self.__y
|
2004-03-03 22:29:47 +05:30
|
|
|
self.__x = x
|
2004-03-03 11:24:26 +05:30
|
|
|
return new_y
|
2004-03-01 22:20:23 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
def write_paragraph(self,paragraph,x,y,left_margin,right_margin):
|
|
|
|
"""
|
|
|
|
Write the contents of the paragraph, observing per-piece info.
|
|
|
|
|
|
|
|
paragraph - GnomePrintParagraph instance
|
|
|
|
x,y - coordinates to start at
|
|
|
|
left_margin,right_margin - boundaries to obey
|
|
|
|
"""
|
|
|
|
width = right_margin - left_margin
|
|
|
|
avail_width = width
|
2004-03-02 07:05:53 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
if y - _LINE_SPACING < self.bottom_margin:
|
2004-03-02 07:05:53 +05:30
|
|
|
self.end_page()
|
|
|
|
self.start_page()
|
2004-03-03 11:24:26 +05:30
|
|
|
x = self.__x
|
|
|
|
y = self.__y
|
|
|
|
|
|
|
|
x = left_margin
|
|
|
|
|
|
|
|
for (directive,text) in paragraph.get_piece_list():
|
|
|
|
fontstyle = BaseDoc.FontStyle(paragraph.get_fontstyle())
|
2004-03-04 02:20:06 +05:30
|
|
|
if directive == _BOLD:
|
2004-03-03 11:24:26 +05:30
|
|
|
fontstyle.set_bold(1)
|
2004-03-04 02:20:06 +05:30
|
|
|
elif directive == _SUPER:
|
2004-03-03 21:42:26 +05:30
|
|
|
size = fontstyle.get_size()
|
|
|
|
fontstyle.set_size(size-2)
|
|
|
|
y = y + 0.25 * _LINE_SPACING
|
2004-03-03 11:24:26 +05:30
|
|
|
elif directive == _LINE_BREAK:
|
2004-03-04 02:20:06 +05:30
|
|
|
y = self.__advance_line(y)
|
|
|
|
x = left_margin
|
|
|
|
avail_width = width
|
|
|
|
continue
|
2004-03-03 11:24:26 +05:30
|
|
|
|
|
|
|
#all text will fit within the width provided
|
|
|
|
if not text:
|
2004-03-04 02:20:06 +05:30
|
|
|
if directive == _SUPER:
|
2004-03-03 21:42:26 +05:30
|
|
|
y = y - 0.25 * _LINE_SPACING
|
2004-03-03 11:24:26 +05:30
|
|
|
continue
|
|
|
|
if avail_width >= get_text_width(text,fontstyle):
|
|
|
|
avail_width -= get_text_width(text,fontstyle)
|
2004-03-04 05:08:48 +05:30
|
|
|
if paragraph.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
|
|
|
|
x = x + 0.5 * avail_width
|
|
|
|
elif paragraph.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
|
|
|
|
x = x + avail_width
|
|
|
|
elif paragraph.get_alignment() == BaseDoc.PARA_ALIGN_LEFT:
|
|
|
|
pass
|
|
|
|
elif paragraph.get_alignment() == BaseDoc.PARA_ALIGN_JUSTIFY:
|
|
|
|
pass
|
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__pc.setfont(find_font_from_fontstyle(fontstyle))
|
|
|
|
self.__pc.moveto(x, y)
|
|
|
|
self.__pc.show(text)
|
2004-03-04 05:08:48 +05:30
|
|
|
x = x + get_text_width(text,fontstyle)
|
2004-03-03 11:24:26 +05:30
|
|
|
else:
|
|
|
|
#divide up text and print
|
2004-03-04 02:20:06 +05:30
|
|
|
if x == left_margin or directive == _SUPER \
|
2004-03-03 21:42:26 +05:30
|
|
|
or text[0] == '.':
|
2004-03-03 11:24:26 +05:30
|
|
|
the_text = ""
|
2004-03-01 22:20:23 +05:30
|
|
|
else:
|
2004-03-03 11:24:26 +05:30
|
|
|
the_text = " "
|
|
|
|
for element in text.split():
|
|
|
|
if get_text_width(the_text + element + " ",fontstyle) < avail_width:
|
|
|
|
the_text = the_text + element + " "
|
|
|
|
else:
|
2004-03-04 05:08:48 +05:30
|
|
|
# the_text contains as much as avail_width allows
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__pc.setfont(find_font_from_fontstyle(fontstyle))
|
|
|
|
self.__pc.moveto(x, y)
|
|
|
|
self.__pc.show(the_text)
|
|
|
|
the_text = element + " "
|
|
|
|
y = self.__advance_line(y)
|
|
|
|
x = left_margin
|
|
|
|
avail_width = width
|
|
|
|
|
|
|
|
#if not in table and cursor is below bottom margin
|
|
|
|
if (not self.__in_table) and (y < self.bottom_margin):
|
|
|
|
self.end_page()
|
|
|
|
self.start_page()
|
|
|
|
x = self.__x
|
|
|
|
y = self.__y
|
|
|
|
|
|
|
|
#if __text still contains data, we will want to print it out
|
|
|
|
if the_text:
|
|
|
|
self.__pc.setfont(find_font_from_fontstyle(fontstyle))
|
2004-03-01 22:20:23 +05:30
|
|
|
self.__pc.moveto(left_margin, y)
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__pc.show(the_text)
|
2004-03-03 21:42:26 +05:30
|
|
|
x = x + get_text_width(the_text,fontstyle)
|
2004-03-03 11:24:26 +05:30
|
|
|
avail_width = width - get_text_width(the_text,fontstyle)
|
2004-03-04 02:20:06 +05:30
|
|
|
if directive == _SUPER:
|
2004-03-03 21:42:26 +05:30
|
|
|
y = y - 0.25 * _LINE_SPACING
|
2004-03-03 11:24:26 +05:30
|
|
|
y = self.__advance_line(y)
|
2004-02-29 21:05:44 +05:30
|
|
|
return (x,y)
|
|
|
|
|
|
|
|
def __output_table(self):
|
|
|
|
"""do calcs on data in table and output data in a formatted way"""
|
2004-03-04 05:08:48 +05:30
|
|
|
__min_col_size = [0] * self.__ncols
|
2004-03-01 22:20:23 +05:30
|
|
|
__max_vspace = [0] * len(self.__table_data)
|
2004-02-29 21:05:44 +05:30
|
|
|
|
2004-03-01 22:20:23 +05:30
|
|
|
for __row_num in range(len(self.__table_data)):
|
|
|
|
__row = self.__table_data[__row_num][:]
|
|
|
|
#do calcs on each __row and keep track on max length of each column
|
|
|
|
for __col in range(self.__ncols):
|
2004-03-02 10:27:00 +05:30
|
|
|
if not self.__cell_widths[__row_num][__col]:
|
|
|
|
continue
|
2004-03-03 11:24:26 +05:30
|
|
|
|
|
|
|
for paragraph in __row[__col]:
|
|
|
|
__min = paragraph.get_min_width()
|
2004-03-04 05:08:48 +05:30
|
|
|
if __min > __min_col_size[__col]:
|
2004-03-03 11:24:26 +05:30
|
|
|
__min_col_size[__col] = __min
|
|
|
|
|
|
|
|
__max = paragraph.get_height(
|
|
|
|
self.__cell_widths[__row_num][__col])
|
|
|
|
if __max > __max_vspace[__row_num]:
|
|
|
|
__max_vspace[__row_num] = __max
|
2004-02-29 21:05:44 +05:30
|
|
|
|
2004-03-04 05:08:48 +05:30
|
|
|
#is table width larger than the width of the paper?
|
2004-03-02 08:39:49 +05:30
|
|
|
__min_table_width = 0
|
|
|
|
for __size in __min_col_size:
|
|
|
|
__min_table_width = __min_table_width + __size
|
2004-02-29 21:05:44 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
if __min_table_width > (self.right_margin - self.left_margin):
|
2004-03-01 22:20:23 +05:30
|
|
|
print "Table does not fit onto the page.\n"
|
2004-03-03 22:29:47 +05:30
|
|
|
|
2004-02-29 21:05:44 +05:30
|
|
|
#for now we will assume left justification of tables
|
|
|
|
#output data in table
|
2004-03-01 22:20:23 +05:30
|
|
|
for __row_num in range(len(self.__table_data)):
|
|
|
|
__row = self.__table_data[__row_num]
|
2004-03-03 11:24:26 +05:30
|
|
|
__x = self.left_margin #reset so that x is at margin
|
2004-03-01 22:20:23 +05:30
|
|
|
# If this row puts us below the bottom, start new page here
|
2004-03-03 11:24:26 +05:30
|
|
|
if self.__y - __max_vspace[__row_num] < self.bottom_margin:
|
|
|
|
self.end_page()
|
|
|
|
self.start_page()
|
2004-03-01 22:20:23 +05:30
|
|
|
|
2004-03-03 22:29:47 +05:30
|
|
|
col_y = self.__y # all columns start at the same height
|
2004-02-29 23:12:38 +05:30
|
|
|
for __col in range(self.__ncols):
|
2004-03-02 10:27:00 +05:30
|
|
|
if not self.__cell_widths[__row_num][__col]:
|
|
|
|
continue
|
2004-03-03 22:29:47 +05:30
|
|
|
self.__y = col_y
|
2004-03-03 11:24:26 +05:30
|
|
|
for paragraph in __row[__col]:
|
2004-03-03 22:29:47 +05:30
|
|
|
__nothing, self.__y = self.write_paragraph(paragraph,
|
2004-03-03 11:24:26 +05:30
|
|
|
self.__x, self.__y, __x,
|
|
|
|
__x + self.__cell_widths[__row_num][__col])
|
2004-02-29 21:05:44 +05:30
|
|
|
|
2004-03-03 11:24:26 +05:30
|
|
|
__x = __x + self.__cell_widths[__row_num][__col] # set up margin for this row
|
2004-02-29 21:05:44 +05:30
|
|
|
|
|
|
|
#function to print text to a printer
|
|
|
|
def __do_print(self,dialog, job):
|
|
|
|
__pc = gnomeprint.Context(dialog.get_config())
|
|
|
|
job.render(__pc)
|
|
|
|
__pc.close()
|
|
|
|
|
|
|
|
#I believe this is a print preview
|
|
|
|
def __show_preview(self, dialog):
|
|
|
|
__w = gnomeprint.ui.JobPreview(self.__job, _("Print Preview"))
|
|
|
|
__w.set_property('allow-grow', 1)
|
|
|
|
__w.set_property('allow-shrink', 1)
|
|
|
|
__w.set_transient_for(dialog)
|
|
|
|
__w.show_all()
|
|
|
|
|
|
|
|
#function used to get users response and do a certain
|
|
|
|
#action depending on that response
|
|
|
|
def __print_dialog_response(self, dialog, resp, job):
|
|
|
|
if resp == gnomeprint.ui.DIALOG_RESPONSE_PREVIEW:
|
|
|
|
self.__show_preview(dialog)
|
|
|
|
elif resp == gnomeprint.ui.DIALOG_RESPONSE_CANCEL:
|
|
|
|
dialog.destroy()
|
|
|
|
elif resp == gnomeprint.ui.DIALOG_RESPONSE_PRINT:
|
|
|
|
self.__do_print(dialog, self.__job)
|
|
|
|
dialog.destroy()
|
|
|
|
|
|
|
|
#function displays a window that allows user to choose
|
|
|
|
#to print, show, etc
|
|
|
|
def __show_print_dialog(self):
|
|
|
|
__dialog = gnomeprint.ui.Dialog(self.__job, _("Print..."), 0)
|
|
|
|
__dialog.connect('response', self.__print_dialog_response, self.__job)
|
|
|
|
__dialog.show()
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Register the document generator with the system
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
Plugins.register_text_doc(
|
|
|
|
name=_("Print..."),
|
|
|
|
classref=LPRDoc,
|
|
|
|
table=1,
|
|
|
|
paper=1,
|
2004-03-02 06:06:53 +05:30
|
|
|
style=1,
|
2004-02-29 21:05:44 +05:30
|
|
|
ext=""
|
|
|
|
)
|