Clean up from pychecker.

svn: r592
This commit is contained in:
Don Allingham 2001-11-28 04:17:52 +00:00
parent 492d2cc56a
commit b3fda053d7
18 changed files with 149 additions and 186 deletions

View File

@ -31,9 +31,10 @@ import string
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import GDK import GDK
import GTK
import gtk
import gnome.ui
import libglade import libglade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -127,7 +128,7 @@ class ImageSelect:
description = self.description.get_text() description = self.description.get_text()
if os.path.exists(filename) == 0: if os.path.exists(filename) == 0:
GnomeErrorDialog(_("That is not a valid file name.")); gnome.ui.GnomeErrorDialog(_("That is not a valid file name."));
return return
already_imported = None already_imported = None
@ -190,7 +191,7 @@ class Gallery(ImageSelect):
('text/uri-list',0,2), ('text/uri-list',0,2),
('application/x-rootwin-drop',0,1)] ('application/x-rootwin-drop',0,1)]
icon_list.drag_dest_set(DEST_DEFAULT_ALL, t, GDK.ACTION_COPY | GDK.ACTION_MOVE) icon_list.drag_dest_set(GTK.DEST_DEFAULT_ALL, t, GDK.ACTION_COPY | GDK.ACTION_MOVE)
icon_list.connect("drag_data_received", self.on_photolist_drag_data_received) icon_list.connect("drag_data_received", self.on_photolist_drag_data_received)
icon_list.drag_source_set(GDK.BUTTON1_MASK|GDK.BUTTON3_MASK,t,\ icon_list.drag_source_set(GDK.BUTTON1_MASK|GDK.BUTTON3_MASK,t,\
@ -281,7 +282,7 @@ class Gallery(ImageSelect):
except IOError, msg: except IOError, msg:
t = _("Could not import %s") % d t = _("Could not import %s") % d
GnomeErrorDialog("%s\n%s %d" % (t,msg[0],msg[1])) gnome.ui.GnomeErrorDialog("%s\n%s %d" % (t,msg[0],msg[1]))
return return
mime = utils.get_mime_type(tfile) mime = utils.get_mime_type(tfile)
photo = Photo() photo = Photo()
@ -300,7 +301,7 @@ class Gallery(ImageSelect):
photo.setPath(name) photo.setPath(name)
except: except:
photo.setPath(tfile) photo.setPath(tfile)
w.drag_finish(context, TRUE, FALSE, time) w.drag_finish(context, 1, 0, time)
return return
self.add_thumbnail(oref) self.add_thumbnail(oref)
utils.modified() utils.modified()
@ -310,10 +311,10 @@ class Gallery(ImageSelect):
for p in self.dataobj.getPhotoList(): for p in self.dataobj.getPhotoList():
if data.data == p.getReference().getId(): if data.data == p.getReference().getId():
if index == icon_index or icon_index == -1: if index == icon_index or icon_index == -1:
w.drag_finish(context, FALSE, FALSE, time) w.drag_finish(context, 0, 0, time)
return return
else: else:
w.drag_finish(context, TRUE, FALSE, time) w.drag_finish(context, 1, 0, time)
nl = self.dataobj.getPhotoList() nl = self.dataobj.getPhotoList()
item = nl[index] item = nl[index]
if icon_index == 0: if icon_index == 0:
@ -332,9 +333,9 @@ class Gallery(ImageSelect):
self.dataobj.addPhoto(oref) self.dataobj.addPhoto(oref)
self.add_thumbnail(oref) self.add_thumbnail(oref)
utils.modified() utils.modified()
w.drag_finish(context, TRUE, FALSE, time) w.drag_finish(context, 1, 0, time)
else: else:
w.drag_finish(context, FALSE, FALSE, time) w.drag_finish(context, 0, 0, time)
def on_photolist_drag_data_get(self,w, context, selection_data, info, time): def on_photolist_drag_data_get(self,w, context, selection_data, info, time):
if info == 1: if info == 1:
@ -384,8 +385,8 @@ class Gallery(ImageSelect):
if event.button == 3: if event.button == 3:
photo = self.dataobj.getPhotoList()[icon] photo = self.dataobj.getPhotoList()[icon]
menu = GtkMenu() menu = gtk.GtkMenu()
item = GtkTearoffMenuItem() item = gtk.GtkTearoffMenuItem()
item.show() item.show()
menu.append(item) menu.append(item)
utils.add_menuitem(menu,_("View in the default viewer"),None,self.popup_view_photo) utils.add_menuitem(menu,_("View in the default viewer"),None,self.popup_view_photo)

View File

@ -26,7 +26,6 @@ import ImageSelect
from RelLib import * from RelLib import *
import utils import utils
import const
import os import os
import Config import Config

View File

@ -196,15 +196,6 @@ def write_line(g,label,value,indent=1):
if value: if value:
g.write('%s<%s>%s</%s>\n' % (' '*indent,label,fix(value),label)) g.write('%s<%s>%s</%s>\n' % (' '*indent,label,fix(value),label))
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def write_line(g,label,value,indent=1):
if value:
g.write('%s<%s>%s</%s>\n' % (' '*indent,label,fix(value),label))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #

View File

@ -3,6 +3,7 @@
import traceback import traceback
import intl import intl
import os import os
import gtk
intl.textdomain("gramps") intl.textdomain("gramps")

View File

@ -40,8 +40,8 @@ _ = gettext
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gtk import * import gtk
from gnome.ui import * import gnome.ui
import GDK import GDK
import GTK import GTK
import libglade import libglade
@ -112,7 +112,7 @@ dateArrow = None
merge_button = None merge_button = None
sort_column = 0 sort_column = 0
sort_direct = SORT_ASCENDING sort_direct = GTK.SORT_ASCENDING
DataFilter = Filter.Filter("") DataFilter = Filter.Filter("")
c_birth_order = 0 c_birth_order = 0
c_name = 1 c_name = 1
@ -120,7 +120,7 @@ c_id = 2
c_birth_date = 4 c_birth_date = 4
c_details = 6 c_details = 6
c_sort_column = c_birth_order c_sort_column = c_birth_order
c_sort_direct = SORT_ASCENDING c_sort_direct = GTK.SORT_ASCENDING
cNameArrow = None cNameArrow = None
cDateArrow = None cDateArrow = None
@ -160,7 +160,7 @@ def on_merge_activate(obj):
if page == 0: if page == 0:
if len(person_list.selection) != 2: if len(person_list.selection) != 2:
msg = _("Exactly two people must be selected to perform a merge") msg = _("Exactly two people must be selected to perform a merge")
GnomeErrorDialog(msg) gnome.ui.GnomeErrorDialog(msg)
else: else:
import MergeData import MergeData
p1 = person_list.get_row_data(person_list.selection[0]) p1 = person_list.get_row_data(person_list.selection[0])
@ -178,22 +178,22 @@ def delete_event(widget, event):
"""Catch the destruction of the top window, prompt to save if needed""" """Catch the destruction of the top window, prompt to save if needed"""
widget.hide() widget.hide()
on_exit_activate(widget) on_exit_activate(widget)
return TRUE return 1
def on_exit_activate(obj): def on_exit_activate(obj):
"""Prompt to save on exit if needed""" """Prompt to save on exit if needed"""
if utils.wasModified(): if utils.wasModified():
question = _("Unsaved changes exist in the current database\n") + \ question = _("Unsaved changes exist in the current database\n") + \
_("Do you wish to save the changes?") _("Do you wish to save the changes?")
GnomeQuestionDialog(question,save_query) gnome.ui.GnomeQuestionDialog(question,save_query)
else: else:
mainquit(obj) gtk.mainquit(obj)
def save_query(value): def save_query(value):
"""Catch the reponse to the save on exit question""" """Catch the reponse to the save on exit question"""
if value == 0: if value == 0:
on_save_activate_quit() on_save_activate_quit()
mainquit(gtop) gtk.mainquit(gtop)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -202,7 +202,7 @@ def save_query(value):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_about_activate(obj): def on_about_activate(obj):
"""Displays the about box. Called from Help menu""" """Displays the about box. Called from Help menu"""
GnomeAbout(const.progName,const.version,const.copyright, gnome.ui.GnomeAbout(const.progName,const.version,const.copyright,
const.authors,const.comments,const.logo).show() const.authors,const.comments,const.logo).show()
def on_contents_activate(obj): def on_contents_activate(obj):
@ -365,7 +365,7 @@ def on_choose_parents_clicked(obj):
def on_new_clicked(obj): def on_new_clicked(obj):
"""Prompt for permission to close the current database""" """Prompt for permission to close the current database"""
msg = _("Do you want to close the current database and create a new one?") msg = _("Do you want to close the current database and create a new one?")
GnomeQuestionDialog(msg,new_database_response) gnome.ui.GnomeQuestionDialog(msg,new_database_response)
def new_database_response(val): def new_database_response(val):
"""Clear out the database if permission was granted""" """Clear out the database if permission was granted"""
@ -556,13 +556,13 @@ def save_file(filename,comment):
try: try:
os.mkdir(filename) os.mkdir(filename)
except IOError, msg: except IOError, msg:
GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg))
return return
except OSError, msg: except OSError, msg:
GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg))
return return
except: except:
GnomeErrorDialog(_("Could not create %s") % filename) gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename)
return return
old_file = filename old_file = filename
@ -570,10 +570,10 @@ def save_file(filename,comment):
try: try:
WriteXML.exportData(database,filename,load_progress) WriteXML.exportData(database,filename,load_progress)
except IOError, msg: except IOError, msg:
GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg))
return return
except OSError, msg: except OSError, msg:
GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg))
return return
database.setSavePath(old_file) database.setSavePath(old_file)
@ -596,7 +596,7 @@ def load_selected_people(obj):
"""Display the selected people in the EditPerson display""" """Display the selected people in the EditPerson display"""
if len(person_list.selection) > 5: if len(person_list.selection) > 5:
msg = _("You requested too many people to edit at the same time") msg = _("You requested too many people to edit at the same time")
GnomeErrorDialog(msg) gnome.ui.GnomeErrorDialog(msg)
else: else:
for p in person_list.selection: for p in person_list.selection:
person = person_list.get_row_data(p) person = person_list.get_row_data(p)
@ -635,9 +635,9 @@ def load_new_person(obj):
def on_delete_person_clicked(obj): def on_delete_person_clicked(obj):
if len(person_list.selection) == 1: if len(person_list.selection) == 1:
msg = _("Do you really wish to delete %s?") % Config.nameof(active_person) msg = _("Do you really wish to delete %s?") % Config.nameof(active_person)
GnomeQuestionDialog( msg, delete_person_response) gnome.ui.GnomeQuestionDialog( msg, delete_person_response)
elif len(person_list.selection) > 1: elif len(person_list.selection) > 1:
GnomeErrorDialog(_("Currently, you can only delete one person at a time")) gnome.ui.GnomeErrorDialog(_("Currently, you can only delete one person at a time"))
def delete_person_response(val): def delete_person_response(val):
if val == 1: if val == 1:
@ -751,7 +751,7 @@ def set_sort_arrow(column,direct):
if arrow != a: if arrow != a:
a.hide() a.hide()
arrow.show() arrow.show()
if direct == SORT_ASCENDING: if direct == GTK.SORT_ASCENDING:
arrow.set(GTK.ARROW_DOWN,2) arrow.set(GTK.ARROW_DOWN,2)
else: else:
arrow.set(GTK.ARROW_UP,2) arrow.set(GTK.ARROW_UP,2)
@ -769,14 +769,14 @@ def change_sort(column):
arrow.show() arrow.show()
if sort_column == column: if sort_column == column:
if sort_direct == SORT_DESCENDING: if sort_direct == GTK.SORT_DESCENDING:
sort_direct = SORT_ASCENDING sort_direct = GTK.SORT_ASCENDING
arrow.set(GTK.ARROW_DOWN,2) arrow.set(GTK.ARROW_DOWN,2)
else: else:
sort_direct = SORT_DESCENDING sort_direct = GTK.SORT_DESCENDING
arrow.set(GTK.ARROW_UP,2) arrow.set(GTK.ARROW_UP,2)
else: else:
sort_direct = SORT_ASCENDING sort_direct = GTK.SORT_ASCENDING
arrow.set(GTK.ARROW_DOWN,2) arrow.set(GTK.ARROW_DOWN,2)
sort_column = column sort_column = column
@ -799,10 +799,10 @@ def sort_person_list():
person_list.sort() person_list.sort()
if ListColors.get_enable(): if ListColors.get_enable():
try: try:
oddbg = GdkColor(ListColors.oddbg[0],ListColors.oddbg[1],ListColors.oddbg[2]) oddbg = gtk.GdkColor(ListColors.oddbg[0],ListColors.oddbg[1],ListColors.oddbg[2])
oddfg = GdkColor(ListColors.oddfg[0],ListColors.oddfg[1],ListColors.oddfg[2]) oddfg = gtk.GdkColor(ListColors.oddfg[0],ListColors.oddfg[1],ListColors.oddfg[2])
evenbg = GdkColor(ListColors.evenbg[0],ListColors.evenbg[1],ListColors.evenbg[2]) evenbg = gtk.GdkColor(ListColors.evenbg[0],ListColors.evenbg[1],ListColors.evenbg[2])
evenfg = GdkColor(ListColors.evenfg[0],ListColors.evenfg[1],ListColors.evenfg[2]) evenfg = gtk.GdkColor(ListColors.evenfg[0],ListColors.evenfg[1],ListColors.evenfg[2])
rows = person_list.rows rows = person_list.rows
for i in range(0,rows,2): for i in range(0,rows,2):
person_list.set_background(i,oddbg) person_list.set_background(i,oddbg)
@ -933,14 +933,14 @@ def child_change_sort(clist,column,arrow):
arrow.show() arrow.show()
if c_sort_column == column: if c_sort_column == column:
if c_sort_direct == SORT_DESCENDING: if c_sort_direct == GTK.SORT_DESCENDING:
c_sort_direct = SORT_ASCENDING c_sort_direct = GTK.SORT_ASCENDING
arrow.set(GTK.ARROW_DOWN,2) arrow.set(GTK.ARROW_DOWN,2)
else: else:
c_sort_direct = SORT_DESCENDING c_sort_direct = GTK.SORT_DESCENDING
arrow.set(GTK.ARROW_UP,2) arrow.set(GTK.ARROW_UP,2)
else: else:
c_sort_direct = SORT_ASCENDING c_sort_direct = GTK.SORT_ASCENDING
c_sort_column = column c_sort_column = column
clist.set_sort_type(c_sort_direct) clist.set_sort_type(c_sort_direct)
clist.set_sort_column(c_sort_column) clist.set_sort_column(c_sort_column)
@ -996,7 +996,7 @@ def on_child_list_row_move(clist,fm,to):
# This function deals with ascending order lists. Convert if # This function deals with ascending order lists. Convert if
# necessary. # necessary.
if (c_sort_direct == SORT_DESCENDING): if (c_sort_direct == GTK.SORT_DESCENDING):
clist_order.reverse() clist_order.reverse()
max_index = len(clist_order) - 1 max_index = len(clist_order) - 1
fm = max_index - fm fm = max_index - fm
@ -1009,7 +1009,7 @@ def on_child_list_row_move(clist,fm,to):
# Check birth date order in the new list # Check birth date order in the new list
if (EditPerson.birth_dates_in_order(desired_order) == 0): if (EditPerson.birth_dates_in_order(desired_order) == 0):
clist.emit_stop_by_name("row_move") clist.emit_stop_by_name("row_move")
GnomeWarningDialog(_("Invalid move. Children must be ordered by birth date.")) gnome.ui.GnomeWarningDialog(_("Invalid move. Children must be ordered by birth date."))
return return
# OK, this birth order works too. Update the family data structures. # OK, this birth order works too. Update the family data structures.
@ -1025,7 +1025,7 @@ def on_child_list_row_move(clist,fm,to):
# Convert the original list back to whatever ordering is being # Convert the original list back to whatever ordering is being
# used by the clist itself. # used by the clist itself.
if (c_sort_direct == SORT_DESCENDING): if (c_sort_direct == GTK.SORT_DESCENDING):
clist_order.reverse() clist_order.reverse()
# Update the clist indices so any change of sorting works # Update the clist indices so any change of sorting works
@ -1061,10 +1061,10 @@ def on_open_activate(obj):
def on_revert_activate(obj): def on_revert_activate(obj):
if database.getSavePath() != "": if database.getSavePath() != "":
msg = _("Do you wish to abandon your changes and revert to the last saved database?") msg = _("Do you wish to abandon your changes and revert to the last saved database?")
GnomeQuestionDialog(msg,revert_query) gnome.ui.GnomeQuestionDialog(msg,revert_query)
else: else:
msg = _("Cannot revert to a previous database, since one does not exist") msg = _("Cannot revert to a previous database, since one does not exist")
GnomeWarningDialog(msg) gnome.ui.GnomeWarningDialog(msg)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1344,18 +1344,18 @@ def load_family(family=None):
active_parents = None active_parents = None
if len(family_types) > 0: if len(family_types) > 0:
typeMenu = GtkMenu() typeMenu = gtk.GtkMenu()
if main_family: if main_family:
menuitem = GtkMenuItem(_("Birth")) menuitem = gtk.GtkMenuItem(_("Birth"))
menuitem.set_data("parents",main_family) menuitem.set_data("parents",main_family)
menuitem.connect("activate",on_current_type_changed) menuitem.connect("activate",on_current_type_changed)
menuitem.show() menuitem.show()
typeMenu.append(menuitem) typeMenu.append(menuitem)
for fam in family_types: for fam in family_types:
if active_person == fam[0].getFather(): if active_person == fam[0].getFather():
menuitem = GtkMenuItem("%s/%s" % (fam[1],fam[2])) menuitem = gtk.GtkMenuItem("%s/%s" % (fam[1],fam[2]))
else: else:
menuitem = GtkMenuItem("%s/%s" % (fam[2],fam[1])) menuitem = gtk.GtkMenuItem("%s/%s" % (fam[2],fam[1]))
menuitem.set_data("parents",fam[0]) menuitem.set_data("parents",fam[0])
menuitem.connect("activate",on_current_type_changed) menuitem.connect("activate",on_current_type_changed)
menuitem.show() menuitem.show()
@ -1370,7 +1370,7 @@ def load_family(family=None):
if active_person: if active_person:
number_of_families = len(active_person.getFamilyList()) number_of_families = len(active_person.getFamilyList())
if number_of_families > 1: if number_of_families > 1:
myMenu = GtkMenu() myMenu = gtk.GtkMenu()
index = 0 index = 0
opt_index = 0 opt_index = 0
for f in active_person.getFamilyList(): for f in active_person.getFamilyList():
@ -1382,7 +1382,7 @@ def load_family(family=None):
if f.getMother() != None: if f.getMother() != None:
person = f.getMother() person = f.getMother()
menuitem = GtkMenuItem(Config.nameof(person)) menuitem = gtk.GtkMenuItem(Config.nameof(person))
myMenu.append(menuitem) myMenu.append(menuitem)
menuitem.set_data("person",person) menuitem.set_data("person",person)
menuitem.set_data("family",f) menuitem.set_data("family",f)
@ -1573,8 +1573,8 @@ def display_marriage(family):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def load_progress(value): def load_progress(value):
statusbar.set_progress(value) statusbar.set_progress(value)
while events_pending(): while gtk.events_pending():
mainiteration() gtk.mainiteration()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1678,7 +1678,7 @@ def setup_bookmarks():
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def displayError(msg): def displayError(msg):
GnomeErrorDialog(msg) gnome.ui.GnomeErrorDialog(msg)
statusbar.set_status("") statusbar.set_status("")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -1764,7 +1764,7 @@ def on_home_clicked(obj):
change_active_person(temp) change_active_person(temp)
update_display(0) update_display(0)
else: else:
GnomeErrorDialog(_("No default/home person has been set")) gnome.ui.GnomeErrorDialog(_("No default/home person has been set"))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1790,7 +1790,7 @@ def on_default_person_activate(obj):
if active_person: if active_person:
name = active_person.getPrimaryName().getRegularName() name = active_person.getPrimaryName().getRegularName()
msg = _("Do you wish to set %s as the home person?") % name msg = _("Do you wish to set %s as the home person?") % name
GnomeQuestionDialog(msg,set_person) gnome.ui.GnomeQuestionDialog(msg,set_person)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1879,7 +1879,7 @@ def main(arg):
global cNameArrow, cDateArrow global cNameArrow, cDateArrow
global sort_column, sort_direct global sort_column, sort_direct
rc_parse(const.gtkrcFile) gtk.rc_parse(const.gtkrcFile)
database = RelDataBase() database = RelDataBase()
Plugins.load_plugins(const.pluginsDir) Plugins.load_plugins(const.pluginsDir)
@ -1927,7 +1927,7 @@ def main(arg):
fw.set_sensitive(0) fw.set_sensitive(0)
# set the window icon # set the window icon
topWindow.set_icon(GtkPixmap(topWindow,const.icon)) topWindow.set_icon(gtk.GtkPixmap(topWindow,const.icon))
person_list.column_titles_active() person_list.column_titles_active()
set_sort_arrow(sort_column,sort_direct) set_sort_arrow(sort_column,sort_direct)
@ -2021,7 +2021,7 @@ def main(arg):
database.set_pprefix(Config.pprefix) database.set_pprefix(Config.pprefix)
child_list = gtop.get_widget("child_list") child_list = gtop.get_widget("child_list")
child_list.set_column_visibility(c_details,Config.show_detail) child_list.set_column_visibility(c_details,Config.show_detail)
child_list.set_column_justification(c_birth_order,JUSTIFY_RIGHT) child_list.set_column_justification(c_birth_order,GTK.JUSTIFY_RIGHT)
if arg != None: if arg != None:
read_file(arg) read_file(arg)
@ -2029,7 +2029,7 @@ def main(arg):
read_file(Config.lastfile) read_file(Config.lastfile)
database.setResearcher(Config.owner) database.setResearcher(Config.owner)
mainloop() gtk.mainloop()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -20,13 +20,11 @@
"Generate files/Ancestor Chart" "Generate files/Ancestor Chart"
import RelLib
import Config import Config
import const import const
import os import os
import string import string
import utils import utils
import Config
from FontScale import string_width from FontScale import string_width
@ -35,8 +33,8 @@ from DrawDoc import *
from StyleEditor import * from StyleEditor import *
import FindDoc import FindDoc
from libglade import * import libglade
from gtk import * import gtk
import intl import intl
_ = intl.gettext _ = intl.gettext
@ -275,7 +273,7 @@ def report(database,person):
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
glade_file = base + os.sep + "ancestorchart.glade" glade_file = base + os.sep + "ancestorchart.glade"
topDialog = GladeXML(glade_file,"dialog1") topDialog = libglade.GladeXML(glade_file,"dialog1")
topDialog.get_widget("fileentry1").set_default_path(Config.report_dir) topDialog.get_widget("fileentry1").set_default_path(Config.report_dir)
name = person.getPrimaryName().getRegularName() name = person.getPrimaryName().getRegularName()
@ -311,9 +309,9 @@ def report(database,person):
def build_menu(object): def build_menu(object):
menu = topDialog.get_widget("style_menu") menu = topDialog.get_widget("style_menu")
myMenu = GtkMenu() myMenu = gtk.GtkMenu()
for style in style_sheet_list.get_style_names(): for style in style_sheet_list.get_style_names():
menuitem = GtkMenuItem(style) menuitem = gtk.GtkMenuItem(style)
menuitem.set_data("d",style_sheet_list.get_style_sheet(style)) menuitem.set_data("d",style_sheet_list.get_style_sheet(style))
menuitem.show() menuitem.show()
myMenu.append(menuitem) myMenu.append(menuitem)

