From a624fc2fdee1fd65de21ef93f1312fcef8a05878 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 2 Jun 2005 04:30:04 +0000 Subject: [PATCH] Update svn: r4755 --- gramps2/src/EditRepository.py | 10 +++++----- gramps2/src/ListModel.py | 2 +- gramps2/src/RelLib.py | 16 ++++++++++++++-- gramps2/src/RepositoryRefEdit.py | 16 +++++++++++----- gramps2/src/Utils.py | 14 ++++++++++++++ gramps2/src/gramps.glade | 33 +++++++++++++++----------------- 6 files changed, 60 insertions(+), 31 deletions(-) diff --git a/gramps2/src/EditRepository.py b/gramps2/src/EditRepository.py index e730e2b7e..c28ac5fbd 100644 --- a/gramps2/src/EditRepository.py +++ b/gramps2/src/EditRepository.py @@ -303,10 +303,10 @@ class EditRepository: self.name.set_editable(mode) self.type = self.top_window.get_widget("repository_type") - AutoComp.fill_combo(self.type,[ repos_type for repos_type \ - in self.db.get_repository_type_list() \ - if repos_type != '' ]) - self.type.child.set_text(repository.get_type()) + self.type_selector = AutoComp.StandardCustomSelector( \ + Utils.repository_types,self.type, + RelLib.Repository.CUSTOM,RelLib.Repository.LIBRARY) + self.type_selector.set_values(repository.get_type()) self.street = self.top_window.get_widget("repository_street") self.street.set_text(repository.get_address().get_parish()) @@ -493,7 +493,7 @@ class EditRepository: if name != self.repository.get_name(): self.repository.set_name(name) - repos_type = unicode(self.type.child.get_text()) + repos_type = self.type_selector.get_values() if repos_type != self.repository.get_type(): self.repository.set_type(repos_type) diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index 9bd13cfaa..f8b5937ff 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -42,7 +42,7 @@ class ListModel: self.mylist = [] self.data_index = 0 for l in dlist: - if l[3] == TOGGLE: + if l[2] == TOGGLE: self.mylist.append(TYPE_BOOLEAN) else: self.mylist.append(TYPE_STRING) diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index ccb8fbdbf..6b812c5f8 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -4389,11 +4389,23 @@ class RepoRef(BaseObject,NoteBase): class Repository(PrimaryObject,NoteBase): """A location where collections of Sources are found""" + UNKNOWN = -1 + CUSTOM = 0 + LIBRARY = 1 + CEMETERY = 2 + CHURCH = 3 + ARCHIVE = 4 + ALBUM = 5 + WEBSITE = 6 + BOOKSTORE = 7 + COLLECTION = 8 + SAFE = 9 + def __init__(self): """creates a new Repository instance""" PrimaryObject.__init__(self) NoteBase.__init__(self) - self.type = "" + self.type = (Repository.LIBRARY,"") self.name = "" self.address = Location() self.email = "" @@ -4424,7 +4436,7 @@ class Repository(PrimaryObject,NoteBase): @return: Returns the list of all textual attributes of the object. @rtype: list """ - return [self.name,self.email,self.search_url,self.home_url] + return [self.name,self.type[1],self.email,self.search_url,self.home_url] def get_text_data_child_list(self): """ diff --git a/gramps2/src/RepositoryRefEdit.py b/gramps2/src/RepositoryRefEdit.py index 781879119..65a772343 100644 --- a/gramps2/src/RepositoryRefEdit.py +++ b/gramps2/src/RepositoryRefEdit.py @@ -51,7 +51,7 @@ import Date import DateEdit import DateHandler import GrampsDBCallback - +import AutoComp #------------------------------------------------------------------------- @@ -103,6 +103,9 @@ class RepositoryRefEditBase: self.media_type = self.get_widget("repos_ref_media_type") + self.media_type_selector = AutoComp.StandardCustomSelector( \ + Utils.source_media_types,self.media_type, + RelLib.RepoRef.CUSTOM,RelLib.RepoRef.MANUSCRIPT) self.call_number = self.get_widget("repos_ref_callnumber") self.note = self.get_widget("repos_ref_note") @@ -228,9 +231,9 @@ class RepositoryRefEdit(RepositoryRefEditBase): repos = self.db.get_repository_from_handle(idval) self.active_repos = repos if repos: - self.type.set_text(repos.get_type()) - else: - self.type.set_text("") + self.type.set_text(repos.get_type()[1]) + else: + self.type.set_text("") self.active_repos = sel if sel: @@ -272,6 +275,9 @@ class RepositoryRefEdit(RepositoryRefEditBase): self.repos_ref.set_reference_handle(self.active_repos.get_handle()) # handle type here. + the_type = self.media_type_selector.get_values() + if the_type != self.repos_ref.get_media_type(): + self.repos_ref.set_media_type(the_type) buf = self.note.get_buffer() note = unicode(buf.get_text(buf.get_start_iter(), @@ -289,7 +295,7 @@ class RepositoryRefEdit(RepositoryRefEditBase): def on_source_changed(self,obj): handle = self.handle_list[obj.get_active()] self.active_repos = self.db.get_repository_from_handle(handle) - self.type.set_text(self.active_repos.get_type()) + self.type.set_text(self.active_repos.get_type()[1]) self.set_button() pass diff --git a/gramps2/src/Utils.py b/gramps2/src/Utils.py index 78737a473..6247dc3a1 100644 --- a/gramps2/src/Utils.py +++ b/gramps2/src/Utils.py @@ -214,6 +214,20 @@ event_roles = { RelLib.EventRef.GROOM : _("Groom"), RelLib.EventRef.WITNESS : _("Witness"), } + +repository_types = { + RelLib.Repository.UNKNOWN : _("Unknown"), + RelLib.Repository.CUSTOM : _("Custom"), + RelLib.Repository.LIBRARY : _("Library"), + RelLib.Repository.CEMETERY : _("Cemetery"), + RelLib.Repository.CHURCH : _("Church"), + RelLib.Repository.ARCHIVE : _("Archive"), + RelLib.Repository.ALBUM : _("Album"), + RelLib.Repository.WEBSITE : _("Web site"), + RelLib.Repository.BOOKSTORE : _("Bookstore"), + RelLib.Repository.COLLECTION : _("Collection"), + RelLib.Repository.SAFE : _("Safe"), + } #------------------------------------------------------------------------- # # Integer to GEDCOM tag mappings for constants diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index 79f0fbb0f..3c27f37cd 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -34059,24 +34059,6 @@ Family name Given name - - - True - Very Low -Low -Normal -High -Very High - - - 2 - 4 - 5 - 6 - fill - - - True @@ -34097,6 +34079,20 @@ Very High + + + + True + + + 2 + 4 + 5 + 6 + fill + fill + + 0 @@ -34928,6 +34924,7 @@ Very High 0.5 0 0 + er_sel_button 1