From bb516839b2602dda44b4a39860fd6d727ef84521 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 1 Nov 2001 20:55:44 +0000 Subject: [PATCH] Added parishes to places, fixed several things from pychecker svn: r537 --- gramps/src/Date.py | 2 +- gramps/src/EditPlace.py | 10 ++ gramps/src/EditSource.py | 4 +- gramps/src/GrampsParser.py | 9 +- gramps/src/LocEdit.py | 12 +- gramps/src/MediaView.py | 10 +- gramps/src/PlaceView.py | 23 ++-- gramps/src/RelLib.py | 10 ++ gramps/src/SourceView.py | 8 +- gramps/src/WriteXML.py | 8 +- gramps/src/dialog.glade | 76 +++++++++-- gramps/src/gramps.glade | 69 ++++++++++ gramps/src/gramps_main.py | 16 +-- gramps/src/places.glade | 254 ++++++++++++++++++++++++++++--------- 14 files changed, 397 insertions(+), 114 deletions(-) diff --git a/gramps/src/Date.py b/gramps/src/Date.py index ae1f0cdfa..f15b86ffc 100644 --- a/gramps/src/Date.py +++ b/gramps/src/Date.py @@ -112,7 +112,7 @@ class Date: return compare_dates(self,other) < 0 def equal_to(self,other): - return compare_dates(other) == 0 + return compare_dates(self,other) == 0 #-------------------------------------------------------------------- # diff --git a/gramps/src/EditPlace.py b/gramps/src/EditPlace.py index 8ffeef428..620313123 100644 --- a/gramps/src/EditPlace.py +++ b/gramps/src/EditPlace.py @@ -76,6 +76,7 @@ class EditPlace: self.gallery = ImageSelect.Gallery(place, self.path, idval, plwidget, db) self.title = self.top_window.get_widget("place_title") self.city = self.top_window.get_widget("city") + self.parish = self.top_window.get_widget("parish") self.county = self.top_window.get_widget("county") self.state = self.top_window.get_widget("state") self.country = self.top_window.get_widget("country") @@ -92,6 +93,7 @@ class EditPlace: self.loc_city = self.top_window.get_widget("loc_city") self.loc_county = self.top_window.get_widget("loc_county") self.loc_state = self.top_window.get_widget("loc_state") + self.loc_parish = self.top_window.get_widget("loc_parish") self.loc_country = self.top_window.get_widget("loc_country") self.lists_changed = 0 @@ -103,6 +105,7 @@ class EditPlace: self.city.set_text(mloc.get_city()) self.county.set_text(mloc.get_county()) self.state.set_text(mloc.get_state()) + self.parish.set_text(mloc.get_parish()) self.country.set_text(mloc.get_country()) self.longitude.set_text(place.get_longitude()) self.latitude.set_text(place.get_latitude()) @@ -138,6 +141,7 @@ class EditPlace: # Typing CR selects OK button self.top.editable_enters(self.title); self.top.editable_enters(self.city); + self.top.editable_enters(self.parish); self.top.editable_enters(self.county); self.top.editable_enters(self.state); self.top.editable_enters(self.country); @@ -183,6 +187,7 @@ class EditPlace: city = self.city.get_text() county = self.county.get_text() state = self.state.get_text() + parish = self.parish.get_text() country = self.country.get_text() longitude = self.longitude.get_text() latitude = self.latitude.get_text() @@ -193,6 +198,10 @@ class EditPlace: mloc.set_city(city) utils.modified() + if parish != mloc.get_parish(): + mloc.set_parish(parish) + utils.modified() + if self.lists_changed: self.place.setSourceRefList(self.srcreflist) utils.modified() @@ -297,6 +306,7 @@ class EditPlace: self.loc_city.set_text(loc.get_city()) self.loc_county.set_text(loc.get_county()) self.loc_state.set_text(loc.get_state()) + self.loc_parish.set_text(loc.get_parish()) self.loc_country.set_text(loc.get_country()) def display_references(self): diff --git a/gramps/src/EditSource.py b/gramps/src/EditSource.py index e8b384df8..2dfd92a63 100644 --- a/gramps/src/EditSource.py +++ b/gramps/src/EditSource.py @@ -153,7 +153,7 @@ class EditSource: for v in p.getEventList(): for sref in v.getSourceRefList(): if sref.getBase() == self.source: - f_event_list.append((n,v.getName())) + f_event_list.append((name,v.getName())) for v in p.getAttributeList(): for sref in v.getSourceRefList(): if sref.getBase() == self.source: @@ -188,7 +188,7 @@ class EditSource: if len(m_list) > 0: add(_("Media Objects")) add("\n-----------------------------\n") - for p in m_event_list: + for p in m_list: add("%s\n" % m) if len(m_list) > 0: add(_("Places")) diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py index 812b0135f..3885e8220 100644 --- a/gramps/src/GrampsParser.py +++ b/gramps/src/GrampsParser.py @@ -180,6 +180,8 @@ class GrampsParser(handler.ContentHandler): loc = Location() if attrs.has_key('city'): loc.set_city(u2l(attrs['city'])) + if attrs.has_key('parish'): + loc.set_parish(u2l(attrs['parish'])) if attrs.has_key('state'): loc.set_state(u2l(attrs['state'])) if attrs.has_key('county'): @@ -1204,11 +1206,14 @@ def build_place_title(loc): state = loc.get_state() country = loc.get_country() county = loc.get_county() - + parish = loc.get_parish() + value = "" + if parish: + value = parish if city: - value = city + value = append_value(value,city) if county: value = append_value(value,county) if state: diff --git a/gramps/src/LocEdit.py b/gramps/src/LocEdit.py index d0b541fba..19b2b918b 100644 --- a/gramps/src/LocEdit.py +++ b/gramps/src/LocEdit.py @@ -62,11 +62,13 @@ class LocationEditor: self.window = self.top.get_widget("loc_edit") self.city = self.top.get_widget("city") self.state = self.top.get_widget("state") + self.parish = self.top.get_widget("parish") self.county = self.top.get_widget("county") self.country = self.top.get_widget("country") # Typing CR selects OK button self.window.editable_enters(self.city); + self.window.editable_enters(self.parish); self.window.editable_enters(self.county); self.window.editable_enters(self.state); self.window.editable_enters(self.country); @@ -83,6 +85,7 @@ class LocationEditor: self.county.set_text(location.get_county()) self.country.set_text(location.get_country()) self.state.set_text(location.get_state()) + self.parish.set_text(location.get_parish()) self.window.set_data("o",self) self.top.signal_autoconnect({ @@ -97,21 +100,26 @@ class LocationEditor: county = self.county.get_text() country = self.country.get_text() state = self.state.get_text() + parish = self.parish.get_text() if self.location == None: self.location = Location() self.parent.llist.append(self.location) - self.update_location(city,county,state,country) + self.update_location(city,parish,county,state,country) self.parent.redraw_location_list() utils.destroy_passed_object(obj) - def update_location(self,city,county,state,country): + def update_location(self,city,parish,county,state,country): if self.location.get_city() != city: self.location.set_city(city) self.parent.lists_changed = 1 + if self.location.get_parish() != parish: + self.location.set_parish(parish) + self.parent.lists_changed = 1 + if self.location.get_county() != county: self.location.set_county(county) self.parent.lists_changed = 1 diff --git a/gramps/src/MediaView.py b/gramps/src/MediaView.py index 8a01e8a63..76e95799c 100644 --- a/gramps/src/MediaView.py +++ b/gramps/src/MediaView.py @@ -29,6 +29,7 @@ from RelLib import * import intl import utils import const +import os _ = intl.gettext @@ -127,10 +128,9 @@ class MediaView: index = self.media_list.selection[0] mobj = self.media_list.get_row_data(index) if self.is_media_object_used(mobj): - import ImageSelect - ans = ImageSelect.DeleteMediaQuery(mobj,database,self.update) + ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.update) msg = _("This media object is currently being used. Delete anyway?") - GnomeQuestionDialog(msg,ans.query_response) + gnome.ui.GnomeQuestionDialog(msg,ans.query_response) else: map = self.db.getObjectMap() del map[mobj.getId()] @@ -177,9 +177,9 @@ class MediaView: photo.setDescription(description) self.db.addObject(photo) utils.modified() - w.drag_finish(context, TRUE, FALSE, time) + w.drag_finish(context, 1, 0, time) self.load_media() else: - w.drag_finish(context, FALSE, FALSE, time) + w.drag_finish(context, 0, 0, time) diff --git a/gramps/src/PlaceView.py b/gramps/src/PlaceView.py index 1069dadad..7c2f406ee 100644 --- a/gramps/src/PlaceView.py +++ b/gramps/src/PlaceView.py @@ -26,6 +26,7 @@ import string from RelLib import * import EditPlace +import utils import intl _ = intl.gettext @@ -38,24 +39,27 @@ class PlaceView: self.place_arrow = glade.get_widget("place_arrow") self.place_id_arrow= glade.get_widget("place_id_arrow") self.city_arrow = glade.get_widget("city_arrow") + self.parish_arrow = glade.get_widget("parish_arrow") self.county_arrow = glade.get_widget("county_arrow") self.state_arrow = glade.get_widget("state_arrow") self.country_arrow = glade.get_widget("country_arrow") self.update_display= update - self.place_arrows = [ self.place_arrow, self.place_id_arrow, self.city_arrow, - self.county_arrow, self.state_arrow, self.country_arrow ] + self.place_arrows = [ self.place_arrow, self.place_id_arrow, self.parish_arrow, + self.city_arrow, self.county_arrow, self.state_arrow, + self.country_arrow ] self.sort_column = 0 self.sort_direct = GTK.SORT_ASCENDING - self.place_list.set_column_visibility(6,0) self.place_list.set_column_visibility(7,0) self.place_list.set_column_visibility(8,0) self.place_list.set_column_visibility(9,0) self.place_list.set_column_visibility(10,0) self.place_list.set_column_visibility(11,0) - self.place_list.set_sort_column(self.sort_column+6) + self.place_list.set_column_visibility(12,0) + self.place_list.set_column_visibility(13,0) + self.place_list.set_sort_column(self.sort_column+7) self.place_list.set_sort_type(self.sort_direct) def load_places(self): @@ -78,10 +82,11 @@ class PlaceView: city = mloc.get_city() county = mloc.get_county() state = mloc.get_state() + parish = mloc.get_parish() country = mloc.get_country() - self.place_list.append([title,id,city,county,state,country, - u(title), u(id), u(city), u(county), - u(state), u(country)]) + self.place_list.append([title,id,parish,city,county,state,country, + u(title), u(id), u(parish), u(city), + u(county),u(state), u(country)]) self.place_list.set_row_data(index,src) index = index + 1 @@ -108,7 +113,7 @@ class PlaceView: if len(obj.selection) > 0: index = obj.selection[0] place = obj.get_row_data(index) - EditPlace.EditPlace(place,self.db,update_display_after_edit) + EditPlace.EditPlace(place,self.db,self.update_display_after_edit) def on_click_column(self,obj,column): obj.freeze() @@ -132,7 +137,7 @@ class PlaceView: arrow.set(GTK.ARROW_DOWN,2) self.sort_column = column self.place_list.set_sort_type(self.sort_direct) - self.place_list.set_sort_column(self.sort_column + 6) + self.place_list.set_sort_column(self.sort_column + 7) arrow.show() self.place_list.sort() if sel: diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index 04400d5f1..73e13c599 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -287,11 +287,13 @@ class Location: """creates a Location object, copying from the source object if it exists""" if source: self.city = source.city + self.parish = source.parish self.county = source.county self.state = source.state self.country = source.country else: self.city = "" + self.parish = "" self.county = "" self.state = "" self.country = "" @@ -307,6 +309,14 @@ class Location: """returns the city name of the Location object""" return self.city + def set_parish(self,data): + """sets the religious parish name""" + self.parish = data + + def get_parish(self): + """gets the religious parish name""" + return self.parish + def set_county(self,data): """sets the county name of the Location object""" self.county = data diff --git a/gramps/src/SourceView.py b/gramps/src/SourceView.py index 5fc5a49b4..431e5716e 100644 --- a/gramps/src/SourceView.py +++ b/gramps/src/SourceView.py @@ -63,14 +63,12 @@ class SourceView: if len(obj.selection) > 0: index = obj.selection[0] source = obj.get_row_data(index) - EditSource.EditSource(source,self.db,update_display_after_edit) + EditSource.EditSource(source,self.db,self.update_display_after_edit) def on_add_source_clicked(self,obj): EditSource.EditSource(Source(),self.db,self.new_source_after_edit) def on_delete_source_clicked(self,obj): - import EditSource - if len(obj.selection) == 0: return else: @@ -80,8 +78,8 @@ class SourceView: if self.is_source_used(source): msg = _("This source is currently being used. Delete anyway?") - ans = EditSource.DelSrcQuery(source,database,update_display) - GnomeQuestionDialog(msg,ans.query_response) + ans = EditSource.DelSrcQuery(source,self.db,self.update) + gnome.ui.GnomeQuestionDialog(msg,ans.query_response) else: map = self.db.getSourceMap() del map[source.getId()] diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index 8cb8eb290..6d0a134dd 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -233,6 +233,7 @@ def append_value(orig,val): def build_place_title(loc): "Builds a title from a location" city = fix(loc.get_city()) + parish = fix(loc.get_parish()) state = fix(loc.get_state()) country = fix(loc.get_country()) county = fix(loc.get_county()) @@ -241,6 +242,8 @@ def build_place_title(loc): if city: value = city + if parish: + value = append_value(value,parish) if county: value = append_value(value,county) if state: @@ -252,16 +255,19 @@ def build_place_title(loc): def dump_location(g,loc): "Writes the location information to the output file" city = fix(loc.get_city()) + parish = fix(loc.get_parish()) state = fix(loc.get_state()) country = fix(loc.get_country()) county = fix(loc.get_county()) - if not city and not state and not county and not country: + if not city and not state and not parish and not county and not country: return g.write(' GtkTable table23 - 4 + 5 2 False 0 @@ -1082,8 +1082,8 @@ 0 1 - 1 - 2 + 2 + 3 0 0 False @@ -1108,8 +1108,8 @@ 0 1 - 3 - 4 + 4 + 5 0 0 False @@ -1134,8 +1134,8 @@ 0 1 - 2 - 3 + 3 + 4 0 0 False @@ -1158,8 +1158,8 @@ 1 2 - 1 - 2 + 2 + 3 3 3 True @@ -1207,8 +1207,8 @@ 1 2 - 2 - 3 + 3 + 4 3 3 True @@ -1231,8 +1231,58 @@ 1 2 - 3 - 4 + 4 + 5 + 3 + 3 + True + False + False + False + True + False + + + + + GtkLabel + label184 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + parish + True + True + True + 0 + + + 1 + 2 + 1 + 2 3 3 True diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index a3503c029..a20dec927 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -2587,6 +2587,62 @@ + + GtkHBox + CList:title + hbox45p + True + 0 + + + GtkHBox + hbox46 + False + 0 + + 0 + False + False + + + + GtkLabel + CList:title + label284p + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkArrow + parish_arrow + 10 + 10 + False + GTK_ARROW_DOWN + GTK_SHADOW_OUT + 0.5 + 0.5 + 0 + 0 + + 5 + False + True + + + + GtkHBox CList:title @@ -2828,6 +2884,19 @@ 0 + + GtkLabel + CList:title + label276p + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + GtkLabel CList:title diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index de52e515e..b49d03d0d 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -66,14 +66,10 @@ import utils import Bookmarks import ListColors import Config -import EditSource import EditPerson -import EditPlace import Marriage import Find import VersionControl -import RelImage -import ImageSelect #------------------------------------------------------------------------- # @@ -99,6 +95,7 @@ alt2col = {} pedigree_view = None place_view = None media_view = None +source_view = None bookmarks = None topWindow = None @@ -115,8 +112,6 @@ dateArrow = None merge_button = None sort_column = 5 sort_direct = SORT_ASCENDING -p_sort_column = 0 -p_sort_direct = SORT_ASCENDING DataFilter = Filter.Filter("") c_birth_order = 0 c_name = 1 @@ -125,6 +120,8 @@ c_birth_date = 4 c_details = 6 c_sort_column = c_birth_order c_sort_direct = SORT_ASCENDING +cNameArrow = None +cDateArrow = None #------------------------------------------------------------------------- # @@ -542,7 +539,6 @@ def on_ok_button2_clicked(obj): #------------------------------------------------------------------------- def save_file(filename,comment): import WriteXML - import VersionControl path = filename filename = os.path.normpath(filename) @@ -1096,7 +1092,7 @@ def on_save_activate(obj): def on_save_activate_quit(): """Saves the file, first prompting for a comment if revision control needs it""" if not database.getSavePath(): - on_save_as_activate(obj) + on_save_as_activate(None) else: if Config.usevc and Config.vc_comment: display_comment_box(database.getSavePath()) @@ -1105,7 +1101,6 @@ def on_save_activate_quit(): def display_comment_box(filename): """Displays a dialog box, prompting for a revison control comment""" - import VersionControl VersionControl.RevisionComment(filename,save_file) #------------------------------------------------------------------------- @@ -1849,11 +1844,10 @@ def main(arg): global pedigree_view, place_view, source_view, media_view global database, gtop global statusbar,notebook - global person_list, source_list, canvas + global person_list global topWindow, preview, merge_button global nameArrow, dateArrow, deathArrow, idArrow global cNameArrow, cDateArrow -# global mid, mtype, mdesc, mpath, mdetails rc_parse(const.gtkrcFile) database = RelDataBase() diff --git a/gramps/src/places.glade b/gramps/src/places.glade index 026a03b93..93e53ac52 100644 --- a/gramps/src/places.glade +++ b/gramps/src/places.glade @@ -156,7 +156,7 @@ GtkTable table19 - 8 + 9 3 False 0 @@ -227,8 +227,8 @@ 0 1 - 3 - 4 + 4 + 5 0 0 False @@ -253,8 +253,8 @@ 0 1 - 2 - 3 + 3 + 4 0 0 False @@ -279,8 +279,8 @@ 0 1 - 4 - 5 + 5 + 6 0 0 False @@ -305,8 +305,8 @@ 0 1 - 5 - 6 + 6 + 7 0 0 False @@ -331,8 +331,8 @@ 0 1 - 6 - 7 + 7 + 8 0 0 False @@ -357,8 +357,8 @@ 0 1 - 7 - 8 + 8 + 9 0 0 False @@ -381,8 +381,8 @@ 1 2 - 7 - 8 + 8 + 9 5 5 True @@ -451,30 +451,6 @@ True 0 - - 1 - 3 - 2 - 3 - 5 - 5 - True - False - False - False - True - False - - - - - GtkEntry - state - True - True - True - 0 - 1 3 @@ -493,7 +469,7 @@ GtkEntry - country + state True True True @@ -517,7 +493,7 @@ GtkEntry - longitude + country True True True @@ -541,7 +517,7 @@ GtkEntry - latitude + longitude True True True @@ -563,6 +539,30 @@ + + GtkEntry + latitude + True + True + True + 0 + + + 1 + 3 + 7 + 8 + 5 + 5 + True + False + False + False + True + False + + + GtkButton button119 @@ -578,8 +578,8 @@ 2 3 - 7 - 8 + 8 + 9 5 0 False @@ -590,6 +590,56 @@ False + + + GtkLabel + label279 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + parish + True + True + True + 0 + + + 1 + 3 + 2 + 3 + 5 + 5 + True + False + False + False + True + False + + @@ -627,7 +677,7 @@ GtkTable table21 - 4 + 5 3 False 0 @@ -646,8 +696,8 @@ 0 1 - 1 - 2 + 2 + 3 0 0 False @@ -698,8 +748,8 @@ 2 3 - 1 - 2 + 2 + 3 3 3 False @@ -724,8 +774,8 @@ 0 1 - 2 - 3 + 3 + 4 0 0 False @@ -750,8 +800,8 @@ 0 1 - 3 - 4 + 4 + 5 0 0 False @@ -776,8 +826,8 @@ 2 3 - 2 - 3 + 3 + 4 3 3 False @@ -802,8 +852,8 @@ 2 3 - 3 - 4 + 4 + 5 3 3 False @@ -854,8 +904,8 @@ 1 2 - 1 - 2 + 2 + 3 0 0 False @@ -880,8 +930,8 @@ 1 2 - 2 - 3 + 3 + 4 0 0 False @@ -906,8 +956,8 @@ 1 2 - 3 - 4 + 4 + 5 0 0 False @@ -944,6 +994,84 @@ False + + + GtkLabel + label280 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label281 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + loc_parish + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 1 + 2 + 3 + 3 + False + False + False + False + True + False + +