View File

@ -23,8 +23,6 @@
import RelLib import RelLib
import const import const
import os import os
import re
import sort
import string import string
import utils import utils
import Config import Config
@ -37,9 +35,9 @@ from StyleEditor import *
import FindDoc import FindDoc
from gtk import * import gtk
from gnome.ui import * import gnome.ui
from libglade import * import libglade
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -106,7 +104,7 @@ class AncestorReport:
try: try:
self.doc.open(output) self.doc.open(output)
except IOError,msg: except IOError,msg:
GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg) gnome.ui.GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
@ -141,7 +139,6 @@ class AncestorReport:
keys = self.map.keys() keys = self.map.keys()
keys.sort() keys.sort()
generation = 0 generation = 0
need_header = 1
for key in keys : for key in keys :
if generation == 0 or key >= 2**generation: if generation == 0 or key >= 2**generation:
@ -289,7 +286,7 @@ def report(database,person):
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
glade_file = base + os.sep + "ancestorreport.glade" glade_file = base + os.sep + "ancestorreport.glade"
topDialog = GladeXML(glade_file,"dialog1") topDialog = libglade.GladeXML(glade_file,"dialog1")
topDialog.get_widget("fileentry1").set_default_path(Config.report_dir) topDialog.get_widget("fileentry1").set_default_path(Config.report_dir)
name = person.getPrimaryName().getRegularName() name = person.getPrimaryName().getRegularName()
@ -337,9 +334,9 @@ def report(database,person):
def build_menu(object): def build_menu(object):
menu = topDialog.get_widget("style_menu") menu = topDialog.get_widget("style_menu")
myMenu = GtkMenu() myMenu = gtk.GtkMenu()
for style in style_sheet_list.get_style_names(): for style in style_sheet_list.get_style_names():
menuitem = GtkMenuItem(style) menuitem = gtk.GtkMenuItem(style)
menuitem.set_data("d",style_sheet_list.get_style_sheet(style)) menuitem.set_data("d",style_sheet_list.get_style_sheet(style))
menuitem.show() menuitem.show()
myMenu.append(menuitem) myMenu.append(menuitem)

