Center list after a quick person add
svn: r1621
This commit is contained in:
parent
ad19e456f8
commit
6166b47e5a
@ -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):
|
||||
|
@ -187,6 +187,11 @@ class ListModel:
|
||||
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:
|
||||
self.double_click(obj)
|
||||
|
@ -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:
|
||||
|
@ -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,19 +164,20 @@ 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
|
||||
y = y + self.tmargin
|
||||
|
Loading…
Reference in New Issue
Block a user