2007-01-22 Alex Roitman <shura@gramps-project.org>

* src/Editors/_EditSource.py (query_response): Remove sourcerefs
	from repos (indirectly, through secondary objects).
	* src/Editors/_EditPlace.py (query_response): Avoid db walk.
	* src/DataViews/_FamilyList.py (remove): Set busy cursor.
	* src/DataViews/_PlaceView.py (remove): Set busy cursor.
	* src/DataViews/_SourceView.py (remove): Set busy cursor.
	* src/DataViews/_MediaView.py (remove): Set busy cursor.
	* src/DataViews/_EventView.py (remove): Set busy cursor.
	* src/DataViews/_RepositoryView.py (remove): Set busy cursor.
	* src/Editors/_EditEventRef.py (DelEventQuery): Remove unneeded class.
	* src/Filters/Rules/_HasTextMatchingSubstringOf.py: Remove
	unneeded import.
	* src/Filters/Rules/Person/_HasTextMatchingSubstringOf.py
	(cache_sources): Adapt to changes in get_source_referents.
	* src/Utils.py (get_source_referents): Use reference map, add
	repositories to the search results;
	(get_media_referents): Use reference map.



svn: r7958
This commit is contained in:
Alex Roitman 2007-01-23 03:37:13 +00:00
parent dc891facb6
commit 6306412b2a
16 changed files with 123 additions and 187 deletions

View File

@ -1,3 +1,22 @@
2007-01-22 Alex Roitman <shura@gramps-project.org>
* src/Editors/_EditSource.py (query_response): Remove sourcerefs
from repos (indirectly, through secondary objects).
* src/Editors/_EditPlace.py (query_response): Avoid db walk.
* src/DataViews/_FamilyList.py (remove): Set busy cursor.
* src/DataViews/_PlaceView.py (remove): Set busy cursor.
* src/DataViews/_SourceView.py (remove): Set busy cursor.
* src/DataViews/_MediaView.py (remove): Set busy cursor.
* src/DataViews/_EventView.py (remove): Set busy cursor.
* src/DataViews/_RepositoryView.py (remove): Set busy cursor.
* src/Editors/_EditEventRef.py (DelEventQuery): Remove unneeded class.
* src/Filters/Rules/_HasTextMatchingSubstringOf.py: Remove
unneeded import.
* src/Filters/Rules/Person/_HasTextMatchingSubstringOf.py
(cache_sources): Adapt to changes in get_source_referents.
* src/Utils.py (get_source_referents): Use reference map, add
repositories to the search results;
(get_media_referents): Use reference map.
2007-01-22 Douglas Blank <dblank@cs.brynmawr.edu> 2007-01-22 Douglas Blank <dblank@cs.brynmawr.edu>
* src/plugins/Calendar.py: 0000858: Patch for calendar enhancements and new * src/plugins/Calendar.py: 0000858: Patch for calendar enhancements and new
Birthday Report Birthday Report

View File

