Fixed spouse selection when family changes
svn: r1643
This commit is contained in:
parent
21cabaac33
commit
5d2f999431
@ -260,9 +260,7 @@ class AddSpouse:
|
||||
# 100 years from spouse deathdate
|
||||
if abs(pdday.getYear() - dday.getYear()) > 100:
|
||||
continue
|
||||
|
||||
self.slist.add([data[0],data[1],data[3],data[5],data[6]],key,person==key)
|
||||
|
||||
self.slist.connect_model()
|
||||
|
||||
def on_show_toggled(self,obj):
|
||||
|
@ -76,7 +76,11 @@ class AddressEditor:
|
||||
self.addr = addr
|
||||
|
||||
name = parent.person.getPrimaryName().getName()
|
||||
text = _("Address Editor for %s") % name
|
||||
print "'%s'" % name
|
||||
if name == ", ":
|
||||
text = _("Address Editor")
|
||||
else:
|
||||
text = _("Address Editor for %s") % name
|
||||
|
||||
title_label = self.top.get_widget("title")
|
||||
|
||||
|
@ -88,7 +88,10 @@ class AttributeEditor:
|
||||
self.top.get_widget('edit_src'),
|
||||
self.top.get_widget('del_src'))
|
||||
|
||||
title = _("Attribute Editor for %s") % title
|
||||
if title == ", ":
|
||||
title = _("Attribute Editor")
|
||||
else:
|
||||
title = _("Attribute Editor for %s") % title
|
||||
l = self.top.get_widget("title")
|
||||
Utils.set_titles(self.window,l,title,_('Attribute Editor'))
|
||||
|
||||
|
@ -182,6 +182,9 @@ class DrawDoc:
|
||||
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
|
||||
|
||||
|
@ -83,8 +83,12 @@ class EventEditor:
|
||||
self.window = self.top.get_widget("event_edit")
|
||||
title_label = self.top.get_widget('title')
|
||||
|
||||
Utils.set_titles(self.window,title_label,
|
||||
_('Event Editor for %s') % name,
|
||||
if name == ", ":
|
||||
etitle = _('Event Editor')
|
||||
else:
|
||||
etitle = _('Event Editor for %s') % name
|
||||
|
||||
Utils.set_titles(self.window,title_label, etitle,
|
||||
_('Event Editor'))
|
||||
|
||||
self.name_field = self.top.get_widget("eventName")
|
||||
|
@ -266,7 +266,7 @@ class FamilyView:
|
||||
def spouse_swap(self,obj):
|
||||
if self.selected_spouse:
|
||||
self.parent.active_person = self.selected_spouse
|
||||
self.load_family()
|
||||
self.load_family(self.family)
|
||||
|
||||
def ap_parents_clicked(self,obj):
|
||||
self.change_families(self.person)
|
||||
@ -331,9 +331,14 @@ class FamilyView:
|
||||
self.child_model.clear()
|
||||
self.sp_parents_model.clear()
|
||||
splist = self.person.getFamilyList()
|
||||
f = None
|
||||
first_family = None
|
||||
first_spouse = None
|
||||
|
||||
if len(splist) > 1:
|
||||
self.spouse_selection.set_mode(gtk.SELECTION_SINGLE)
|
||||
else:
|
||||
self.spouse_selection.set_mode(gtk.SELECTION_NONE)
|
||||
|
||||
flist = {}
|
||||
|
||||
for f in splist:
|
||||
if not f:
|
||||
continue
|
||||
@ -343,18 +348,7 @@ class FamilyView:
|
||||
sp = f.getFather()
|
||||
|
||||
iter = self.spouse_model.append()
|
||||
if f == family:
|
||||
first_spouse = sp
|
||||
first_family = f
|
||||
elif first_spouse == None:
|
||||
first_spouse = sp
|
||||
first_family = f
|
||||
|
||||
if len(splist) > 1:
|
||||
self.spouse_selection.set_mode(gtk.SELECTION_SINGLE)
|
||||
self.spouse_selection.select_path(0)
|
||||
else:
|
||||
self.spouse_selection.set_mode(gtk.SELECTION_NONE)
|
||||
flist[f.getId()] = iter
|
||||
|
||||
if sp:
|
||||
if f.getMarriage():
|
||||
@ -367,11 +361,19 @@ class FamilyView:
|
||||
else:
|
||||
self.spouse_model.set(iter,0,"unknown\n")
|
||||
|
||||
if first_family:
|
||||
self.display_marriage(first_family)
|
||||
if family in splist:
|
||||
self.display_marriage(family)
|
||||
iter = flist[family.getId()]
|
||||
self.spouse_selection.select_iter(iter)
|
||||
elif len(flist) > 0:
|
||||
f = splist[0]
|
||||
iter = flist[f.getId()]
|
||||
self.spouse_selection.select_iter(iter)
|
||||
self.display_marriage(f)
|
||||
else:
|
||||
self.display_marriage(None)
|
||||
|
||||
self.update_list(self.ap_parents_model,self.ap_parents,self.person)
|
||||
self.family = first_family
|
||||
|
||||
def update_list(self,model,tree,person):
|
||||
model.clear()
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2003 Donald N. Allingham
|
||||
# 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
|
||||
@ -34,10 +34,8 @@ class ListModel:
|
||||
|
||||
self.tree.set_rules_hint(gtk.TRUE)
|
||||
self.model = None
|
||||
self.new_model()
|
||||
self.selection = self.tree.get_selection()
|
||||
self.selection.set_mode(mode)
|
||||
self.mode = mode
|
||||
self.new_model()
|
||||
self.data_index = l
|
||||
self.count = 0
|
||||
self.cid = None
|
||||
@ -84,9 +82,14 @@ class ListModel:
|
||||
self.cid = self.model.get_sort_column_id()
|
||||
self.count = 0
|
||||
self.model = gtk.ListStore(*self.mylist)
|
||||
self.selection = self.tree.get_selection()
|
||||
self.selection.set_mode(self.mode)
|
||||
self.sel_iter = None
|
||||
|
||||
def connect_model(self):
|
||||
self.tree.set_model(self.model)
|
||||
if self.sel_iter:
|
||||
self.selection.select_iter(self.sel_iter)
|
||||
if self.cid:
|
||||
self.model.set_sort_column_id(self.cid[0],self.cid[1])
|
||||
self.sort()
|
||||
@ -165,18 +168,6 @@ class ListModel:
|
||||
def get_object(self,iter):
|
||||
return self.model.get_value(iter,self.data_index)
|
||||
|
||||
def add(self,data,info=None,select=0):
|
||||
self.count = self.count + 1
|
||||
iter = self.model.append()
|
||||
col = 0
|
||||
for object in data:
|
||||
self.model.set_value(iter,col,object)
|
||||
col = col + 1
|
||||
self.model.set_value(iter,col,info)
|
||||
if select:
|
||||
self.selection.select_iter(iter)
|
||||
return iter
|
||||
|
||||
def insert(self,position,data,info=None,select=0):
|
||||
self.count = self.count + 1
|
||||
iter = self.model.insert(position)
|
||||
@ -192,6 +183,18 @@ class ListModel:
|
||||
def get_data(self,iter,cols):
|
||||
return [ self.model.get_value(iter,c) for c in cols ]
|
||||
|
||||
def add(self,data,info=None,select=0):
|
||||
self.count = self.count + 1
|
||||
iter = self.model.append()
|
||||
col = 0
|
||||
for object in data:
|
||||
self.model.set_value(iter,col,object)
|
||||
col = col + 1
|
||||
self.model.set_value(iter,col,info)
|
||||
if select:
|
||||
self.sel_iter = iter
|
||||
return iter
|
||||
|
||||
def add_and_select(self,data,info=None):
|
||||
self.count = self.count + 1
|
||||
iter = self.model.append()
|
||||
@ -204,8 +207,9 @@ class ListModel:
|
||||
|
||||
def center_selected(self):
|
||||
model,iter = self.selection.get_selected()
|
||||
path = model.get_path(iter)
|
||||
self.tree.scroll_to_cell(path,None,gtk.TRUE,0.5,0.5)
|
||||
if iter:
|
||||
path = model.get_path(iter)
|
||||
self.tree.scroll_to_cell(path,None,gtk.TRUE,0.5,0.5)
|
||||
|
||||
def button_press(self,obj,event):
|
||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||
|
@ -75,7 +75,10 @@ class NameEditor:
|
||||
|
||||
alt_title = self.top.get_widget("title")
|
||||
|
||||
tmsg = _("Alternate Name Editor for %s") % full_name
|
||||
if full_name == ", ":
|
||||
tmsg = _("Alternate Name Editor")
|
||||
else:
|
||||
tmsg = _("Alternate Name Editor for %s") % full_name
|
||||
|
||||
Utils.set_titles(self.window, alt_title, tmsg, _('Alternate Name Editor'))
|
||||
|
||||
|
@ -52,8 +52,13 @@ class UrlEditor:
|
||||
self.priv = self.top.get_widget("priv")
|
||||
title_label = self.top.get_widget("title")
|
||||
|
||||
Utils.set_titles(self.window,title_label,
|
||||
_('Internet Address Editor for %s') % name,
|
||||
if name == ", ":
|
||||
etitle =_('Internet Address Editor')
|
||||
else:
|
||||
etitle =_('Internet Address Editor for %s') % name,
|
||||
|
||||
|
||||
Utils.set_titles(self.window,title_label, etitle,
|
||||
_('Internet Address Editor'))
|
||||
if url != None:
|
||||
self.des.set_text(url.get_description())
|
||||
|
278
src/docgen/AbiWord2Doc.py
Normal file
278
src/docgen/AbiWord2Doc.py
Normal file
@ -0,0 +1,278 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
"""
|
||||
Provides a TextDoc based interface to the AbiWord document format.
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Imported Modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import base64
|
||||
|
||||
import TextDoc
|
||||
from latin_utf8 import latin_to_utf8
|
||||
import string
|
||||
import Plugins
|
||||
import ImgManip
|
||||
from intl import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Class Definitions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class AbiWordDoc(TextDoc.TextDoc):
|
||||
"""AbiWord document generator. Inherits from the TextDoc generic
|
||||
document interface class."""
|
||||
|
||||
def __init__(self,styles,type,template,orientation):
|
||||
"""Initializes the AbiWordDoc class, calling the __init__ routine
|
||||
of the parent TextDoc class"""
|
||||
TextDoc.TextDoc.__init__(self,styles,type,template,orientation)
|
||||
self.f = None
|
||||
self.level = 0
|
||||
self.new_page = 0
|
||||
self.in_table = 0
|
||||
self.icount = 0;
|
||||
self.imap = {}
|
||||
|
||||
def open(self,filename):
|
||||
"""Opens the document, writing the necessary header information.
|
||||
AbiWord uses an XML format, so the document format is pretty easy
|
||||
to understand"""
|
||||
if filename[-4:] != ".abw":
|
||||
self.filename = "%s.abw" % filename
|
||||
else:
|
||||
self.filename = filename
|
||||
|
||||
try:
|
||||
self.f = open(self.filename,"w")
|
||||
except IOError,msg:
|
||||
errmsg = "%s\n%s" % (_("Could not create %s") % self.filename, msg)
|
||||
raise Errors.ReportError(errmsg)
|
||||
except:
|
||||
raise Errors.ReportError(_("Could not create %s") % self.filename)
|
||||
|
||||
# doctype
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<!DOCTYPE abiword PUBLIC "-//ABISOURCE//DTD AWML 1.0 Strict//EN" ')
|
||||
self.f.write('"http://www.abisource.com/awml.dtd">\n')
|
||||
self.f.write('<abiword template="false" styles="unlocked" xmlns:fo="http://www.w3.org/1999/XSL/Format" ')
|
||||
self.f.write('xmlns:svg="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" ')
|
||||
self.f.write('fileformat="1.1" xmlns:math="http://www.w3.org/1998/Math/MathML" ')
|
||||
self.f.write('xmlns:awml="http://www.abisource.com/awml.dtd" xmlns="http://www.abisource.com/awml.dtd" ')
|
||||
self.f.write('xmlns:xlink="http://www.w3.org/1999/xlink" version="1.9.1" xml:space="preserve" ')
|
||||
self.f.write('props="lang:en-US; dom-dir:ltr">\n')
|
||||
|
||||
# metadata section
|
||||
self.f.write('<metadata>\n')
|
||||
self.f.write('<m key="dc.format">application/x-abiword</m>\n')
|
||||
self.f.write('<m key="abiword.generator">AbiWord</m>\n')
|
||||
self.f.write('<m key="abiword.date_last_changed">Mon May 19 14:16:24 2003</m>\n')
|
||||
self.f.write('</metadata>\n')
|
||||
|
||||
self.write_styles()
|
||||
|
||||
# page size section
|
||||
self.f.write('<pagesize ')
|
||||
self.f.write('pagetype="%s" ' % self.paper.get_name())
|
||||
if self.orientation == TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('orientation="portrait" ')
|
||||
else:
|
||||
self.f.write('orientation="landscape" ')
|
||||
self.f.write('width="%.4f" ' % (self.width/2.54))
|
||||
self.f.write('height="%.4f" ' % (self.height/2.54))
|
||||
self.f.write('units="inch" page-scale="1.000000"/>\n')
|
||||
self.f.write('<section ')
|
||||
rmargin = float(self.rmargin)/2.54
|
||||
lmargin = float(self.lmargin)/2.54
|
||||
self.f.write('props="page-margin-right:%.4fin; ' % rmargin)
|
||||
self.f.write('page-margin-left:%.4fin"' % lmargin)
|
||||
self.f.write('>\n')
|
||||
|
||||
def write_styles(self):
|
||||
self.f.write('<styles>\n')
|
||||
for style_name in self.style_list.keys():
|
||||
style = self.style_list[style_name]
|
||||
self.current_style = style
|
||||
self.f.write('<s type="P" name="%s" basedon="" followedby="" props="' % style_name)
|
||||
self.f.write('margin-top:%.4fin; ' % (float(style.get_padding())/2.54))
|
||||
self.f.write('margin-bottom:%.4fin; ' % (float(style.get_padding())/2.54))
|
||||
if style.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.f.write('text-align:right;')
|
||||
elif style.get_alignment() == TextDoc.PARA_ALIGN_LEFT:
|
||||
self.f.write('text-align:left;')
|
||||
elif style.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
|
||||
self.f.write('text-align:center;')
|
||||
else:
|
||||
self.f.write('text-align:justify;')
|
||||
rmargin = float(style.get_right_margin())/2.54
|
||||
lmargin = float(style.get_left_margin())/2.54
|
||||
indent = float(style.get_first_indent())/2.54
|
||||
self.f.write(' margin-right:%.4fin;' % rmargin)
|
||||
self.f.write(' margin-left:%.4fin;' % lmargin)
|
||||
self.f.write(' tabstops:%.4fin/L;' % lmargin)
|
||||
self.f.write(' text-indent:%.4fin;' % indent)
|
||||
font = style.get_font()
|
||||
self.f.write(' font-family:')
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('Arial; ')
|
||||
else:
|
||||
self.f.write('Times New Roman; ')
|
||||
self.f.write('font-size:%dpt' % font.get_size())
|
||||
if font.get_bold():
|
||||
self.f.write('; font-weight:bold')
|
||||
if font.get_italic():
|
||||
self.f.write('; font-style:italic')
|
||||
color = font.get_color()
|
||||
if color != (0,0,0):
|
||||
self.f.write('; color:%2x%2x%2x' % color)
|
||||
if font.get_underline():
|
||||
self.f.write('; text-decoration:underline')
|
||||
self.f.write('"/>\n')
|
||||
self.f.write('</styles>\n')
|
||||
|
||||
def close(self):
|
||||
"""Write the trailing information and closes the file"""
|
||||
self.f.write('</section>\n')
|
||||
if len(self.photo_list) > 0:
|
||||
self.f.write('<data>\n')
|
||||
for file_tuple in self.photo_list:
|
||||
tag = self.imap[file_tuple[0]]
|
||||
|
||||
img = ImgManip.ImgManip(file_tuple[0])
|
||||
buf = img.png_data()
|
||||
|
||||
self.f.write('<d name="%s" mime-type="image/png" base64="yes">\n' % tag)
|
||||
self.f.write(base64.encodestring(buf))
|
||||
self.f.write('</d>\n')
|
||||
self.f.write('</data>\n')
|
||||
|
||||
self.f.write('</abiword>\n')
|
||||
self.f.close()
|
||||
|
||||
def add_photo(self,name,pos,x_cm,y_cm):
|
||||
|
||||
image = ImgManip.ImgManip(name)
|
||||
(x,y) = image.size()
|
||||
aspect_ratio = float(x)/float(y)
|
||||
|
||||
if aspect_ratio > x_cm/y_cm:
|
||||
act_width = x_cm
|
||||
act_height = y_cm/aspect_ratio
|
||||
else:
|
||||
act_height = y_cm
|
||||
act_width = x_cm*aspect_ratio
|
||||
|
||||
self.photo_list.append((name,act_width,act_height))
|
||||
|
||||
tag = "image%d" % self.icount
|
||||
|
||||
self.f.write('<image dataid="%s" props="width:%.3fcm; ' % (tag, x_cm))
|
||||
self.f.write('height:%.3fcm"/>' % y_cm)
|
||||
self.imap[name] = tag
|
||||
self.icount += 1
|
||||
|
||||
def start_superscript(self):
|
||||
fsize = self.my_para.get_font().get_size()
|
||||
self.text = self.text + '<c props="text-position:superscript">'
|
||||
|
||||
def end_superscript(self):
|
||||
self.text = self.text + '</c>'
|
||||
|
||||
def start_paragraph(self,style_name,leader=None):
|
||||
style = self.style_list[style_name]
|
||||
self.current_style = style
|
||||
self.f.write('<p style="%s">' % style_name)
|
||||
if self.new_page == 1:
|
||||
self.new_page = 0
|
||||
self.f.write('<pbr/>')
|
||||
if leader != None:
|
||||
self.f.write(leader)
|
||||
self.f.write('\t')
|
||||
|
||||
def page_break(self):
|
||||
self.new_page = 1
|
||||
|
||||
def end_paragraph(self):
|
||||
self.f.write('</p>\n')
|
||||
|
||||
def write_text(self,text):
|
||||
text = text.replace('&','&'); # Must be first
|
||||
text = text.replace('<','<');
|
||||
text = text.replace('>','>');
|
||||
text = text.replace('<super>','<c props="text-position:superscript">')
|
||||
text = text.replace('</super>','</c>')
|
||||
self.f.write(text)
|
||||
|
||||
def start_bold(self):
|
||||
self.f.write('<c props="font-weight:bold">')
|
||||
|
||||
def end_bold(self):
|
||||
self.f.write('</c>')
|
||||
|
||||
def start_table(self,name,style_name):
|
||||
self.in_table = 1
|
||||
self.tblstyle = self.table_styles[style_name]
|
||||
self.f.write('<table props="table-column-props:')
|
||||
width = float(self.get_usable_width())
|
||||
for col in range(0,self.tblstyle.get_columns()):
|
||||
self.f.write("%.2fcm/" % ((self.tblstyle.get_column_width(col)/100.0) * width))
|
||||
self.f.write('">\n')
|
||||
self.current_row = -1
|
||||
|
||||
def end_table(self):
|
||||
self.in_table = 0
|
||||
self.f.write('</table>\n')
|
||||
|
||||
def start_row(self):
|
||||
self.ledge = 0.0
|
||||
self.col = 0
|
||||
self.current_row += 1
|
||||
|
||||
def end_row(self):
|
||||
pass
|
||||
|
||||
def start_cell(self,style_name,span=1):
|
||||
self.cstyle = self.cell_styles[style_name]
|
||||
self.f.write('<cell props="')
|
||||
if not self.cstyle.get_top_border():
|
||||
self.f.write('top-style:0; top-style:0;')
|
||||
if not self.cstyle.get_bottom_border():
|
||||
self.f.write('bot-style:0; bot-style:0;')
|
||||
if not self.cstyle.get_right_border():
|
||||
self.f.write('right-style:0; right-style:0;')
|
||||
if not self.cstyle.get_left_border():
|
||||
self.f.write('left-style:0; left-style:0;')
|
||||
|
||||
self.f.write('bot-attach:%d; ' % (self.current_row+1))
|
||||
self.f.write('top-attach:%d; ' % self.current_row)
|
||||
self.f.write('left-attach:%d; ' % self.col)
|
||||
self.f.write('right-attach:%d"' % (self.col+span))
|
||||
self.f.write('>\n')
|
||||
self.col += span
|
||||
|
||||
def end_cell(self):
|
||||
self.f.write('</cell>\n')
|
||||
|
||||
Plugins.register_text_doc(_("AbiWord (version 1.9 or greater)"),AbiWordDoc,1,1,1,".abw")
|
@ -4,6 +4,7 @@
|
||||
|
||||
pkgpython_PYTHON = \
|
||||
AbiWordDoc.py\
|
||||
AbiWord2Doc.py\
|
||||
HtmlDoc.py\
|
||||
KwordDoc.py\
|
||||
LaTeXDoc.py\
|
||||
|
@ -152,7 +152,17 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
|
||||
else:
|
||||
self.f.drawPath(p,stroke=1,fill=0)
|
||||
|
||||
def draw_half_circle(self,style,x,y,radius):
|
||||
def draw_wedge(self, style, centerx, centery, radius, start_angle, end_angle, short_radius=0):
|
||||
|
||||
centerx += self.lmargin
|
||||
centery += self.bmargin
|
||||
from math import sin, cos, pi
|
||||
|
||||
def rnd(val):
|
||||
return val*cm
|
||||
|
||||
while end_angle < start_angle:
|
||||
end_angle += 360
|
||||
|
||||
stype = self.draw_styles[style]
|
||||
if stype.get_line_style() == DrawDoc.SOLID:
|
||||
@ -160,23 +170,47 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
|
||||
else:
|
||||
self.f.setDash([2,4],0)
|
||||
|
||||
self.f.setLineWidth(stype.get_line_width())
|
||||
degreestoradians = pi/180.0
|
||||
radiansdelta = degreestoradians
|
||||
sangle = start_angle*degreestoradians
|
||||
eangle = end_angle*degreestoradians
|
||||
while eangle<sangle:
|
||||
eangle = eangle+2*pi
|
||||
angle = sangle
|
||||
|
||||
color = stype.get_fill_color()
|
||||
self.f.setFillColor((float(color[0])/255.0,float(color[1])/255.0,float(color[2])/255.0))
|
||||
|
||||
x0 = (x+self.lmargin)*cm
|
||||
y0 = (y+self.tmargin)*cm
|
||||
r = radius*cm
|
||||
|
||||
p = self.f.beginPath()
|
||||
p.moveTo(x0-r,y0)
|
||||
p.arcTo(x0-r,y0-(r/2),x0+r,y0+(r/2))
|
||||
p.lineTo(x0-r,y0)
|
||||
self.f.drawPath(p,fill=1,stroke=1)
|
||||
if short_radius == 0:
|
||||
p.moveTo(rnd(centerx),rnd(centery))
|
||||
else:
|
||||
origx = rnd(centerx + cos(angle)*short_radius)
|
||||
origy = rnd(centery + sin(angle)*short_radius)
|
||||
p.moveTo(origx, origy)
|
||||
|
||||
# self.f.arc(x0-r,y0-r,x0+r,y0+r,180,180)
|
||||
# self.f.line(x0-r,y0,x0+r,y0)
|
||||
fill = stype.get_color()
|
||||
while angle<eangle:
|
||||
x = centerx + cos(angle)*radius
|
||||
y = centery + sin(angle)*radius
|
||||
p.lineTo(rnd(x),rnd(y))
|
||||
angle = angle+radiansdelta
|
||||
x = centerx + cos(eangle)*radius
|
||||
y = centery + sin(eangle)*radius
|
||||
p.lineTo(rnd(x),rnd(y))
|
||||
|
||||
if short_radius:
|
||||
x = centerx + cos(eangle)*short_radius
|
||||
y = centery + sin(eangle)*short_radius
|
||||
p.lineTo(rnd(x),rnd(y))
|
||||
|
||||
angle = eangle
|
||||
while angle>=sangle:
|
||||
x = centerx + cos(angle)*short_radius
|
||||
y = centery + sin(angle)*short_radius
|
||||
p.lineTo(rnd(x),rnd(y))
|
||||
angle = angle-radiansdelta
|
||||
p.close()
|
||||
self.f.drawPath(p,stroke=1,fill=1)
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
x = x + self.lmargin
|
||||
|
Loading…
Reference in New Issue
Block a user