From b3fda053d7a0908429238ea1f01e4589e095288c Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 28 Nov 2001 04:17:52 +0000 Subject: [PATCH] Clean up from pychecker. svn: r592 --- gramps/src/ImageSelect.py | 25 +++--- gramps/src/MediaView.py | 1 - gramps/src/WriteXML.py | 9 -- gramps/src/gramps.py | 1 + gramps/src/gramps_main.py | 106 +++++++++++------------ gramps/src/plugins/AncestorChart.py | 12 ++- gramps/src/plugins/AncestorReport.py | 17 ++-- gramps/src/plugins/ChangeTypes.py | 10 +-- gramps/src/plugins/Check.py | 12 +-- gramps/src/plugins/Desbrowser.py | 12 +-- gramps/src/plugins/DescendReport.py | 14 ++- gramps/src/plugins/DetAncestralReport.py | 14 +-- gramps/src/plugins/EventCmp.py | 22 ++--- gramps/src/plugins/FamilyGroup.py | 22 ++--- gramps/src/plugins/GraphViz.py | 27 +++--- gramps/src/plugins/IndivSummary.py | 17 ++-- gramps/src/plugins/PatchNames.py | 2 - gramps/src/plugins/WriteGedcom.py | 12 ++- 18 files changed, 149 insertions(+), 186 deletions(-) diff --git a/gramps/src/ImageSelect.py b/gramps/src/ImageSelect.py index d6f99e223..882418229 100644 --- a/gramps/src/ImageSelect.py +++ b/gramps/src/ImageSelect.py @@ -31,9 +31,10 @@ import string # GTK/Gnome modules # #------------------------------------------------------------------------- -from gtk import * -from gnome.ui import * import GDK +import GTK +import gtk +import gnome.ui import libglade #------------------------------------------------------------------------- @@ -127,7 +128,7 @@ class ImageSelect: description = self.description.get_text() 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 already_imported = None @@ -190,7 +191,7 @@ class Gallery(ImageSelect): ('text/uri-list',0,2), ('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.drag_source_set(GDK.BUTTON1_MASK|GDK.BUTTON3_MASK,t,\ @@ -281,7 +282,7 @@ class Gallery(ImageSelect): except IOError, msg: 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 mime = utils.get_mime_type(tfile) photo = Photo() @@ -300,7 +301,7 @@ class Gallery(ImageSelect): photo.setPath(name) except: photo.setPath(tfile) - w.drag_finish(context, TRUE, FALSE, time) + w.drag_finish(context, 1, 0, time) return self.add_thumbnail(oref) utils.modified() @@ -310,10 +311,10 @@ class Gallery(ImageSelect): for p in self.dataobj.getPhotoList(): if data.data == p.getReference().getId(): if index == icon_index or icon_index == -1: - w.drag_finish(context, FALSE, FALSE, time) + w.drag_finish(context, 0, 0, time) return else: - w.drag_finish(context, TRUE, FALSE, time) + w.drag_finish(context, 1, 0, time) nl = self.dataobj.getPhotoList() item = nl[index] if icon_index == 0: @@ -332,9 +333,9 @@ class Gallery(ImageSelect): self.dataobj.addPhoto(oref) self.add_thumbnail(oref) utils.modified() - w.drag_finish(context, TRUE, FALSE, time) + w.drag_finish(context, 1, 0, time) 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): if info == 1: @@ -384,8 +385,8 @@ class Gallery(ImageSelect): if event.button == 3: photo = self.dataobj.getPhotoList()[icon] - menu = GtkMenu() - item = GtkTearoffMenuItem() + menu = gtk.GtkMenu() + item = gtk.GtkTearoffMenuItem() item.show() menu.append(item) utils.add_menuitem(menu,_("View in the default viewer"),None,self.popup_view_photo) diff --git a/gramps/src/MediaView.py b/gramps/src/MediaView.py index 41ebfd6fd..f393a2ac7 100644 --- a/gramps/src/MediaView.py +++ b/gramps/src/MediaView.py @@ -26,7 +26,6 @@ import ImageSelect from RelLib import * import utils -import const import os import Config diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index 79dc46a41..30ee9c272 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -196,15 +196,6 @@ def write_line(g,label,value,indent=1): if value: g.write('%s<%s>%s\n' % (' '*indent,label,fix(value),label)) -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- -def write_line(g,label,value,indent=1): - if value: - g.write('%s<%s>%s\n' % (' '*indent,label,fix(value),label)) - #------------------------------------------------------------------------- # # diff --git a/gramps/src/gramps.py b/gramps/src/gramps.py index 5db8ea0e1..ffc83709e 100755 --- a/gramps/src/gramps.py +++ b/gramps/src/gramps.py @@ -3,6 +3,7 @@ import traceback import intl import os +import gtk intl.textdomain("gramps") diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index e2b4b8bf1..f05330ace 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -40,8 +40,8 @@ _ = gettext # GTK/Gnome modules # #------------------------------------------------------------------------- -from gtk import * -from gnome.ui import * +import gtk +import gnome.ui import GDK import GTK import libglade @@ -112,7 +112,7 @@ dateArrow = None merge_button = None sort_column = 0 -sort_direct = SORT_ASCENDING +sort_direct = GTK.SORT_ASCENDING DataFilter = Filter.Filter("") c_birth_order = 0 c_name = 1 @@ -120,7 +120,7 @@ c_id = 2 c_birth_date = 4 c_details = 6 c_sort_column = c_birth_order -c_sort_direct = SORT_ASCENDING +c_sort_direct = GTK.SORT_ASCENDING cNameArrow = None cDateArrow = None @@ -160,7 +160,7 @@ def on_merge_activate(obj): if page == 0: if len(person_list.selection) != 2: msg = _("Exactly two people must be selected to perform a merge") - GnomeErrorDialog(msg) + gnome.ui.GnomeErrorDialog(msg) else: import MergeData 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""" widget.hide() on_exit_activate(widget) - return TRUE + return 1 def on_exit_activate(obj): """Prompt to save on exit if needed""" if utils.wasModified(): question = _("Unsaved changes exist in the current database\n") + \ _("Do you wish to save the changes?") - GnomeQuestionDialog(question,save_query) + gnome.ui.GnomeQuestionDialog(question,save_query) else: - mainquit(obj) + gtk.mainquit(obj) def save_query(value): """Catch the reponse to the save on exit question""" if value == 0: on_save_activate_quit() - mainquit(gtop) + gtk.mainquit(gtop) #------------------------------------------------------------------------- # @@ -202,8 +202,8 @@ def save_query(value): #------------------------------------------------------------------------- def on_about_activate(obj): """Displays the about box. Called from Help menu""" - GnomeAbout(const.progName,const.version,const.copyright, - const.authors,const.comments,const.logo).show() + gnome.ui.GnomeAbout(const.progName,const.version,const.copyright, + const.authors,const.comments,const.logo).show() def on_contents_activate(obj): """Display the Gramps manual""" @@ -365,7 +365,7 @@ def on_choose_parents_clicked(obj): def on_new_clicked(obj): """Prompt for permission to close the current database""" 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): """Clear out the database if permission was granted""" @@ -556,13 +556,13 @@ def save_file(filename,comment): try: os.mkdir(filename) except IOError, msg: - GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) + gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) return except OSError, msg: - GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) + gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) return except: - GnomeErrorDialog(_("Could not create %s") % filename) + gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename) return old_file = filename @@ -570,10 +570,10 @@ def save_file(filename,comment): try: WriteXML.exportData(database,filename,load_progress) except IOError, msg: - GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) + gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) return except OSError, msg: - GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) + gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg)) return database.setSavePath(old_file) @@ -596,7 +596,7 @@ def load_selected_people(obj): """Display the selected people in the EditPerson display""" if len(person_list.selection) > 5: msg = _("You requested too many people to edit at the same time") - GnomeErrorDialog(msg) + gnome.ui.GnomeErrorDialog(msg) else: for p in person_list.selection: person = person_list.get_row_data(p) @@ -635,9 +635,9 @@ def load_new_person(obj): def on_delete_person_clicked(obj): if len(person_list.selection) == 1: 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: - 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): if val == 1: @@ -751,7 +751,7 @@ def set_sort_arrow(column,direct): if arrow != a: a.hide() arrow.show() - if direct == SORT_ASCENDING: + if direct == GTK.SORT_ASCENDING: arrow.set(GTK.ARROW_DOWN,2) else: arrow.set(GTK.ARROW_UP,2) @@ -769,14 +769,14 @@ def change_sort(column): arrow.show() if sort_column == column: - if sort_direct == SORT_DESCENDING: - sort_direct = SORT_ASCENDING + if sort_direct == GTK.SORT_DESCENDING: + sort_direct = GTK.SORT_ASCENDING arrow.set(GTK.ARROW_DOWN,2) else: - sort_direct = SORT_DESCENDING + sort_direct = GTK.SORT_DESCENDING arrow.set(GTK.ARROW_UP,2) else: - sort_direct = SORT_ASCENDING + sort_direct = GTK.SORT_ASCENDING arrow.set(GTK.ARROW_DOWN,2) sort_column = column @@ -799,10 +799,10 @@ def sort_person_list(): person_list.sort() if ListColors.get_enable(): try: - oddbg = GdkColor(ListColors.oddbg[0],ListColors.oddbg[1],ListColors.oddbg[2]) - oddfg = GdkColor(ListColors.oddfg[0],ListColors.oddfg[1],ListColors.oddfg[2]) - evenbg = GdkColor(ListColors.evenbg[0],ListColors.evenbg[1],ListColors.evenbg[2]) - evenfg = GdkColor(ListColors.evenfg[0],ListColors.evenfg[1],ListColors.evenfg[2]) + oddbg = gtk.GdkColor(ListColors.oddbg[0],ListColors.oddbg[1],ListColors.oddbg[2]) + oddfg = gtk.GdkColor(ListColors.oddfg[0],ListColors.oddfg[1],ListColors.oddfg[2]) + evenbg = gtk.GdkColor(ListColors.evenbg[0],ListColors.evenbg[1],ListColors.evenbg[2]) + evenfg = gtk.GdkColor(ListColors.evenfg[0],ListColors.evenfg[1],ListColors.evenfg[2]) rows = person_list.rows for i in range(0,rows,2): person_list.set_background(i,oddbg) @@ -933,14 +933,14 @@ def child_change_sort(clist,column,arrow): arrow.show() if c_sort_column == column: - if c_sort_direct == SORT_DESCENDING: - c_sort_direct = SORT_ASCENDING + if c_sort_direct == GTK.SORT_DESCENDING: + c_sort_direct = GTK.SORT_ASCENDING arrow.set(GTK.ARROW_DOWN,2) else: - c_sort_direct = SORT_DESCENDING + c_sort_direct = GTK.SORT_DESCENDING arrow.set(GTK.ARROW_UP,2) else: - c_sort_direct = SORT_ASCENDING + c_sort_direct = GTK.SORT_ASCENDING c_sort_column = column clist.set_sort_type(c_sort_direct) 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 # necessary. - if (c_sort_direct == SORT_DESCENDING): + if (c_sort_direct == GTK.SORT_DESCENDING): clist_order.reverse() max_index = len(clist_order) - 1 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 if (EditPerson.birth_dates_in_order(desired_order) == 0): 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 # 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 # used by the clist itself. - if (c_sort_direct == SORT_DESCENDING): + if (c_sort_direct == GTK.SORT_DESCENDING): clist_order.reverse() # Update the clist indices so any change of sorting works @@ -1061,10 +1061,10 @@ def on_open_activate(obj): def on_revert_activate(obj): if database.getSavePath() != "": 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: 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 if len(family_types) > 0: - typeMenu = GtkMenu() + typeMenu = gtk.GtkMenu() if main_family: - menuitem = GtkMenuItem(_("Birth")) + menuitem = gtk.GtkMenuItem(_("Birth")) menuitem.set_data("parents",main_family) menuitem.connect("activate",on_current_type_changed) menuitem.show() typeMenu.append(menuitem) for fam in family_types: if active_person == fam[0].getFather(): - menuitem = GtkMenuItem("%s/%s" % (fam[1],fam[2])) + menuitem = gtk.GtkMenuItem("%s/%s" % (fam[1],fam[2])) 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.connect("activate",on_current_type_changed) menuitem.show() @@ -1370,7 +1370,7 @@ def load_family(family=None): if active_person: number_of_families = len(active_person.getFamilyList()) if number_of_families > 1: - myMenu = GtkMenu() + myMenu = gtk.GtkMenu() index = 0 opt_index = 0 for f in active_person.getFamilyList(): @@ -1382,7 +1382,7 @@ def load_family(family=None): if f.getMother() != None: person = f.getMother() - menuitem = GtkMenuItem(Config.nameof(person)) + menuitem = gtk.GtkMenuItem(Config.nameof(person)) myMenu.append(menuitem) menuitem.set_data("person",person) menuitem.set_data("family",f) @@ -1573,8 +1573,8 @@ def display_marriage(family): #------------------------------------------------------------------------- def load_progress(value): statusbar.set_progress(value) - while events_pending(): - mainiteration() + while gtk.events_pending(): + gtk.mainiteration() #------------------------------------------------------------------------- # @@ -1678,7 +1678,7 @@ def setup_bookmarks(): # #------------------------------------------------------------------------- def displayError(msg): - GnomeErrorDialog(msg) + gnome.ui.GnomeErrorDialog(msg) statusbar.set_status("") #------------------------------------------------------------------------- @@ -1764,7 +1764,7 @@ def on_home_clicked(obj): change_active_person(temp) update_display(0) 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: name = active_person.getPrimaryName().getRegularName() 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 sort_column, sort_direct - rc_parse(const.gtkrcFile) + gtk.rc_parse(const.gtkrcFile) database = RelDataBase() Plugins.load_plugins(const.pluginsDir) @@ -1927,7 +1927,7 @@ def main(arg): fw.set_sensitive(0) # set the window icon - topWindow.set_icon(GtkPixmap(topWindow,const.icon)) + topWindow.set_icon(gtk.GtkPixmap(topWindow,const.icon)) person_list.column_titles_active() set_sort_arrow(sort_column,sort_direct) @@ -2021,7 +2021,7 @@ def main(arg): database.set_pprefix(Config.pprefix) child_list = gtop.get_widget("child_list") 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: read_file(arg) @@ -2029,7 +2029,7 @@ def main(arg): read_file(Config.lastfile) database.setResearcher(Config.owner) - mainloop() + gtk.mainloop() #------------------------------------------------------------------------- # diff --git a/gramps/src/plugins/AncestorChart.py b/gramps/src/plugins/AncestorChart.py index ff6e7f826..ee6d29b18 100644 --- a/gramps/src/plugins/AncestorChart.py +++ b/gramps/src/plugins/AncestorChart.py @@ -20,13 +20,11 @@ "Generate files/Ancestor Chart" -import RelLib import Config import const import os import string import utils -import Config from FontScale import string_width @@ -35,8 +33,8 @@ from DrawDoc import * from StyleEditor import * import FindDoc -from libglade import * -from gtk import * +import libglade +import gtk import intl _ = intl.gettext @@ -275,7 +273,7 @@ def report(database,person): base = os.path.dirname(__file__) 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) name = person.getPrimaryName().getRegularName() @@ -311,9 +309,9 @@ def report(database,person): def build_menu(object): menu = topDialog.get_widget("style_menu") - myMenu = GtkMenu() + myMenu = gtk.GtkMenu() 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.show() myMenu.append(menuitem) diff --git a/gramps/src/plugins/AncestorReport.py b/gramps/src/plugins/AncestorReport.py index 6c2df57d9..1df177c57 100644 --- a/gramps/src/plugins/AncestorReport.py +++ b/gramps/src/plugins/AncestorReport.py @@ -23,8 +23,6 @@ import RelLib import const import os -import re -import sort import string import utils import Config @@ -37,9 +35,9 @@ from StyleEditor import * import FindDoc -from gtk import * -from gnome.ui import * -from libglade import * +import gtk +import gnome.ui +import libglade #------------------------------------------------------------------------ # @@ -106,7 +104,7 @@ class AncestorReport: try: self.doc.open(output) 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.sort() generation = 0 - need_header = 1 for key in keys : if generation == 0 or key >= 2**generation: @@ -289,7 +286,7 @@ def report(database,person): base = os.path.dirname(__file__) 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) name = person.getPrimaryName().getRegularName() @@ -337,9 +334,9 @@ def report(database,person): def build_menu(object): menu = topDialog.get_widget("style_menu") - myMenu = GtkMenu() + myMenu = gtk.GtkMenu() 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.show() myMenu.append(menuitem) diff --git a/gramps/src/plugins/ChangeTypes.py b/gramps/src/plugins/ChangeTypes.py index 5ad50a2b9..01e8f3649 100644 --- a/gramps/src/plugins/ChangeTypes.py +++ b/gramps/src/plugins/ChangeTypes.py @@ -22,11 +22,9 @@ import os -from gtk import * -from gnome.ui import * -from libglade import * +import gnome.ui +import libglade -import RelLib import const import utils import intl @@ -48,7 +46,7 @@ class ChangeTypes: base = os.path.dirname(__file__) 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("new").set_popdown_strings(const.personalEvents) @@ -79,7 +77,7 @@ class ChangeTypes: else: msg = _("%d event records were modified") % modified - GnomeOkDialog(msg) + gnome.ui.GnomeOkDialog(msg) utils.destroy_passed_object(obj) #------------------------------------------------------------------------ diff --git a/gramps/src/plugins/Check.py b/gramps/src/plugins/Check.py index bbbea3c37..6093cf8ed 100644 --- a/gramps/src/plugins/Check.py +++ b/gramps/src/plugins/Check.py @@ -22,17 +22,13 @@ import RelLib import utils -import soundex -import Config import intl _ = intl.gettext -import string import os -from gtk import * -from gnome.ui import * -from libglade import * +import gnome.ui +import libglade #------------------------------------------------------------------------- # @@ -167,7 +163,7 @@ class CheckIntegrity: errors = blink + efam + photos + rel if errors == 0: - GnomeOkDialog(_("No errors were found")) + gnome.ui.GnomeOkDialog(_("No errors were found")) return text = "" @@ -204,7 +200,7 @@ class CheckIntegrity: base = os.path.dirname(__file__) glade_file = base + os.sep + "summary.glade" - topDialog = GladeXML(glade_file,"summary") + topDialog = libglade.GladeXML(glade_file,"summary") topDialog.signal_autoconnect({ "destroy_passed_object" : utils.destroy_passed_object, }) diff --git a/gramps/src/plugins/Desbrowser.py b/gramps/src/plugins/Desbrowser.py index 56645f076..389e83030 100644 --- a/gramps/src/plugins/Desbrowser.py +++ b/gramps/src/plugins/Desbrowser.py @@ -28,9 +28,9 @@ import Config _ = intl.gettext -from gtk import * -from gnome.ui import * -from libglade import * +import GDK +import gtk +import libglade #------------------------------------------------------------------------ # @@ -49,7 +49,7 @@ class DesBrowse: base = os.path.dirname(__file__) glade_file = base + os.sep + "desbrowse.glade" - self.glade = GladeXML(glade_file,"top") + self.glade = libglade.GladeXML(glade_file,"top") self.glade.signal_autoconnect({ "destroy_passed_object" : utils.destroy_passed_object, }) @@ -60,7 +60,7 @@ class DesBrowse: top.show() def add_to_tree(self,tree,person): - item = GtkTreeItem(Config.nameof(person)) + item = gtk.GtkTreeItem(Config.nameof(person)) item.show() item.connect('button-press-event',self.button_press_event) item.set_data('d',person) @@ -69,7 +69,7 @@ class DesBrowse: for family in person.getFamilyList(): for child in family.getChildList(): if subtree == None: - subtree = GtkTree() + subtree = gtk.GtkTree() subtree.show() item.set_subtree(subtree) self.add_to_tree(subtree,child) diff --git a/gramps/src/plugins/DescendReport.py b/gramps/src/plugins/DescendReport.py index 6cab1266e..04998b666 100644 --- a/gramps/src/plugins/DescendReport.py +++ b/gramps/src/plugins/DescendReport.py @@ -21,25 +21,21 @@ "Generate files/Descendant Report" import os -import re import sort import string import intl _ = intl.gettext -import RelLib import const import Config import utils -import const from TextDoc import * from StyleEditor import * import FindDoc -from gtk import * -from gnome.ui import * -from libglade import * +import gtk +import libglade #------------------------------------------------------------------------ # @@ -133,7 +129,7 @@ class DesReportWindow: self.person = person 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.signal_autoconnect({ "destroy_passed_object" : utils.destroy_passed_object, @@ -182,10 +178,10 @@ class DesReportWindow: #------------------------------------------------------------------------ def build_menu(object): - myMenu = GtkMenu() + myMenu = gtk.GtkMenu() 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.show() myMenu.append(menuitem) diff --git a/gramps/src/plugins/DetAncestralReport.py b/gramps/src/plugins/DetAncestralReport.py index 17b5edd57..d12f26bd5 100644 --- a/gramps/src/plugins/DetAncestralReport.py +++ b/gramps/src/plugins/DetAncestralReport.py @@ -37,9 +37,9 @@ from StyleEditor import * import FindDoc -from gtk import * -from gnome.ui import * -from libglade import * +import gtk +import gnome.ui +import libglade #------------------------------------------------------------------------ # @@ -106,7 +106,7 @@ class DetAncestorReport: try: self.doc.open(output) 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__) glade_file = base + os.sep + "ancestorreport.glade" - topDialog = GladeXML(glade_file,"dialog1") + topDialog = libglade.GladeXML(glade_file,"dialog1") name = person.getPrimaryName().getRegularName() @@ -569,9 +569,9 @@ def report(database,person): def build_menu(object): menu = topDialog.get_widget("style_menu") - myMenu = GtkMenu() + myMenu = gtk.GtkMenu() 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.show() myMenu.append(menuitem) diff --git a/gramps/src/plugins/EventCmp.py b/gramps/src/plugins/EventCmp.py index f7f2d36bf..2653a9fcf 100644 --- a/gramps/src/plugins/EventCmp.py +++ b/gramps/src/plugins/EventCmp.py @@ -26,13 +26,9 @@ # #------------------------------------------------------------------------ import os -import re import sort import utils import string -from gtk import * -from gnome.ui import * -from libglade import * import ListColors import Filter import const @@ -40,6 +36,10 @@ from TextDoc import * from OpenSpreadSheet import * import intl +import gtk +import gnome.ui +import libglade + _ = intl.gettext #------------------------------------------------------------------------ @@ -134,7 +134,7 @@ class EventComparison: xml = os.path.expanduser("~/.gramps/eventcmp.xml") self.interface = ComplexFilterFile(xml) - self.filterDialog = GladeXML(self.glade_file,"filters") + self.filterDialog = libglade.GladeXML(self.glade_file,"filters") self.filterDialog.signal_autoconnect({ "on_add_clicked" : self.on_add_clicked, "on_delete_clicked" : self.on_delete_clicked, @@ -167,7 +167,7 @@ class EventComparison: my_list.append(person) if len(my_list) == 0: - GnomeWarningDialog("No matches were found") + gnome.ui.GnomeWarningDialog("No matches were found") else: DisplayChart(my_list) @@ -207,7 +207,7 @@ class EventComparison: self.filter_list_obj.append([name,qualifier,invert_text]) 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.load_dialog.get_widget("title").set_text("Save complex filter") names = self.interface.get_filter_names() @@ -220,7 +220,7 @@ class EventComparison: }) 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.load_dialog.get_widget("title").set_text("Load complex filter") names = self.interface.get_filter_names() @@ -357,7 +357,7 @@ class DisplayChart: base = os.path.dirname(__file__) 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({ "on_write_table" : self.on_write_table, "destroy_passed_object" : utils.destroy_passed_object @@ -375,7 +375,7 @@ class DisplayChart: 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) eventlist.show() color_clist = ListColors.ColorList(eventlist,2) @@ -458,7 +458,7 @@ class DisplayChart: return [_("Person"),_("Birth"),_("Death")] + sort_list 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({ "on_save_clicked" : self.on_save_clicked, "on_html_toggled" : self.on_html_toggled, diff --git a/gramps/src/plugins/FamilyGroup.py b/gramps/src/plugins/FamilyGroup.py index bcab1c0b0..2cf893bf1 100644 --- a/gramps/src/plugins/FamilyGroup.py +++ b/gramps/src/plugins/FamilyGroup.py @@ -23,7 +23,6 @@ import RelLib import const import os -import re import string import FindDoc import utils @@ -34,9 +33,8 @@ _ = intl.gettext from TextDoc import * from StyleEditor import * -from gtk import * -from gnome.ui import * -from libglade import * +import gtk +import libglade #------------------------------------------------------------------------ # @@ -347,16 +345,14 @@ def report(database,person): global active_person global topDialog - global glade_file global db global style_sheet_list active_person = person db = database - base = os.path.dirname(__file__) - glade_file = base + os.sep + "familygroup.glade" - topDialog = GladeXML(glade_file,"dialog1") + glade_file = "%s/familygroup.glade" % os.path.dirname(__file__) + topDialog = libglade.GladeXML(glade_file,"dialog1") topDialog.get_widget("fileentry1").set_default_path(Config.report_dir) name = person.getPrimaryName().getRegularName() @@ -423,16 +419,16 @@ def report(database,person): else: frame.hide() - my_menu = GtkMenu() + my_menu = gtk.GtkMenu() for family in family_list: if person == family.getFather(): spouse = family.getMother() else: spouse = family.getFather() if spouse: - item = GtkMenuItem(spouse.getPrimaryName().getName()) + item = gtk.GtkMenuItem(spouse.getPrimaryName().getName()) else: - item = GtkMenuItem("unknown") + item = gtk.GtkMenuItem("unknown") item.set_data("f",family) item.show() my_menu.append(item) @@ -454,9 +450,9 @@ def on_style_edit_clicked(obj): def build_menu(object): menu = topDialog.get_widget("style_menu") - myMenu = GtkMenu() + myMenu = gtk.GtkMenu() 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.show() myMenu.append(menuitem) diff --git a/gramps/src/plugins/GraphViz.py b/gramps/src/plugins/GraphViz.py index eb0df2c38..d98fa7830 100644 --- a/gramps/src/plugins/GraphViz.py +++ b/gramps/src/plugins/GraphViz.py @@ -20,19 +20,13 @@ "Generate files/Relationship graph" -from RelLib import * import os -import re -import sort -import string import utils import intl _ = intl.gettext -from gtk import * -from gnome.ui import * -from libglade import * +import libglade active_person = None db = None @@ -126,7 +120,7 @@ def report(database,person): "on_ok_clicked" : on_ok_clicked, } - topDialog = GladeXML(glade_file,"top") + topDialog = libglade.GladeXML(glade_file,"top") topDialog.signal_autoconnect(dic) top = topDialog.get_widget("top") @@ -200,12 +194,11 @@ def on_ok_clicked(obj): file.close() utils.destroy_passed_object(obj) -######################################################################### +#------------------------------------------------------------------------ # -# Write a web page for a specific person represented by the key +# # -######################################################################### - +#------------------------------------------------------------------------ def dump_person(person_list,file): for person in person_list: family = person.getMainFamily() @@ -218,12 +211,12 @@ def dump_person(person_list,file): if mother and mother in person_list: 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): for person in person_list: diff --git a/gramps/src/plugins/IndivSummary.py b/gramps/src/plugins/IndivSummary.py index fc66d5b26..5657e780f 100644 --- a/gramps/src/plugins/IndivSummary.py +++ b/gramps/src/plugins/IndivSummary.py @@ -23,8 +23,6 @@ import RelLib import const import os -import re -import sort import string import utils import Config @@ -36,9 +34,8 @@ from TextDoc import * from StyleEditor import * import FindDoc -from gtk import * -from gnome.ui import * -from libglade import * +import gtk +import libglade #------------------------------------------------------------------------ # @@ -334,7 +331,6 @@ def report(database,person): global active_person global topDialog - global glade_file global db global style_sheet_list @@ -344,9 +340,8 @@ def report(database,person): active_person = person db = database - base = os.path.dirname(__file__) - glade_file = base + os.sep + "indsum.glade" - topDialog = GladeXML(glade_file,"dialog1") + glade_file = "%s/indsum.glade" % os.path.dirname(__file__) + topDialog = libglade.GladeXML(glade_file,"dialog1") topDialog.get_widget("fileentry1").set_default_path(Config.report_dir) name = person.getPrimaryName().getRegularName() @@ -407,9 +402,9 @@ def report(database,person): def build_menu(object): menu = topDialog.get_widget("style_menu") - myMenu = GtkMenu() + myMenu = gtk.GtkMenu() 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.show() myMenu.append(menuitem) diff --git a/gramps/src/plugins/PatchNames.py b/gramps/src/plugins/PatchNames.py index 24233b497..a741af406 100644 --- a/gramps/src/plugins/PatchNames.py +++ b/gramps/src/plugins/PatchNames.py @@ -30,8 +30,6 @@ _ = intl.gettext from gnome.ui import * import libglade -import RelLib -import utils _title_re = re.compile(r"^([A-Za-z][A-Za-z]+\.)\s+(.*)$") _nick_re = re.compile(r"(.+)[(\"](.*)[)\"]") diff --git a/gramps/src/plugins/WriteGedcom.py b/gramps/src/plugins/WriteGedcom.py index 3a4f02f6f..512650307 100644 --- a/gramps/src/plugins/WriteGedcom.py +++ b/gramps/src/plugins/WriteGedcom.py @@ -499,7 +499,6 @@ class GedcomWriter: closebtn.set_sensitive(1) def export_data(self,filename): - try: self.g = open(filename,"w") except IOError,msg: @@ -572,6 +571,13 @@ class GedcomWriter: gtk.mainiteration() 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)) index = 0.0 for family in self.flist: @@ -628,6 +634,7 @@ class GedcomWriter: gtk.mainiteration() self.fbar.set_value(100.0) + def write_sources(self): nump = float(len(self.slist)) index = 0.0 for source in self.slist: @@ -649,9 +656,6 @@ class GedcomWriter: while(gtk.events_pending()): gtk.mainiteration() self.sbar.set_value(100.0) - - self.g.write("0 TRLR\n") - self.g.close() def write_person(self,person): self.g.write("0 @%s@ INDI\n" % self.pid(person.getId()))