svn: r4755
This commit is contained in:
Alex Roitman 2005-06-02 04:30:04 +00:00
parent 015d602722
commit a624fc2fde
6 changed files with 60 additions and 31 deletions

View File

@ -303,10 +303,10 @@ class EditRepository:
self.name.set_editable(mode) self.name.set_editable(mode)
self.type = self.top_window.get_widget("repository_type") self.type = self.top_window.get_widget("repository_type")
AutoComp.fill_combo(self.type,[ repos_type for repos_type \ self.type_selector = AutoComp.StandardCustomSelector( \
in self.db.get_repository_type_list() \ Utils.repository_types,self.type,
if repos_type != '' ]) RelLib.Repository.CUSTOM,RelLib.Repository.LIBRARY)
self.type.child.set_text(repository.get_type()) self.type_selector.set_values(repository.get_type())
self.street = self.top_window.get_widget("repository_street") self.street = self.top_window.get_widget("repository_street")
self.street.set_text(repository.get_address().get_parish()) self.street.set_text(repository.get_address().get_parish())
@ -493,7 +493,7 @@ class EditRepository:
if name != self.repository.get_name(): if name != self.repository.get_name():
self.repository.set_name(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(): if repos_type != self.repository.get_type():
self.repository.set_type(repos_type) self.repository.set_type(repos_type)

View File

@ -42,7 +42,7 @@ class ListModel:
self.mylist = [] self.mylist = []
self.data_index = 0 self.data_index = 0
for l in dlist: for l in dlist:
if l[3] == TOGGLE: if l[2] == TOGGLE:
self.mylist.append(TYPE_BOOLEAN) self.mylist.append(TYPE_BOOLEAN)
else: else:
self.mylist.append(TYPE_STRING) self.mylist.append(TYPE_STRING)

View File

@ -4389,11 +4389,23 @@ class RepoRef(BaseObject,NoteBase):
class Repository(PrimaryObject,NoteBase): class Repository(PrimaryObject,NoteBase):
"""A location where collections of Sources are found""" """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): def __init__(self):
"""creates a new Repository instance""" """creates a new Repository instance"""
PrimaryObject.__init__(self) PrimaryObject.__init__(self)
NoteBase.__init__(self) NoteBase.__init__(self)
self.type = "" self.type = (Repository.LIBRARY,"")
self.name = "" self.name = ""
self.address = Location() self.address = Location()
self.email = "" self.email = ""
@ -4424,7 +4436,7 @@ class Repository(PrimaryObject,NoteBase):
@return: Returns the list of all textual attributes of the object. @return: Returns the list of all textual attributes of the object.
@rtype: list @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): def get_text_data_child_list(self):
""" """

View File

@ -51,7 +51,7 @@ import Date
import DateEdit import DateEdit
import DateHandler import DateHandler
import GrampsDBCallback import GrampsDBCallback
import AutoComp
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -103,6 +103,9 @@ class RepositoryRefEditBase:
self.media_type = self.get_widget("repos_ref_media_type") 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.call_number = self.get_widget("repos_ref_callnumber")
self.note = self.get_widget("repos_ref_note") self.note = self.get_widget("repos_ref_note")
@ -228,9 +231,9 @@ class RepositoryRefEdit(RepositoryRefEditBase):
repos = self.db.get_repository_from_handle(idval) repos = self.db.get_repository_from_handle(idval)
self.active_repos = repos self.active_repos = repos
if repos: if repos:
self.type.set_text(repos.get_type()) self.type.set_text(repos.get_type()[1])
else: else:
self.type.set_text("") self.type.set_text("")
self.active_repos = sel self.active_repos = sel
if sel: if sel:
@ -272,6 +275,9 @@ class RepositoryRefEdit(RepositoryRefEditBase):
self.repos_ref.set_reference_handle(self.active_repos.get_handle()) self.repos_ref.set_reference_handle(self.active_repos.get_handle())
# handle type here. # 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() buf = self.note.get_buffer()
note = unicode(buf.get_text(buf.get_start_iter(), note = unicode(buf.get_text(buf.get_start_iter(),
@ -289,7 +295,7 @@ class RepositoryRefEdit(RepositoryRefEditBase):
def on_source_changed(self,obj): def on_source_changed(self,obj):
handle = self.handle_list[obj.get_active()] handle = self.handle_list[obj.get_active()]
self.active_repos = self.db.get_repository_from_handle(handle) 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() self.set_button()
pass pass

View File

@ -214,6 +214,20 @@ event_roles = {
RelLib.EventRef.GROOM : _("Groom"), RelLib.EventRef.GROOM : _("Groom"),
RelLib.EventRef.WITNESS : _("Witness"), 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 # Integer to GEDCOM tag mappings for constants

View File

@ -34059,24 +34059,6 @@ Family name Given name
</packing> </packing>
</child> </child>
<child>
<widget class="GtkComboBox" id="repos_ref_media_type">
<property name="visible">True</property>
<property name="items" translatable="yes">Very Low
Low
Normal
High
Very High</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options">fill</property>
</packing>
</child>
<child> <child>
<widget class="GtkEntry" id="repos_ref_callnumber"> <widget class="GtkEntry" id="repos_ref_callnumber">
<property name="visible">True</property> <property name="visible">True</property>
@ -34097,6 +34079,20 @@ Very High</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkComboBoxEntry" id="repos_ref_media_type">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>
@ -34928,6 +34924,7 @@ Very High</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="mnemonic_widget">er_sel_button</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>