View File

@ -22,11 +22,9 @@
import os import os
from gtk import * import gnome.ui
from gnome.ui import * import libglade
from libglade import *
import RelLib
import const import const
import utils import utils
import intl import intl
@ -48,7 +46,7 @@ class ChangeTypes:
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
glade_file = "%s/%s" % (base,"changetype.glade") glade_file = "%s/%s" % (base,"changetype.glade")
self.glade = GladeXML(glade_file,"top") self.glade = libglade.GladeXML(glade_file,"top")
self.glade.get_widget("original").set_popdown_strings(const.personalEvents) self.glade.get_widget("original").set_popdown_strings(const.personalEvents)
self.glade.get_widget("new").set_popdown_strings(const.personalEvents) self.glade.get_widget("new").set_popdown_strings(const.personalEvents)
@ -79,7 +77,7 @@ class ChangeTypes:
else: else:
msg = _("%d event records were modified") % modified msg = _("%d event records were modified") % modified
GnomeOkDialog(msg) gnome.ui.GnomeOkDialog(msg)
utils.destroy_passed_object(obj) utils.destroy_passed_object(obj)
#------------------------------------------------------------------------ #------------------------------------------------------------------------

View File

@ -22,17 +22,13 @@
import RelLib import RelLib
import utils import utils
import soundex
import Config
import intl import intl
_ = intl.gettext _ = intl.gettext
import string
import os import os
from gtk import * import gnome.ui
from gnome.ui import * import libglade
from libglade import *
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -167,7 +163,7 @@ class CheckIntegrity:
errors = blink + efam + photos + rel errors = blink + efam + photos + rel
if errors == 0: if errors == 0:
GnomeOkDialog(_("No errors were found")) gnome.ui.GnomeOkDialog(_("No errors were found"))
return return
text = "" text = ""
@ -204,7 +200,7 @@ class CheckIntegrity:
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
glade_file = base + os.sep + "summary.glade" glade_file = base + os.sep + "summary.glade"
topDialog = GladeXML(glade_file,"summary") topDialog = libglade.GladeXML(glade_file,"summary")
topDialog.signal_autoconnect({ topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object, "destroy_passed_object" : utils.destroy_passed_object,
}) })

