Center list after a quick person add
svn: r1621
This commit is contained in:
parent
d21f811d0a
commit
e1665b524c
@ -188,7 +188,7 @@ class DrawDoc:
|
|||||||
def line_to(self,x,y):
|
def line_to(self,x,y):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def arc_to(self,x,y):
|
def arc_to(self,x,y,angle,extent):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def end_path(self):
|
def end_path(self):
|
||||||
|
@ -187,6 +187,11 @@ class ListModel:
|
|||||||
self.model.set_value(iter,col,info)
|
self.model.set_value(iter,col,info)
|
||||||
self.selection.select_iter(iter)
|
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):
|
def button_press(self,obj,event):
|
||||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
self.double_click(obj)
|
self.double_click(obj)
|
||||||
|
@ -257,6 +257,7 @@ class SelectChild:
|
|||||||
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
|
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
|
||||||
self.refmodel.add_and_select(rdata)
|
self.refmodel.add_and_select(rdata)
|
||||||
self.add_person(person)
|
self.add_person(person)
|
||||||
|
self.refmodel.center_selected()
|
||||||
|
|
||||||
def north_american(self,val):
|
def north_american(self,val):
|
||||||
if self.person.getGender() == Person.male:
|
if self.person.getGender() == Person.male:
|
||||||
|
@ -152,25 +152,7 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
|
|||||||
else:
|
else:
|
||||||
self.f.drawPath(p,stroke=1,fill=0)
|
self.f.drawPath(p,stroke=1,fill=0)
|
||||||
|
|
||||||
def start_path(self,style,x,y):
|
def draw_half_circle(self,style,x,y,radius):
|
||||||
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
|
|
||||||
|
|
||||||
stype = self.draw_styles[style]
|
stype = self.draw_styles[style]
|
||||||
if stype.get_line_style() == DrawDoc.SOLID:
|
if stype.get_line_style() == DrawDoc.SOLID:
|
||||||
@ -182,19 +164,20 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
|
|||||||
color = stype.get_fill_color()
|
color = stype.get_fill_color()
|
||||||
self.f.setFillColor((float(color[0])/255.0,float(color[1])/255.0,float(color[2])/255.0))
|
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 = 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()
|
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):
|
def draw_box(self,style,text,x,y):
|
||||||
x = x + self.lmargin
|
x = x + self.lmargin
|
||||||
y = y + self.tmargin
|
y = y + self.tmargin
|
||||||
|
Loading…
Reference in New Issue
Block a user