Pychecker cleanup
svn: r374
This commit is contained in:
parent
37d5875db1
commit
8d7741a3d1
@ -104,7 +104,7 @@ class Bookmarks :
|
|||||||
# add_to_menu - adds a person's name to the drop down menu
|
# 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 = gtk.GtkMenuItem(person.getPrimaryName().getName())
|
||||||
item.connect("activate", self.callback, person)
|
item.connect("activate", self.callback, person)
|
||||||
item.show()
|
item.show()
|
||||||
|
@ -377,7 +377,7 @@ class EditPerson:
|
|||||||
self.person.setEventList(self.elist)
|
self.person.setEventList(self.elist)
|
||||||
self.person.setAlternateNames(self.nlist)
|
self.person.setAlternateNames(self.nlist)
|
||||||
self.person.setUrlList(self.ulist)
|
self.person.setUrlList(self.ulist)
|
||||||
self.person.setAttributeList(epo.alist)
|
self.person.setAttributeList(self.alist)
|
||||||
self.person.setAddressList(self.plist)
|
self.person.setAddressList(self.plist)
|
||||||
utils.modified()
|
utils.modified()
|
||||||
|
|
||||||
@ -1466,7 +1466,7 @@ class EventEditor:
|
|||||||
self.note_field.insert_defaults(event.getNote())
|
self.note_field.insert_defaults(event.getNote())
|
||||||
self.note_field.set_word_wrap(1)
|
self.note_field.set_word_wrap(1)
|
||||||
else:
|
else:
|
||||||
utuils.attach_places(values,self.place_combo,None)
|
utils.attach_places(values,self.place_combo,None)
|
||||||
self.conf_menu.set_history(2)
|
self.conf_menu.set_history(2)
|
||||||
|
|
||||||
self.window.set_data(OBJECT,self)
|
self.window.set_data(OBJECT,self)
|
||||||
|
@ -114,11 +114,11 @@ def load_filters(dir):
|
|||||||
name = os.path.split(file)
|
name = os.path.split(file)
|
||||||
match = pymod.match(name[1])
|
match = pymod.match(name[1])
|
||||||
if match:
|
if match:
|
||||||
groups = match.groups()
|
plugin = match.groups()[0]
|
||||||
try:
|
try:
|
||||||
plugin = __import__(groups[0])
|
__import__(plugin)
|
||||||
except:
|
except:
|
||||||
print _("Failed to load the module: %s") % groups[0]
|
print _("Failed to load the module: %s") % plugin
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
def start_coord(tag,attrs):
|
def start_coord(self,attrs):
|
||||||
if attrs.has_key('lat'):
|
if attrs.has_key('lat'):
|
||||||
self.placeobj.set_latitude(u2l(attrs['lat']))
|
self.placeobj.set_latitude(u2l(attrs['lat']))
|
||||||
if attrs.has_key('long'):
|
if attrs.has_key('long'):
|
||||||
|
@ -456,6 +456,21 @@ def on_photolist_button_press_event(obj,event):
|
|||||||
on_convert_to_private)
|
on_convert_to_private)
|
||||||
menu.popup(None,None,None,0,0)
|
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.top.get_widget("eventTitle").set_text(name)
|
||||||
self.event_menu.set_popdown_strings(const.marriageEvents)
|
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()
|
values = self.parent.db.getPlaceMap().values()
|
||||||
if event != None:
|
if event != None:
|
||||||
@ -801,7 +816,7 @@ class AttributeEditor:
|
|||||||
if len(const.familyAttributes) > 0:
|
if len(const.familyAttributes) > 0:
|
||||||
self.attrib_menu.set_popdown_strings(const.familyAttributes)
|
self.attrib_menu.set_popdown_strings(const.familyAttributes)
|
||||||
|
|
||||||
build_confidence_menu(self.conf_menu)
|
utils.build_confidence_menu(self.conf_menu)
|
||||||
|
|
||||||
if attrib != None:
|
if attrib != None:
|
||||||
self.type_field.set_text(attrib.getType())
|
self.type_field.set_text(attrib.getType())
|
||||||
|
@ -37,7 +37,6 @@ _ = intl.gettext
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import string
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -178,7 +177,7 @@ def on_report_node_selected(obj):
|
|||||||
title = obj.get_data(TITLE)
|
title = obj.get_data(TITLE)
|
||||||
img = myobj.dialog.get_widget("image")
|
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)
|
i,m = create_pixmap_from_xpm_d(GtkWindow(),None,xpm)
|
||||||
img.set(i,m)
|
img.set(i,m)
|
||||||
@ -233,11 +232,11 @@ def load_plugins(dir):
|
|||||||
match = pymod.match(name[1])
|
match = pymod.match(name[1])
|
||||||
if not match:
|
if not match:
|
||||||
continue
|
continue
|
||||||
groups = match.groups()
|
plugin = match.groups()[0]
|
||||||
try:
|
try:
|
||||||
plugin = __import__(groups[0])
|
__import__(plugin)
|
||||||
except:
|
except:
|
||||||
print _("Failed to load the module: %s") % groups[0]
|
print _("Failed to load the module: %s") % plugin
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ def loadData(database, filename, callback=None):
|
|||||||
GnomeErrorDialog("%s\n%s" % (filemsg,errmsg))
|
GnomeErrorDialog("%s\n%s" % (filemsg,errmsg))
|
||||||
return 0
|
return 0
|
||||||
except IOError,msg:
|
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)
|
GnomeErrorDialog(errmsg)
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
@ -258,7 +258,7 @@ class Photo:
|
|||||||
if self.proplist != None:
|
if self.proplist != None:
|
||||||
self.proplist = {}
|
self.proplist = {}
|
||||||
for p in source.proplist.keys():
|
for p in source.proplist.keys():
|
||||||
self.proplist[k] = source.proplist[k]
|
self.proplist[p] = source.proplist[p]
|
||||||
else:
|
else:
|
||||||
self.proplist = None
|
self.proplist = None
|
||||||
else:
|
else:
|
||||||
@ -1446,7 +1446,7 @@ class RelDataBase:
|
|||||||
if map.has_key(idVal):
|
if map.has_key(idVal):
|
||||||
place = self.placeMap[map[idVal]]
|
place = self.placeMap[map[idVal]]
|
||||||
else:
|
else:
|
||||||
palce = Place()
|
place = Place()
|
||||||
map[idVal] = self.addPlace(place)
|
map[idVal] = self.addPlace(place)
|
||||||
return place
|
return place
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import intl
|
import intl
|
||||||
|
|
||||||
_ = intl.gettext
|
_ = intl.gettext
|
||||||
|
@ -43,6 +43,7 @@ _ = intl.gettext
|
|||||||
from gtk import *
|
from gtk import *
|
||||||
from gnome.ui import *
|
from gnome.ui import *
|
||||||
|
|
||||||
|
import GDK
|
||||||
import GTK
|
import GTK
|
||||||
import libglade
|
import libglade
|
||||||
|
|
||||||
@ -93,6 +94,8 @@ childWindow = None
|
|||||||
new_child_win = None
|
new_child_win = None
|
||||||
add_child_win = None
|
add_child_win = None
|
||||||
bookmarks = None
|
bookmarks = None
|
||||||
|
pevent = []
|
||||||
|
fevent = []
|
||||||
|
|
||||||
id2col = {}
|
id2col = {}
|
||||||
alt2col = {}
|
alt2col = {}
|
||||||
@ -106,6 +109,9 @@ source_list = None
|
|||||||
place_list = None
|
place_list = None
|
||||||
database = None
|
database = None
|
||||||
family_window = None
|
family_window = None
|
||||||
|
nameArrow = None
|
||||||
|
deathArrow = None
|
||||||
|
dateArrow = None
|
||||||
pv = {}
|
pv = {}
|
||||||
sort_column = 5
|
sort_column = 5
|
||||||
sort_direct = SORT_ASCENDING
|
sort_direct = SORT_ASCENDING
|
||||||
@ -128,6 +134,7 @@ GIVEN = "g"
|
|||||||
SURNAME = "s"
|
SURNAME = "s"
|
||||||
RELTYPE = "d"
|
RELTYPE = "d"
|
||||||
PAD = 3
|
PAD = 3
|
||||||
|
CANVASPAD = 15
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -1011,14 +1018,6 @@ def new_place_after_edit(place):
|
|||||||
database.addPlace(place)
|
database.addPlace(place)
|
||||||
update_display(0)
|
update_display(0)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def update_after_edit(source):
|
|
||||||
update_display(0)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -2324,26 +2323,21 @@ def find_tree(person,index,depth,list):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
canvas_items = []
|
canvas_items = []
|
||||||
old_gen = 0
|
|
||||||
old_h = 0
|
|
||||||
old_w = 0
|
|
||||||
|
|
||||||
def load_canvas():
|
def load_canvas():
|
||||||
global canvas_items
|
global canvas_items
|
||||||
global old_gen,old_h,old_w
|
|
||||||
|
|
||||||
if active_person == None:
|
if active_person == None:
|
||||||
return
|
return
|
||||||
|
|
||||||
h = 0
|
h = 0
|
||||||
w = 0
|
w = 0
|
||||||
xpad = 15
|
|
||||||
|
|
||||||
canvas = gtop.get_widget("canvas1")
|
canvas = gtop.get_widget("canvas1")
|
||||||
cx1,cy1,cx2,cy2 = canvas.get_allocation()
|
cx1,cy1,cx2,cy2 = canvas.get_allocation()
|
||||||
root = canvas.root()
|
root = canvas.root()
|
||||||
|
|
||||||
cw = (cx2-cx1-(2*xpad))
|
cw = (cx2-cx1-(2*CANVASPAD))
|
||||||
|
|
||||||
style = canvas['style']
|
style = canvas['style']
|
||||||
font = style.font
|
font = style.font
|
||||||
@ -2372,21 +2366,19 @@ def load_canvas():
|
|||||||
c.destroy()
|
c.destroy()
|
||||||
canvas.set_scroll_region(cx1,cy1,cx2,cy2)
|
canvas.set_scroll_region(cx1,cy1,cx2,cy2)
|
||||||
|
|
||||||
xincr = cw/xdiv
|
xpts = build_x_coords(cw/xdiv)
|
||||||
yincr = cy2/32
|
ypts = build_y_coords(cy2/32.0)
|
||||||
|
|
||||||
xfactor = [xpad] + [xincr+xpad]*2 + [xincr*2+xpad]*4 + [xincr*3+xpad]*8 + [xincr*4+xpad]*16
|
childcnt = 0
|
||||||
yfactor = [ yincr*16, yincr*8,yincr*24,yincr*4,yincr*12,yincr*20, yincr*28,
|
for family in active_person.getFamilyList():
|
||||||
yincr*2, yincr*6,yincr*10,yincr*14,yincr*18,yincr*22,yincr*26,
|
for child in family.getChildList():
|
||||||
yincr*30, yincr, yincr*3, yincr*5, yincr*7, yincr*9, yincr*11,
|
childcnt = 1
|
||||||
yincr*13, yincr*15, yincr*17, yincr*19, yincr*21, yincr*23,
|
break
|
||||||
yincr*25, yincr*27, yincr*29, yincr*31]
|
|
||||||
|
|
||||||
|
if childcnt != 0:
|
||||||
if len(active_person.getFamilyList()) > 0:
|
ypos = ypts[0]+h/2.0
|
||||||
ypos = yfactor[0]+h/2.0
|
|
||||||
item = root.add("line",
|
item = root.add("line",
|
||||||
points=[xpad,ypos,xpad/4.0,ypos],
|
points=[CANVASPAD,ypos,CANVASPAD/4.0,ypos],
|
||||||
fill_color_gdk=style.black,
|
fill_color_gdk=style.black,
|
||||||
width_pixels=3,
|
width_pixels=3,
|
||||||
arrow_shape_a=6,
|
arrow_shape_a=6,
|
||||||
@ -2402,35 +2394,54 @@ def load_canvas():
|
|||||||
for i in range(gen):
|
for i in range(gen):
|
||||||
if list[i]:
|
if list[i]:
|
||||||
if i < int(gen/2):
|
if i < int(gen/2):
|
||||||
startx = xfactor[i]+(w/2)
|
findex = (2*i)+1
|
||||||
if list[(2*i)+1]:
|
mindex = findex+1
|
||||||
pts = [startx,yfactor[i],
|
if list[findex]:
|
||||||
startx,yfactor[(i*2)+1]+(h/2),
|
draw_canvas_line(root, xpts[i], ypts[i], xpts[findex],
|
||||||
xfactor[(i*2)+1],yfactor[(i*2)+1]+(h/2)]
|
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)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
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",
|
item = root.add("line",
|
||||||
width_pixels=2,
|
width_pixels=2,
|
||||||
points=pts,
|
points=pts,
|
||||||
fill_color_gdk=style.black)
|
fill_color_gdk=style.black)
|
||||||
item.set_data("p",list[(2*i)+1])
|
item.set_data("p",data)
|
||||||
item.connect("event",line_event)
|
item.connect("event",line_event)
|
||||||
canvas_items.append(item)
|
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)
|
|
||||||
|
|
||||||
old_gen = gen
|
#-------------------------------------------------------------------------
|
||||||
old_h = h
|
#
|
||||||
old_w = w
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
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()
|
load_canvas()
|
||||||
elif event.type == GDK.ENTER_NOTIFY:
|
elif event.type == GDK.ENTER_NOTIFY:
|
||||||
canvas = gtop.get_widget("canvas1")
|
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"))
|
name = Config.nameof(obj.get_data("p"))
|
||||||
msg = _("Double clicking will make %s the active person") % name
|
msg = _("Double clicking will make %s the active person") % name
|
||||||
statusbar.set_status(msg)
|
statusbar.set_status(msg)
|
||||||
elif event.type == GDK.LEAVE_NOTIFY:
|
elif event.type == GDK.LEAVE_NOTIFY:
|
||||||
canvas = gtop.get_widget("canvas1")
|
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()
|
modify_statusbar()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -2621,7 +2633,6 @@ def display_marriage(family):
|
|||||||
|
|
||||||
clist.clear()
|
clist.clear()
|
||||||
active_child = None
|
active_child = None
|
||||||
active_fams = family
|
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
if family != None:
|
if family != None:
|
||||||
@ -2977,6 +2988,7 @@ def main(arg):
|
|||||||
global statusbar,notebook
|
global statusbar,notebook
|
||||||
global person_list, source_list, place_list,pv
|
global person_list, source_list, place_list,pv
|
||||||
global topWindow
|
global topWindow
|
||||||
|
global nameArrow, dateArrow, deathArrow
|
||||||
|
|
||||||
rc_parse(const.gtkrcFile)
|
rc_parse(const.gtkrcFile)
|
||||||
|
|
||||||
@ -2999,6 +3011,9 @@ def main(arg):
|
|||||||
place_list = gtop.get_widget("place_list")
|
place_list = gtop.get_widget("place_list")
|
||||||
filter_list = gtop.get_widget("filter_list")
|
filter_list = gtop.get_widget("filter_list")
|
||||||
notebook = gtop.get_widget(NOTEBOOK)
|
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(5,0)
|
||||||
person_list.set_column_visibility(6,0)
|
person_list.set_column_visibility(6,0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user