View File

@ -28,9 +28,9 @@ import Config
_ = intl.gettext _ = intl.gettext
from gtk import * import GDK
from gnome.ui import * import gtk
from libglade import * import libglade
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -49,7 +49,7 @@ class DesBrowse:
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
glade_file = base + os.sep + "desbrowse.glade" glade_file = base + os.sep + "desbrowse.glade"
self.glade = GladeXML(glade_file,"top") self.glade = libglade.GladeXML(glade_file,"top")
self.glade.signal_autoconnect({ self.glade.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object, "destroy_passed_object" : utils.destroy_passed_object,
}) })
@ -60,7 +60,7 @@ class DesBrowse:
top.show() top.show()
def add_to_tree(self,tree,person): def add_to_tree(self,tree,person):
item = GtkTreeItem(Config.nameof(person)) item = gtk.GtkTreeItem(Config.nameof(person))
item.show() item.show()
item.connect('button-press-event',self.button_press_event) item.connect('button-press-event',self.button_press_event)
item.set_data('d',person) item.set_data('d',person)
@ -69,7 +69,7 @@ class DesBrowse:
for family in person.getFamilyList(): for family in person.getFamilyList():
for child in family.getChildList(): for child in family.getChildList():
if subtree == None: if subtree == None:
subtree = GtkTree() subtree = gtk.GtkTree()
subtree.show() subtree.show()
item.set_subtree(subtree) item.set_subtree(subtree)
self.add_to_tree(subtree,child) self.add_to_tree(subtree,child)

