Center list after a quick person add

svn: r1621
This commit is contained in:
Don Allingham 2003-06-01 22:46:00 +00:00
parent d21f811d0a
commit e1665b524c
4 changed files with 19 additions and 30 deletions

View File

@ -188,7 +188,7 @@ class DrawDoc:
def line_to(self,x,y):
pass
def arc_to(self,x,y):
def arc_to(self,x,y,angle,extent):
pass
def end_path(self):

View File

@ -186,6 +186,11 @@ class ListModel:
col = col + 1
self.model.set_value(iter,col,info)
self.selection.select_iter(iter)
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)
def button_press(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:

View File

@ -257,6 +257,7 @@ class SelectChild:
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
self.refmodel.add_and_select(rdata)
self.add_person(person)
self.refmodel.center_selected()
def north_american(self,val):
if self.person.getGender() == Person.male:

View File

@ -152,25 +152,7 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
else:
self.f.drawPath(p,stroke=1,fill=0)
def start_path(self,style,x,y):
self.active_path = self.f.beginPath()
self.active_path.move_to(x+self.lmargin,y=self.tmargin)
self.active_style = style
def line_to(self,x,y):
self.active_path.line_to(x+self.lmargin,y+self.tmargin)
def arc_to(self,x,y):
self.active_path.arc_to(x+self.lmargin,y+self.tmargin)
def end_path(self):
self.f.draw_path(self.active_path,stroke=1,fill=1)
def draw_arc(self,style,x1,y1,x2,y2,angle,extent):
x1 += self.lmargin
y1 += self.tmargin
x2 += self.lmargin
y2 += self.tmargin
def draw_half_circle(self,style,x,y,radius):
stype = self.draw_styles[style]
if stype.get_line_style() == DrawDoc.SOLID:
@ -182,18 +164,19 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
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.arc(x1*cm,y1*cm,x2*cm,y2*cm,angle,extent)
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)
# 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()
print x1*cm,y1*cm,x2*cm,y2*cm,angle,extent
self.f.drawPath(p,stroke=1,fill=0)
# if fill[0] == 0:
# self.f.drawPath(p,stroke=1,fill=1)
# else:
# self.f.drawPath(p,stroke=1,fill=0)
def draw_box(self,style,text,x,y):
x = x + self.lmargin