gramps/gramps2/src/DrawDoc.py

200 lines
4.8 KiB
Python
Raw Normal View History

2002-10-20 19:55:16 +05:30
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
#
# 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
#
#------------------------------------------------------------------------
#
# gramps modules
#
#------------------------------------------------------------------------
import TextDoc
2002-10-20 19:55:16 +05:30
2003-02-04 00:54:27 +05:30
SOLID = 0
DASHED = 1
2002-10-20 19:55:16 +05:30
#------------------------------------------------------------------------
#
# GraphicsStyle
#
#------------------------------------------------------------------------
class GraphicsStyle:
def __init__(self,obj=None):
if obj:
self.height = obj.height
self.width = obj.width
self.para_name = obj.para_name
self.shadow = obj.shadow
self.color = obj.color
2003-02-09 05:14:44 +05:30
self.fill_color = obj.fill_color
2003-01-31 09:58:39 +05:30
self.lwidth = obj.lwidth
2003-02-04 00:54:27 +05:30
self.lstyle = obj.lstyle
2002-10-20 19:55:16 +05:30
else:
self.height = 0
self.width = 0
self.para_name = ""
self.shadow = 0
2003-01-31 09:58:39 +05:30
self.lwidth = 0.5
2003-02-09 05:14:44 +05:30
self.color = (0,0,0)
self.fill_color = (255,255,255)
2003-02-04 00:54:27 +05:30
self.lstyle = SOLID
2002-10-20 19:55:16 +05:30
2003-01-31 09:58:39 +05:30
def set_line_width(self,val):
self.lwidth = val
def get_line_width(self):
return self.lwidth
2003-02-04 00:54:27 +05:30
def get_line_style(self):
return self.lstyle
def set_line_style(self,val):
self.lstyle = val
2002-10-20 19:55:16 +05:30
def set_height(self,val):
self.height = val
def set_width(self,val):
self.width = val
def set_paragraph_style(self,val):
self.para_name = val
def set_shadow(self,val):
self.shadow = val
def set_color(self,val):
self.color = val
2003-02-09 05:14:44 +05:30
def set_fill_color(self,val):
self.fill_color = val
2002-10-20 19:55:16 +05:30
def get_height(self):
return self.height
def get_width(self):
return self.width
def get_paragraph_style(self):
return self.para_name
def get_shadow(self):
return self.shadow
def get_color(self):
return self.color
2003-02-09 05:14:44 +05:30
def get_fill_color(self):
return self.fill_color
2002-10-20 19:55:16 +05:30
#------------------------------------------------------------------------
#
# DrawDoc
#
#------------------------------------------------------------------------
class DrawDoc:
def __init__(self,styles,type,orientation=TextDoc.PAPER_PORTRAIT):
2002-10-20 19:55:16 +05:30
self.orientation = orientation
if orientation == TextDoc.PAPER_PORTRAIT:
2002-10-20 19:55:16 +05:30
self.width = type.get_width()
self.height = type.get_height()
else:
self.width = type.get_height()
self.height = type.get_width()
self.tmargin = 2.54
self.bmargin = 2.54
self.lmargin = 2.54
self.rmargin = 2.54
self.style_list = styles.get_styles()
self.draw_styles = {}
self.name = ""
def get_usable_width(self):
return self.width - (self.rmargin + self.lmargin)
def get_usable_height(self):
return self.height - (self.tmargin + self.bmargin)
def get_right_margin(self):
return self.rmargin
def get_left_margin(self):
return self.lmargin
def get_top_margin(self):
return self.tmargin
def get_bottom_margin(self):
return self.bmargin
def creator(self,name):
self.name = name
def add_draw_style(self,name,style):
self.draw_styles[name] = GraphicsStyle(style)
def open(self,filename):
pass
def close(self):
pass
def start_page(self,orientation=None):
pass
def end_page(self):
pass
def draw_arc(self,style,x1,y1,x2,y2,angle,extent):
pass
2003-02-04 00:54:27 +05:30
def draw_path(self,style,path):
pass
2002-10-20 19:55:16 +05:30
def draw_box(self,style,text,x,y):
pass
def write_at(self,style,text,x,y):
pass
2003-01-31 09:58:39 +05:30
def draw_bar(self,style,x1,y1,x2,y2):
pass
def draw_text(self,style,text,x1,y1):
pass
2002-10-20 19:55:16 +05:30
def draw_line(self,style,x1,y1,x2,y2):
pass
def draw_wedge(self, style, centerx, centery, radius, start_angle, end_angle):
pass
def start_path(self,style,x,y):
pass
def line_to(self,x,y):
pass
def arc_to(self,x,y,angle,extent):
pass
def end_path(self):
pass