@ -201,7 +201,8 @@ class EventView(PageView.ListView):
event = db.get_event_from_handle(ehandle) event = db.get_event_from_handle(ehandle)
ans = DelEventQuery(event, db, person_list, family_list) ans = DelEventQuery(self.dbstate,self.uistate,
event,person_list,family_list)
if len(person_list) + len(family_list) > 0: if len(person_list) + len(family_list) > 0:
msg = _('This event is currently being used. Deleting it ' msg = _('This event is currently being used. Deleting it '
@ -215,8 +216,10 @@ class EventView(PageView.ListView):
if descr == "": if descr == "":
descr = event.get_gramps_id() descr = event.get_gramps_id()
self.uistate.set_busy_cursor(1)
QuestionDialog(_('Delete %s?') % descr, msg, QuestionDialog(_('Delete %s?') % descr, msg,
_('_Delete Event'), ans.query_response) _('_Delete Event'), ans.query_response)
self.uistate.set_busy_cursor(0)
def edit(self, obj): def edit(self, obj):
mlist = [] mlist = []
@ -228,4 +231,3 @@ class EventView(PageView.ListView):
EditEvent(event, self.dbstate, self.uistate) EditEvent(event, self.dbstate, self.uistate)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass

View File

@ -177,6 +177,7 @@ class FamilyListView(PageView.ListView):
pass pass
def remove(self, obj): def remove(self, obj):
self.uistate.set_busy_cursor(1)
import GrampsDb import GrampsDb
mlist = [] mlist = []
@ -185,6 +186,7 @@ class FamilyListView(PageView.ListView):
for handle in mlist: for handle in mlist:
GrampsDb.remove_family_relationships(self.dbstate.db, handle) GrampsDb.remove_family_relationships(self.dbstate.db, handle)
self.build_tree() self.build_tree()
self.uistate.set_busy_cursor(0)
def edit(self, obj): def edit(self, obj):
mlist = [] mlist = []

View File

@ -58,7 +58,7 @@ import Bookmarks
import Mime import Mime
import RelLib import RelLib
from Editors import EditMedia from Editors import EditMedia, DeleteMediaQuery
import Errors import Errors
from QuestionDialog import QuestionDialog from QuestionDialog import QuestionDialog
from Filters.SideBar import MediaSidebarFilter from Filters.SideBar import MediaSidebarFilter
@ -311,7 +311,7 @@ class MediaView(PageView.ListView):
return return
the_lists = Utils.get_media_referents(handle, self.dbstate.db) the_lists = Utils.get_media_referents(handle, self.dbstate.db)
ans = DeleteMediaQuery(handle, self.dbstate.db, the_lists) ans = DeleteMediaQuery(self.dbstate,self.uistate,handle,the_lists)
if filter(None, the_lists): # quick test for non-emptiness if filter(None, the_lists): # quick test for non-emptiness
msg = _('This media object is currently being used. ' msg = _('This media object is currently being used. '
'If you delete this object, it will be removed from ' 'If you delete this object, it will be removed from '
@ -320,8 +320,10 @@ class MediaView(PageView.ListView):
msg = _('Deleting media object will remove it from the database.') msg = _('Deleting media object will remove it from the database.')
msg = "%s %s" % (msg, Utils.data_recover_msg) msg = "%s %s" % (msg, Utils.data_recover_msg)
self.uistate.set_busy_cursor(1)
QuestionDialog(_('Delete Media Object?'), msg, QuestionDialog(_('Delete Media Object?'), msg,
_('_Delete Media Object'), ans.query_response) _('_Delete Media Object'), ans.query_response)
self.uistate.set_busy_cursor(0)
def edit(self, obj): def edit(self, obj):
handle = self.first_selected() handle = self.first_selected()
@ -333,56 +335,3 @@ class MediaView(PageView.ListView):
EditMedia(self.dbstate, self.uistate, [], obj) EditMedia(self.dbstate, self.uistate, [], obj)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass
class DeleteMediaQuery:
def __init__(self, media_handle, db, the_lists):
self.db = db
self.media_handle = media_handle
self.the_lists = the_lists
def query_response(self):
trans = self.db.transaction_begin()
self.db.disable_signals()
(person_list, family_list, event_list,
place_list, source_list) = self.the_lists
for handle in person_list:
person = self.db.get_person_from_handle(handle)
new_list = [ photo for photo in person.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
person.set_media_list(new_list)
self.db.commit_person(person, trans)
for handle in family_list:
family = self.db.get_family_from_handle(handle)
new_list = [ photo for photo in family.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
family.set_media_list(new_list)
self.db.commit_family(family, trans)
for handle in event_list:
event = self.db.get_event_from_handle(handle)
new_list = [ photo for photo in event.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
event.set_media_list(new_list)
self.db.commit_event(event, trans)
for handle in place_list:
place = self.db.get_place_from_handle(handle)
new_list = [ photo for photo in place.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
place.set_media_list(new_list)
self.db.commit_place(place, trans)
for handle in source_list:
source = self.db.get_source_from_handle(handle)
new_list = [ photo for photo in source.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
source.set_media_list(new_list)
self.db.commit_source(source, trans)
self.db.enable_signals()
self.db.remove_object(self.media_handle, trans)
self.db.transaction_commit(trans, _("Remove Media Object"))

View File

@ -222,16 +222,22 @@ class PlaceView(PageView.ListView):
def remove(self, obj): def remove(self, obj):
for place_handle in self.selected_handles(): for place_handle in self.selected_handles():
db = self.dbstate.db db = self.dbstate.db
person_list = [ h for h in person_list = [
db.get_person_handles(False) item[1] for item in
if db.get_person_from_handle(h).has_handle_reference('Place', place_handle) ] self.dbstate.db.find_backlink_handles(place_handle,['Person'])]
family_list = [ h for h in
db.get_family_handles() family_list = [
if db.get_family_from_handle(h).has_handle_reference('Place', place_handle) ] item[1] for item in
self.dbstate.db.find_backlink_handles(place_handle,['Family'])]
event_list = [
item[1] for item in
self.dbstate.db.find_backlink_handles(place_handle,['Event'])]
place = db.get_place_from_handle(place_handle) place = db.get_place_from_handle(place_handle)
ans = DeletePlaceQuery(place, db) ans = DeletePlaceQuery(self.dbstate,self.uistate,
place,person_list,family_list,event_list)
if len(person_list) + len(family_list) > 0: if len(person_list) + len(family_list) > 0:
msg = _('This place is currently being used. Deleting it ' msg = _('This place is currently being used. Deleting it '
@ -245,8 +251,10 @@ class PlaceView(PageView.ListView):
if descr == "": if descr == "":
descr = place.get_gramps_id() descr = place.get_gramps_id()
self.uistate.set_busy_cursor(1)
QuestionDialog(_('Delete %s?') % descr, msg, QuestionDialog(_('Delete %s?') % descr, msg,
_('_Delete Place'), ans.query_response) _('_Delete Place'), ans.query_response)
self.uistate.set_busy_cursor(0)
def edit(self, obj): def edit(self, obj):
mlist = [] mlist = []
@ -272,5 +280,3 @@ class PlaceView(PageView.ListView):
else: else:
import Merge import Merge
Merge.MergePlaces(self.dbstate, self.uistate, mlist[0], mlist[1]) Merge.MergePlaces(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -188,13 +188,14 @@ class RepositoryView(PageView.ListView):
for repos_handle in mlist: for repos_handle in mlist:
source_list = [ src_handle for src_handle \ source_list = [
in db.get_source_handles() \ item[1] for item in
if db.get_source_from_handle(src_handle).has_repo_reference(repos_handle)] self.dbstate.db.find_backlink_handles(repos_handle,['Source'])]
repository = db.get_repository_from_handle(repos_handle) repository = db.get_repository_from_handle(repos_handle)
ans = DelRepositoryQuery(repository, db, source_list) ans = DelRepositoryQuery(self.dbstate,self.uistate,
repository,source_list)
if len(source_list) > 0: if len(source_list) > 0:
msg = _('This repository is currently being used. Deleting it ' msg = _('This repository is currently being used. Deleting it '
@ -204,9 +205,10 @@ class RepositoryView(PageView.ListView):
msg = _('Deleting repository will remove it from the database.') msg = _('Deleting repository will remove it from the database.')
msg = "%s %s" % (msg, Utils.data_recover_msg) msg = "%s %s" % (msg, Utils.data_recover_msg)
self.uistate.set_busy_cursor(1)
QuestionDialog(_('Delete %s?') % repository.get_name(), msg, QuestionDialog(_('Delete %s?') % repository.get_name(), msg,
_('_Delete Repository'), ans.query_response) _('_Delete Repository'), ans.query_response)
self.uistate.set_busy_cursor(0)
def edit(self, obj): def edit(self, obj):
mlist = [] mlist = []
@ -218,4 +220,3 @@ class RepositoryView(PageView.ListView):
EditRepository(self.dbstate, self.uistate, [], repos) EditRepository(self.dbstate, self.uistate, [], repos)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass

View File

@ -186,7 +186,7 @@ class SourceView(PageView.ListView):
source = db.get_source_from_handle(source_handle) source = db.get_source_from_handle(source_handle)
ans = DelSrcQuery(source, db, the_lists) ans = DelSrcQuery(self.dbstate,self.uistate,source,the_lists)
if filter(None, the_lists): # quick test for non-emptiness if filter(None, the_lists): # quick test for non-emptiness
msg = _('This source is currently being used. Deleting it ' msg = _('This source is currently being used. Deleting it '
@ -200,8 +200,10 @@ class SourceView(PageView.ListView):
if descr == "": if descr == "":
descr = source.get_gramps_id() descr = source.get_gramps_id()
self.uistate.set_busy_cursor(1)
QuestionDialog(_('Delete %s?') % descr, msg, QuestionDialog(_('Delete %s?') % descr, msg,
_('_Delete Source'), ans.query_response) _('_Delete Source'), ans.query_response)
self.uistate.set_busy_cursor(0)
def edit(self, obj): def edit(self, obj):
mlist = [] mlist = []

View File

@ -295,9 +295,10 @@ class EditFamilyEvent(EditEvent):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DelEventQuery: class DelEventQuery:
def __init__(self,event,db,person_list,family_list): def __init__(self,dbstate,uistate,event,person_list,family_list):
self.event = event self.event = event
self.db = db self.db = dbstate.db
self.uistate = uistate
self.person_list = person_list self.person_list = person_list
self.family_list = family_list self.family_list = family_list

View File

@ -244,37 +244,3 @@ class EditFamilyEventRef(EditEventRef):
def get_custom_events(self): def get_custom_events(self):
return [ RelLib.EventType((RelLib.EventType.CUSTOM,val)) \ return [ RelLib.EventType((RelLib.EventType.CUSTOM,val)) \
for val in self.dbstate.db.get_family_event_types()] for val in self.dbstate.db.get_family_event_types()]
#-------------------------------------------------------------------------
#
# Delete Query class
#
#-------------------------------------------------------------------------
class DelEventQuery:
def __init__(self,event,db,person_list,family_list):
self.event = event
self.db = db
self.person_list = person_list
self.family_list = family_list
def query_response(self):
trans = self.db.transaction_begin()
self.db.disable_signals()
ev_handle_list = [self.event.get_handle()]
for handle in self.person_list:
person = self.db.get_person_from_handle(handle)
person.remove_handle_references('Event',ev_handle_list)
self.db.commit_person(person,trans)
for handle in self.family_list:
family = self.db.get_family_from_handle(handle)
family.remove_handle_references('Event',ev_handle_list)
self.db.commit_family(family,trans)
self.db.enable_signals()
self.db.remove_event(self.event.get_handle(),trans)
self.db.transaction_commit(
trans,_("Delete Event (%s)") % self.event.get_gramps_id())

View File

@ -258,8 +258,9 @@ class EditMedia(EditPrimary):
class DeleteMediaQuery: class DeleteMediaQuery:
def __init__(self,media_handle,db,the_lists): def __init__(self,dbstate,uistate,media_handle,the_lists):
self.db = db self.db = dbstate.db
self.uistate = uistate
self.media_handle = media_handle self.media_handle = media_handle
self.the_lists = the_lists self.the_lists = the_lists

View File

@ -215,9 +215,14 @@ class EditPlace(EditPrimary):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DeletePlaceQuery: class DeletePlaceQuery:
def __init__(self,place,db): def __init__(self,dbstate,uistate,
self.db = db place,person_list,family_list,event_list):
self.db = dbstate.db
self.uistate = uistate
self.obj = place self.obj = place
self.person_list = person_list
self.family_list = family_list
self.event_list = event_list
def query_response(self): def query_response(self):
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
@ -225,25 +230,22 @@ class DeletePlaceQuery:
place_handle = self.obj.get_handle() place_handle = self.obj.get_handle()
for handle in self.db.get_person_handles(sort_handles=False): for handle in self.person_list:
person = self.db.get_person_from_handle(handle) person = self.db.get_person_from_handle(handle)
if person.has_handle_reference('Place',place_handle): person.remove_handle_references('Place',place_handle)
person.remove_handle_references('Place',place_handle) self.db.commit_person(person,trans)
self.db.commit_person(person,trans)
for handle in self.db.get_family_handles(): for handle in self.family_list:
family = self.db.get_family_from_handle(handle) family = self.db.get_family_from_handle(handle)
if family.has_handle_reference('Place',place_handle): family.remove_handle_references('Place',place_handle)
family.remove_handle_references('Place',place_handle) self.db.commit_family(family,trans)
self.db.commit_family(family,trans)
for handle in self.db.get_event_handles(): for handle in self.event_list:
event = self.db.get_event_from_handle(handle) event = self.db.get_event_from_handle(handle)
if event.has_handle_reference('Place',place_handle): event.remove_handle_references('Place',place_handle)
event.remove_handle_references('Place',place_handle) self.db.commit_event(event,trans)
self.db.commit_event(event,trans)
self.db.enable_signals() self.db.enable_signals()
self.db.remove_place(place_handle,trans) self.db.remove_place(place_handle,trans)
self.db.transaction_commit(trans, self.db.transaction_commit(
_("Delete Place (%s)") % self.obj.get_title()) trans,_("Delete Place (%s)") % self.obj.get_title())

View File

@ -165,15 +165,15 @@ class EditRepository(EditPrimary):
Config.sync() Config.sync()
class DelRepositoryQuery: class DelRepositoryQuery:
def __init__(self,repository,db,sources): def __init__(self,dbstate,uistate,repository,sources):
self.obj = repository self.obj = repository
self.db = db self.db = dbstate.db
self.uistate = uistate
self.sources = sources self.sources = sources
def query_response(self): def query_response(self):
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
repos_handle_list = [self.obj.get_handle()] repos_handle_list = [self.obj.get_handle()]
for handle in self.sources: for handle in self.sources:

View File

@ -185,17 +185,18 @@ class EditSource(EditPrimary):
Config.sync() Config.sync()
class DelSrcQuery: class DelSrcQuery:
def __init__(self,source,db,the_lists): def __init__(self,dbstate,uistate,source,the_lists):
self.source = source self.source = source
self.db = db self.db = dbstate.db
self.uistate = uistate
self.the_lists = the_lists self.the_lists = the_lists
def query_response(self): def query_response(self):
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
self.db.disable_signals() self.db.disable_signals()
(person_list,family_list,event_list, (person_list,family_list,event_list,place_list,source_list,
place_list,source_list,media_list) = self.the_lists media_list,repo_list) = self.the_lists
src_handle_list = [self.source.get_handle()] src_handle_list = [self.source.get_handle()]
@ -229,6 +230,11 @@ class DelSrcQuery:
media.remove_source_references(src_handle_list) media.remove_source_references(src_handle_list)
self.db.commit_media_object(media,trans) self.db.commit_media_object(media,trans)
for handle in repo_list:
repo = self.db.get_repository_from_handle(handle)
repo.remove_source_references(src_handle_list)
self.db.commit_repository(repo,trans)
self.db.enable_signals() self.db.enable_signals()
self.db.remove_source(self.source.get_handle(),trans) self.db.remove_source(self.source.get_handle(),trans)
self.db.transaction_commit( self.db.transaction_commit(

View File

@ -175,9 +175,9 @@ class HasTextMatchingSubstringOf(Rule):
if reporef.get_reference_handle() in self.repo_map: if reporef.get_reference_handle() in self.repo_map:
match = 1 match = 1
if match: if match:
(person_list,family_list,event_list, (person_list,family_list,event_list,place_list,source_list,
place_list,source_list,media_list media_list,repo_list
) = get_source_referents(source_handle,self.db) ) = get_source_referents(source_handle,self.db)
for handle in person_list: for handle in person_list:
self.person_map[handle] = 1 self.person_map[handle] = 1
for handle in family_list: for handle in family_list:
@ -188,6 +188,8 @@ class HasTextMatchingSubstringOf(Rule):
self.place_map[handle] = 1 self.place_map[handle] = 1
for handle in media_list: for handle in media_list:
self.media_map[handle] = 1 self.media_map[handle] = 1
for handle in repo_list:
self.media_map[handle] = 1
def match_object(self,obj): def match_object(self,obj):
if not obj: if not obj:

View File

@ -32,7 +32,6 @@ from gettext import gettext as _
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Utils import get_source_referents
from _Rule import Rule from _Rule import Rule
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -798,39 +798,34 @@ def get_source_referents(source_handle,db):
secondary child-objects) to a given source handle in a given database. secondary child-objects) to a given source handle in a given database.
""" """
# Persons # Use one pass through the reference map to grab all the references
person_list = [ handle \ object_list = [item for item in db.find_backlink_handles(source_handle)]
for handle in db.get_person_handles(sort_handles=False) \
if db.get_person_from_handle(handle).has_source_reference(source_handle)
]
# Then form the object-specific lists
# Persons
person_list = [item[1] for item in object_list if item[0] == 'Person']
# Families # Families
family_list = [ handle for handle in db.get_family_handles() \ family_list = [item[1] for item in object_list if item[0] == 'Family']
if db.get_family_from_handle(handle).has_source_reference(source_handle)
]
# Events # Events
event_list = [ handle for handle in db.get_event_handles() \ event_list = [item[1] for item in object_list if item[0] == 'Event']
if db.get_event_from_handle(handle).has_source_reference(source_handle)
]
# Places # Places
place_list = [ handle for handle in db.get_place_handles() \ place_list = [item[1] for item in object_list if item[0] == 'Place']
if db.get_place_from_handle(handle).has_source_reference(source_handle)
]
# Sources # Sources
source_list = [ handle for handle in db.get_source_handles() \ source_list = [item[1] for item in object_list if item[0] == 'Source']
if db.get_source_from_handle(handle).has_source_reference(source_handle)
]
# Media Objects # Media Objects
media_list = [ handle for handle in db.get_media_object_handles() \ media_list = [item[1] for item in object_list if item[0] == 'MediaObject']
if db.get_object_from_handle(handle).has_source_reference(source_handle)
]
return (person_list,family_list,event_list, # Repositories
place_list,source_list,media_list) repo_list = [item[1] for item in object_list if item[0] == 'Repository']
return (person_list,family_list,event_list,place_list,source_list,
media_list,repo_list)
def get_media_referents(media_handle,db): def get_media_referents(media_handle,db):
""" """
@ -840,45 +835,28 @@ def get_media_referents(media_handle,db):
to a given media handle in a given database. to a given media handle in a given database.
""" """
# Use one pass through the reference map to grab all the references
object_list = [item for item in db.find_backlink_handles(media_handle)]
# Then form the object-specific lists
# Persons # Persons
person_list = [ handle \ person_list = [item[1] for item in object_list if item[0] == 'Person']
for handle in db.get_person_handles(sort_handles=False) \
if media_handle in \
[photo.get_reference_handle() for photo \
in db.get_person_from_handle(handle).get_media_list()]
]
# Families # Families
family_list = [ handle for handle in db.get_family_handles() \ family_list = [item[1] for item in object_list if item[0] == 'Family']
if media_handle in \
[photo.get_reference_handle() for photo \
in db.get_family_from_handle(handle).get_media_list()]
]
# Events # Events
event_list = [ handle for handle in db.get_event_handles() \ event_list = [ item[1] for item in object_list if item[0] == 'Event']
if media_handle in \
[photo.get_reference_handle() for photo \
in db.get_event_from_handle(handle).get_media_list()]
]
# Places # Places
place_list = [ handle for handle in db.get_place_handles() \ place_list = [ item[1] for item in object_list if item[0] == 'Place']
if media_handle in \
[photo.get_reference_handle() for photo \
in db.get_place_from_handle(handle).get_media_list()]
]
# Sources # Sources
source_list = [ handle for handle in db.get_source_handles() \ source_list = [ item[1] for item in object_list if item[0] == 'Source']
if media_handle in \
[photo.get_reference_handle() for photo \
in db.get_source_from_handle(handle).get_media_list()]
]
return (person_list,family_list,event_list,place_list,source_list) return (person_list,family_list,event_list,place_list,source_list)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #