Pychecker cleanup

svn: r374
This commit is contained in:
Don Allingham 2001-09-01 17:13:15 +00:00
parent e02d596106
commit 8f30edd435
10 changed files with 103 additions and 75 deletions

View File

@ -104,7 +104,7 @@ class Bookmarks :
# add_to_menu - adds a person's name to the drop down menu
#
#---------------------------------------------------------------------
def add_to_menu(person):
def add_to_menu(self,person):
item = gtk.GtkMenuItem(person.getPrimaryName().getName())
item.connect("activate", self.callback, person)
item.show()

View File

@ -377,7 +377,7 @@ class EditPerson:
self.person.setEventList(self.elist)
self.person.setAlternateNames(self.nlist)
self.person.setUrlList(self.ulist)
self.person.setAttributeList(epo.alist)
self.person.setAttributeList(self.alist)
self.person.setAddressList(self.plist)
utils.modified()
@ -1466,7 +1466,7 @@ class EventEditor:
self.note_field.insert_defaults(event.getNote())
self.note_field.set_word_wrap(1)
else:
utuils.attach_places(values,self.place_combo,None)
utils.attach_places(values,self.place_combo,None)
self.conf_menu.set_history(2)
self.window.set_data(OBJECT,self)

View File

@ -114,11 +114,11 @@ def load_filters(dir):
name = os.path.split(file)
match = pymod.match(name[1])
if match:
groups = match.groups()
plugin = match.groups()[0]
try:
plugin = __import__(groups[0])
__import__(plugin)
except:
print _("Failed to load the module: %s") % groups[0]
print _("Failed to load the module: %s") % plugin
import traceback
traceback.print_exc()

View File

@ -187,7 +187,7 @@ class GrampsParser(handler.ContentHandler):
#
#
#---------------------------------------------------------------------
def start_coord(tag,attrs):
def start_coord(self,attrs):
if attrs.has_key('lat'):
self.placeobj.set_latitude(u2l(attrs['lat']))
if attrs.has_key('long'):

View File

@ -456,6 +456,21 @@ def on_photolist_button_press_event(obj,event):
on_convert_to_private)
menu.popup(None,None,None,0,0)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_convert_to_private(obj):
epo = obj.get_data(OBJECT)
photo = epo.family.getPhotoList()[epo.selected_icon]
prefix = "f%s" % epo.person.getId()
name = RelImage.import_photo(photo.getPath(),epo.path,prefix)
photo.setPath(name)
photo.setPrivate(1)
#-------------------------------------------------------------------------
#
#
@ -682,7 +697,7 @@ class EventEditor:
self.top.get_widget("eventTitle").set_text(name)
self.event_menu.set_popdown_strings(const.marriageEvents)
build_confidence_menu(self.conf_menu)
utils.build_confidence_menu(self.conf_menu)
values = self.parent.db.getPlaceMap().values()
if event != None:
@ -801,7 +816,7 @@ class AttributeEditor:
if len(const.familyAttributes) > 0:
self.attrib_menu.set_popdown_strings(const.familyAttributes)
build_confidence_menu(self.conf_menu)
utils.build_confidence_menu(self.conf_menu)
if attrib != None:
self.type_field.set_text(attrib.getType())

View File

@ -37,7 +37,6 @@ _ = intl.gettext
#-------------------------------------------------------------------------
import os
import sys
import string
import re
#-------------------------------------------------------------------------
@ -178,7 +177,7 @@ def on_report_node_selected(obj):
title = obj.get_data(TITLE)
img = myobj.dialog.get_widget("image")
myobj.dialog.get_widget("description").set_text(DOCSTRING)
myobj.dialog.get_widget("description").set_text(doc)
i,m = create_pixmap_from_xpm_d(GtkWindow(),None,xpm)
img.set(i,m)
@ -233,11 +232,11 @@ def load_plugins(dir):
match = pymod.match(name[1])
if not match:
continue
groups = match.groups()
plugin = match.groups()[0]
try:
plugin = __import__(groups[0])
__import__(plugin)
except:
print _("Failed to load the module: %s") % groups[0]
print _("Failed to load the module: %s") % plugin
import traceback
traceback.print_exc()

View File

@ -154,7 +154,7 @@ def loadData(database, filename, callback=None):
GnomeErrorDialog("%s\n%s" % (filemsg,errmsg))
return 0
except IOError,msg:
errmsg = "%s\n%s" % (_("Error reading %s"),filename,str(msg))
errmsg = "%s\n%s" % (_("Error reading %s") % filename,str(msg))
GnomeErrorDialog(errmsg)
import traceback
traceback.print_exc()

View File

@ -258,7 +258,7 @@ class Photo:
if self.proplist != None:
self.proplist = {}
for p in source.proplist.keys():
self.proplist[k] = source.proplist[k]
self.proplist[p] = source.proplist[p]
else:
self.proplist = None
else:
@ -1446,7 +1446,7 @@ class RelDataBase:
if map.has_key(idVal):
place = self.placeMap[map[idVal]]
else:
palce = Place()
place = Place()
map[idVal] = self.addPlace(place)
return place

View File

@ -19,7 +19,6 @@
#
import os
import sys
import intl
_ = intl.gettext

View File

@ -43,6 +43,7 @@ _ = intl.gettext
from gtk import *
from gnome.ui import *
import GDK
import GTK
import libglade
@ -93,6 +94,8 @@ childWindow = None
new_child_win = None
add_child_win = None
bookmarks = None
pevent = []
fevent = []
id2col = {}
alt2col = {}
@ -106,6 +109,9 @@ source_list = None
place_list = None
database = None
family_window = None
nameArrow = None
deathArrow = None
dateArrow = None
pv = {}
sort_column = 5
sort_direct = SORT_ASCENDING
@ -128,6 +134,7 @@ GIVEN = "g"
SURNAME = "s"
RELTYPE = "d"
PAD = 3
CANVASPAD = 15
#-------------------------------------------------------------------------
#
@ -1011,14 +1018,6 @@ def new_place_after_edit(place):
database.addPlace(place)
update_display(0)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def update_after_edit(source):
update_display(0)
#-------------------------------------------------------------------------
#
#
@ -2324,26 +2323,21 @@ def find_tree(person,index,depth,list):
#
#-------------------------------------------------------------------------
canvas_items = []
old_gen = 0
old_h = 0
old_w = 0
def load_canvas():
global canvas_items
global old_gen,old_h,old_w
if active_person == None:
return
h = 0
w = 0
xpad = 15
canvas = gtop.get_widget("canvas1")
cx1,cy1,cx2,cy2 = canvas.get_allocation()
root = canvas.root()
cw = (cx2-cx1-(2*xpad))
cw = (cx2-cx1-(2*CANVASPAD))
style = canvas['style']
font = style.font
@ -2372,21 +2366,19 @@ def load_canvas():
c.destroy()
canvas.set_scroll_region(cx1,cy1,cx2,cy2)
xincr = cw/xdiv
yincr = cy2/32
xpts = build_x_coords(cw/xdiv)
ypts = build_y_coords(cy2/32.0)
xfactor = [xpad] + [xincr+xpad]*2 + [xincr*2+xpad]*4 + [xincr*3+xpad]*8 + [xincr*4+xpad]*16
yfactor = [ yincr*16, yincr*8,yincr*24,yincr*4,yincr*12,yincr*20, yincr*28,
yincr*2, yincr*6,yincr*10,yincr*14,yincr*18,yincr*22,yincr*26,
yincr*30, yincr, yincr*3, yincr*5, yincr*7, yincr*9, yincr*11,
yincr*13, yincr*15, yincr*17, yincr*19, yincr*21, yincr*23,
yincr*25, yincr*27, yincr*29, yincr*31]
if len(active_person.getFamilyList()) > 0:
ypos = yfactor[0]+h/2.0
childcnt = 0
for family in active_person.getFamilyList():
for child in family.getChildList():
childcnt = 1
break
if childcnt != 0:
ypos = ypts[0]+h/2.0
item = root.add("line",
points=[xpad,ypos,xpad/4.0,ypos],
points=[CANVASPAD,ypos,CANVASPAD/4.0,ypos],
fill_color_gdk=style.black,
width_pixels=3,
arrow_shape_a=6,
@ -2402,35 +2394,54 @@ def load_canvas():
for i in range(gen):
if list[i]:
if i < int(gen/2):
startx = xfactor[i]+(w/2)
if list[(2*i)+1]:
pts = [startx,yfactor[i],
startx,yfactor[(i*2)+1]+(h/2),
xfactor[(i*2)+1],yfactor[(i*2)+1]+(h/2)]
item = root.add("line",
width_pixels=2,
points=pts,
fill_color_gdk=style.black)
item.set_data("p",list[(2*i)+1])
item.connect("event",line_event)
canvas_items.append(item)
if list[(2*i)+2]:
pts = [startx,yfactor[i]+h,
startx,yfactor[(i*2)+2]+(h/2),
xfactor[(i*2)+2],yfactor[(i*2)+2]+(h/2)]
item = root.add("line",
points=pts,
width_pixels=2,
fill_color_gdk=style.black)
item.set_data("p",list[(2*i)+2])
item.connect("event",line_event)
canvas_items.append(item)
add_box(root,xfactor[i],yfactor[i],w,h,list[i],style)
findex = (2*i)+1
mindex = findex+1
if list[findex]:
draw_canvas_line(root, xpts[i], ypts[i], xpts[findex],
ypts[findex], h, w, list[findex], style)
if list[mindex]:
draw_canvas_line(root,xpts[i],ypts[i], xpts[mindex],
ypts[mindex], h, w, list[mindex], style)
add_box(root,xpts[i],ypts[i],w,h,list[i],style)
old_gen = gen
old_h = h
old_w = w
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def draw_canvas_line(root,x1,y1,x2,y2,h,w,data,style):
startx = x1+(w/2.0)
pts = [startx,y1, startx,y2+(h/2.0), x2,y2+(h/2.0)]
item = root.add("line",
width_pixels=2,
points=pts,
fill_color_gdk=style.black)
item.set_data("p",data)
item.connect("event",line_event)
canvas_items.append(item)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def build_x_coords(xincr):
return [CANVASPAD] + [xincr+CANVASPAD]*2 + [xincr*2+CANVASPAD]*4 +\
[xincr*3+CANVASPAD]*8 + [xincr*4+CANVASPAD]*16
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def build_y_coords(yincr):
return [ yincr*16, yincr*8, yincr*24, yincr*4, yincr*12,
yincr*20, yincr*28, yincr*2, yincr*6, yincr*10,
yincr*14, yincr*18, yincr*22, yincr*26, yincr*30,
yincr, yincr*3, yincr*5, yincr*7, yincr*9,
yincr*11, yincr*13, yincr*15, yincr*17, yincr*19,
yincr*21, yincr*23, yincr*25, yincr*27, yincr*29, yincr*31]
#-------------------------------------------------------------------------
#
@ -2531,13 +2542,14 @@ def line_event(obj,event):
load_canvas()
elif event.type == GDK.ENTER_NOTIFY:
canvas = gtop.get_widget("canvas1")
obj.set(fill_color_gdk=canvas['style'].bg[STATE_SELECTED])
obj.set(fill_color_gdk=canvas['style'].bg[STATE_SELECTED],
width_pixels=4)
name = Config.nameof(obj.get_data("p"))
msg = _("Double clicking will make %s the active person") % name
statusbar.set_status(msg)
elif event.type == GDK.LEAVE_NOTIFY:
canvas = gtop.get_widget("canvas1")
obj.set(fill_color_gdk=canvas['style'].black)
obj.set(fill_color_gdk=canvas['style'].black, width_pixels=2)
modify_statusbar()
#-------------------------------------------------------------------------
@ -2621,7 +2633,6 @@ def display_marriage(family):
clist.clear()
active_child = None
active_fams = family
i = 0
if family != None:
@ -2977,6 +2988,7 @@ def main(arg):
global statusbar,notebook
global person_list, source_list, place_list,pv
global topWindow
global nameArrow, dateArrow, deathArrow
rc_parse(const.gtkrcFile)
@ -2999,6 +3011,9 @@ def main(arg):
place_list = gtop.get_widget("place_list")
filter_list = gtop.get_widget("filter_list")
notebook = gtop.get_widget(NOTEBOOK)
nameArrow = gtop.get_widget("nameSort")
dateArrow = gtop.get_widget("dateSort")
deathArrow = gtop.get_widget("deathSort")
person_list.set_column_visibility(5,0)
person_list.set_column_visibility(6,0)