View File

@ -21,25 +21,21 @@
"Generate files/Descendant Report" "Generate files/Descendant Report"
import os import os
import re
import sort import sort
import string import string
import intl import intl
_ = intl.gettext _ = intl.gettext
import RelLib
import const import const
import Config import Config
import utils import utils
import const
from TextDoc import * from TextDoc import *
from StyleEditor import * from StyleEditor import *
import FindDoc import FindDoc
from gtk import * import gtk
from gnome.ui import * import libglade
from libglade import *
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -133,7 +129,7 @@ class DesReportWindow:
self.person = person self.person = person
glade_file = os.path.dirname(__file__) + os.sep + "desreport.glade" glade_file = os.path.dirname(__file__) + os.sep + "desreport.glade"
self.top = GladeXML(glade_file,"dialog1") self.top = libglade.GladeXML(glade_file,"dialog1")
self.top.get_widget("fileentry1").set_default_path(Config.report_dir) self.top.get_widget("fileentry1").set_default_path(Config.report_dir)
self.top.signal_autoconnect({ self.top.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object, "destroy_passed_object" : utils.destroy_passed_object,
@ -182,10 +178,10 @@ class DesReportWindow:
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def build_menu(object): def build_menu(object):
myMenu = GtkMenu() myMenu = gtk.GtkMenu()
for style in object.style_sheet_list.get_style_names(): for style in object.style_sheet_list.get_style_names():
menuitem = GtkMenuItem(style) menuitem = gtk.GtkMenuItem(style)
menuitem.set_data("d",object.style_sheet_list.get_style_sheet(style)) menuitem.set_data("d",object.style_sheet_list.get_style_sheet(style))
menuitem.show() menuitem.show()
myMenu.append(menuitem) myMenu.append(menuitem)

View File

@ -37,9 +37,9 @@ from StyleEditor import *
import FindDoc import FindDoc
from gtk import * import gtk
from gnome.ui import * import gnome.ui
from libglade import * import libglade
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -106,7 +106,7 @@ class DetAncestorReport:
try: try:
self.doc.open(output) self.doc.open(output)
except IOError,msg: except IOError,msg:
GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg) gnome.ui.GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
@ -503,7 +503,7 @@ def report(database,person):
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
glade_file = base + os.sep + "ancestorreport.glade" glade_file = base + os.sep + "ancestorreport.glade"
topDialog = GladeXML(glade_file,"dialog1") topDialog = libglade.GladeXML(glade_file,"dialog1")
name = person.getPrimaryName().getRegularName() name = person.getPrimaryName().getRegularName()
@ -569,9 +569,9 @@ def report(database,person):
def build_menu(object): def build_menu(object):
menu = topDialog.get_widget("style_menu") menu = topDialog.get_widget("style_menu")
myMenu = GtkMenu() myMenu = gtk.GtkMenu()
for style in style_sheet_list.get_style_names(): for style in style_sheet_list.get_style_names():
menuitem = GtkMenuItem(style) menuitem = gtk.GtkMenuItem(style)
menuitem.set_data("d",style_sheet_list.get_style_sheet(style)) menuitem.set_data("d",style_sheet_list.get_style_sheet(style))
menuitem.show() menuitem.show()
myMenu.append(menuitem) myMenu.append(menuitem)

View File

@ -26,13 +26,9 @@
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import os import os
import re
import sort import sort
import utils import utils
import string import string
from gtk import *
from gnome.ui import *
from libglade import *
import ListColors import ListColors
import Filter import Filter
import const import const
@ -40,6 +36,10 @@ from TextDoc import *
from OpenSpreadSheet import * from OpenSpreadSheet import *
import intl import intl
import gtk
import gnome.ui
import libglade
_ = intl.gettext _ = intl.gettext
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -134,7 +134,7 @@ class EventComparison:
xml = os.path.expanduser("~/.gramps/eventcmp.xml") xml = os.path.expanduser("~/.gramps/eventcmp.xml")
self.interface = ComplexFilterFile(xml) self.interface = ComplexFilterFile(xml)
self.filterDialog = GladeXML(self.glade_file,"filters") self.filterDialog = libglade.GladeXML(self.glade_file,"filters")
self.filterDialog.signal_autoconnect({ self.filterDialog.signal_autoconnect({
"on_add_clicked" : self.on_add_clicked, "on_add_clicked" : self.on_add_clicked,
"on_delete_clicked" : self.on_delete_clicked, "on_delete_clicked" : self.on_delete_clicked,
@ -167,7 +167,7 @@ class EventComparison:
my_list.append(person) my_list.append(person)
if len(my_list) == 0: if len(my_list) == 0:
GnomeWarningDialog("No matches were found") gnome.ui.GnomeWarningDialog("No matches were found")
else: else:
DisplayChart(my_list) DisplayChart(my_list)
@ -207,7 +207,7 @@ class EventComparison:
self.filter_list_obj.append([name,qualifier,invert_text]) self.filter_list_obj.append([name,qualifier,invert_text])
def on_filter_save_clicked(self,obj): def on_filter_save_clicked(self,obj):
self.load_dialog = GladeXML(self.glade_file,"filter_file") self.load_dialog = libglade.GladeXML(self.glade_file,"filter_file")
self.filter_combo = self.load_dialog.get_widget("filter_combo") self.filter_combo = self.load_dialog.get_widget("filter_combo")
self.load_dialog.get_widget("title").set_text("Save complex filter") self.load_dialog.get_widget("title").set_text("Save complex filter")
names = self.interface.get_filter_names() names = self.interface.get_filter_names()
@ -220,7 +220,7 @@ class EventComparison:
}) })
def on_filter_load_clicked(self,obj): def on_filter_load_clicked(self,obj):
self.load_dialog = GladeXML(self.glade_file,"filter_file") self.load_dialog = libglade.GladeXML(self.glade_file,"filter_file")
self.filter_combo = self.load_dialog.get_widget("filter_combo") self.filter_combo = self.load_dialog.get_widget("filter_combo")
self.load_dialog.get_widget("title").set_text("Load complex filter") self.load_dialog.get_widget("title").set_text("Load complex filter")
names = self.interface.get_filter_names() names = self.interface.get_filter_names()
@ -357,7 +357,7 @@ class DisplayChart:
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
self.glade_file = base + os.sep + "eventcmp.glade" self.glade_file = base + os.sep + "eventcmp.glade"
self.topDialog = GladeXML(self.glade_file,"view") self.topDialog = libglade.GladeXML(self.glade_file,"view")
self.topDialog.signal_autoconnect({ self.topDialog.signal_autoconnect({
"on_write_table" : self.on_write_table, "on_write_table" : self.on_write_table,
"destroy_passed_object" : utils.destroy_passed_object "destroy_passed_object" : utils.destroy_passed_object
@ -375,7 +375,7 @@ class DisplayChart:
def draw_clist_display(self): def draw_clist_display(self):
eventlist = GtkCList(len(self.event_titles),self.event_titles) eventlist = gtk.GtkCList(len(self.event_titles),self.event_titles)
self.table.add(eventlist) self.table.add(eventlist)
eventlist.show() eventlist.show()
color_clist = ListColors.ColorList(eventlist,2) color_clist = ListColors.ColorList(eventlist,2)
@ -458,7 +458,7 @@ class DisplayChart:
return [_("Person"),_("Birth"),_("Death")] + sort_list return [_("Person"),_("Birth"),_("Death")] + sort_list
def on_write_table(self,obj): def on_write_table(self,obj):
self.form = GladeXML(self.glade_file,"dialog1") self.form = libglade.GladeXML(self.glade_file,"dialog1")
self.form.signal_autoconnect({ self.form.signal_autoconnect({
"on_save_clicked" : self.on_save_clicked, "on_save_clicked" : self.on_save_clicked,
"on_html_toggled" : self.on_html_toggled, "on_html_toggled" : self.on_html_toggled,

View File

@ -23,7 +23,6 @@
import RelLib import RelLib
import const import const
import os import os
import re
import string import string
import FindDoc import FindDoc
import utils import utils
@ -34,9 +33,8 @@ _ = intl.gettext
from TextDoc import * from TextDoc import *
from StyleEditor import * from StyleEditor import *
from gtk import * import gtk
from gnome.ui import * import libglade
from libglade import *
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -347,16 +345,14 @@ def report(database,person):
global active_person global active_person
global topDialog global topDialog
global glade_file
global db global db
global style_sheet_list global style_sheet_list
active_person = person active_person = person
db = database db = database
base = os.path.dirname(__file__) glade_file = "%s/familygroup.glade" % os.path.dirname(__file__)
glade_file = base + os.sep + "familygroup.glade" topDialog = libglade.GladeXML(glade_file,"dialog1")
topDialog = GladeXML(glade_file,"dialog1")
topDialog.get_widget("fileentry1").set_default_path(Config.report_dir) topDialog.get_widget("fileentry1").set_default_path(Config.report_dir)
name = person.getPrimaryName().getRegularName() name = person.getPrimaryName().getRegularName()
@ -423,16 +419,16 @@ def report(database,person):
else: else:
frame.hide() frame.hide()
my_menu = GtkMenu() my_menu = gtk.GtkMenu()
for family in family_list: for family in family_list:
if person == family.getFather(): if person == family.getFather():
spouse = family.getMother() spouse = family.getMother()
else: else:
spouse = family.getFather() spouse = family.getFather()
if spouse: if spouse:
item = GtkMenuItem(spouse.getPrimaryName().getName()) item = gtk.GtkMenuItem(spouse.getPrimaryName().getName())
else: else:
item = GtkMenuItem("unknown") item = gtk.GtkMenuItem("unknown")
item.set_data("f",family) item.set_data("f",family)
item.show() item.show()
my_menu.append(item) my_menu.append(item)
@ -454,9 +450,9 @@ def on_style_edit_clicked(obj):
def build_menu(object): def build_menu(object):
menu = topDialog.get_widget("style_menu") menu = topDialog.get_widget("style_menu")
myMenu = GtkMenu() myMenu = gtk.GtkMenu()
for style in style_sheet_list.get_style_names(): for style in style_sheet_list.get_style_names():
menuitem = GtkMenuItem(style) menuitem = gtk.GtkMenuItem(style)
menuitem.set_data("d",style_sheet_list.get_style_sheet(style)) menuitem.set_data("d",style_sheet_list.get_style_sheet(style))
menuitem.show() menuitem.show()
myMenu.append(menuitem) myMenu.append(menuitem)

View File

@ -20,19 +20,13 @@
"Generate files/Relationship graph" "Generate files/Relationship graph"
from RelLib import *
import os import os
import re
import sort
import string
import utils import utils
import intl import intl
_ = intl.gettext _ = intl.gettext
from gtk import * import libglade
from gnome.ui import *
from libglade import *
active_person = None active_person = None
db = None db = None
@ -126,7 +120,7 @@ def report(database,person):
"on_ok_clicked" : on_ok_clicked, "on_ok_clicked" : on_ok_clicked,
} }
topDialog = GladeXML(glade_file,"top") topDialog = libglade.GladeXML(glade_file,"top")
topDialog.signal_autoconnect(dic) topDialog.signal_autoconnect(dic)
top = topDialog.get_widget("top") top = topDialog.get_widget("top")
@ -200,12 +194,11 @@ def on_ok_clicked(obj):
file.close() file.close()
utils.destroy_passed_object(obj) utils.destroy_passed_object(obj)
######################################################################### #------------------------------------------------------------------------
# #
# Write a web page for a specific person represented by the key
# #
######################################################################### #
#------------------------------------------------------------------------
def dump_person(person_list,file): def dump_person(person_list,file):
for person in person_list: for person in person_list:
family = person.getMainFamily() family = person.getMainFamily()
@ -218,12 +211,12 @@ def dump_person(person_list,file):
if mother and mother in person_list: if mother and mother in person_list:
file.write('p%s -> p%s;\n' % (person.getId(), mother.getId())) file.write('p%s -> p%s;\n' % (person.getId(), mother.getId()))
#########################################################################
#
# Write a web page for a specific person represented by the key
#
#########################################################################
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def dump_index(person_list,file): def dump_index(person_list,file):
for person in person_list: for person in person_list:

View File

@ -23,8 +23,6 @@
import RelLib import RelLib
import const import const
import os import os
import re
import sort
import string import string
import utils import utils
import Config import Config
@ -36,9 +34,8 @@ from TextDoc import *
from StyleEditor import * from StyleEditor import *
import FindDoc import FindDoc
from gtk import * import gtk
from gnome.ui import * import libglade
from libglade import *
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -334,7 +331,6 @@ def report(database,person):
global active_person global active_person
global topDialog global topDialog
global glade_file
global db global db
global style_sheet_list global style_sheet_list
@ -344,9 +340,8 @@ def report(database,person):
active_person = person active_person = person
db = database db = database
base = os.path.dirname(__file__) glade_file = "%s/indsum.glade" % os.path.dirname(__file__)
glade_file = base + os.sep + "indsum.glade" topDialog = libglade.GladeXML(glade_file,"dialog1")
topDialog = GladeXML(glade_file,"dialog1")
topDialog.get_widget("fileentry1").set_default_path(Config.report_dir) topDialog.get_widget("fileentry1").set_default_path(Config.report_dir)
name = person.getPrimaryName().getRegularName() name = person.getPrimaryName().getRegularName()
@ -407,9 +402,9 @@ def report(database,person):
def build_menu(object): def build_menu(object):
menu = topDialog.get_widget("style_menu") menu = topDialog.get_widget("style_menu")
myMenu = GtkMenu() myMenu = gtk.GtkMenu()
for style in style_sheet_list.get_style_names(): for style in style_sheet_list.get_style_names():
menuitem = GtkMenuItem(style) menuitem = gtk.GtkMenuItem(style)
menuitem.set_data("d",style_sheet_list.get_style_sheet(style)) menuitem.set_data("d",style_sheet_list.get_style_sheet(style))
menuitem.show() menuitem.show()
myMenu.append(menuitem) myMenu.append(menuitem)

View File

@ -30,8 +30,6 @@ _ = intl.gettext
from gnome.ui import * from gnome.ui import *
import libglade import libglade
import RelLib
import utils
_title_re = re.compile(r"^([A-Za-z][A-Za-z]+\.)\s+(.*)$") _title_re = re.compile(r"^([A-Za-z][A-Za-z]+\.)\s+(.*)$")
_nick_re = re.compile(r"(.+)[(\"](.*)[)\"]") _nick_re = re.compile(r"(.+)[(\"](.*)[)\"]")

View File

@ -499,7 +499,6 @@ class GedcomWriter:
closebtn.set_sensitive(1) closebtn.set_sensitive(1)
def export_data(self,filename): def export_data(self,filename):
try: try:
self.g = open(filename,"w") self.g = open(filename,"w")
except IOError,msg: except IOError,msg:
@ -572,6 +571,13 @@ class GedcomWriter:
gtk.mainiteration() gtk.mainiteration()
self.pbar.set_value(100.0) self.pbar.set_value(100.0)
self.write_families()
self.write_sources()
self.g.write("0 TRLR\n")
self.g.close()
def write_families(self):
nump = float(len(self.flist)) nump = float(len(self.flist))
index = 0.0 index = 0.0
for family in self.flist: for family in self.flist:
@ -628,6 +634,7 @@ class GedcomWriter:
gtk.mainiteration() gtk.mainiteration()
self.fbar.set_value(100.0) self.fbar.set_value(100.0)
def write_sources(self):
nump = float(len(self.slist)) nump = float(len(self.slist))
index = 0.0 index = 0.0
for source in self.slist: for source in self.slist:
@ -650,9 +657,6 @@ class GedcomWriter:
gtk.mainiteration() gtk.mainiteration()
self.sbar.set_value(100.0) self.sbar.set_value(100.0)
self.g.write("0 TRLR\n")
self.g.close()
def write_person(self,person): def write_person(self,person):
self.g.write("0 @%s@ INDI\n" % self.pid(person.getId())) self.g.write("0 @%s@ INDI\n" % self.pid(person.getId()))