2005-08-12 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/EditRepository.py: fixes for lack of parent window handles use of dbstate. Commented out code to bold labels for now as Utils.bold_label does not work. Renamed DelReposQuery. * src/EditSource.py: fixed repository ref edit code to use dbstate. * src/RepositoryRefEdit.py: fixes for dbstate and commented out window management code. * src/RepositoryView.py: fixes for dbstate, commented out remove repos code for now as it does not work. Fixes edit repository call. svn: r5092
This commit is contained in:
parent
b794a80a43
commit
f685c58ed2
@ -1,3 +1,13 @@
|
|||||||
|
2005-08-12 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
|
* src/EditRepository.py: fixes for lack of parent window handles
|
||||||
|
use of dbstate. Commented out code to bold labels for now as
|
||||||
|
Utils.bold_label does not work. Renamed DelReposQuery.
|
||||||
|
* src/EditSource.py: fixed repository ref edit code to use dbstate.
|
||||||
|
* src/RepositoryRefEdit.py: fixes for dbstate and commented out window
|
||||||
|
management code.
|
||||||
|
* src/RepositoryView.py: fixes for dbstate, commented out remove repos
|
||||||
|
code for now as it does not work. Fixes edit repository call.
|
||||||
|
|
||||||
2005-08-14 Alex Roitman <shura@gramps-project.org>
|
2005-08-14 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/PedView.py (__init__): Define database variable.
|
* src/PedView.py (__init__): Define database variable.
|
||||||
* src/ViewManager.py (__init__): Define empty pages list.
|
* src/ViewManager.py (__init__): Define empty pages list.
|
||||||
|
@ -269,11 +269,12 @@ class ReposSrcListView:
|
|||||||
|
|
||||||
class EditRepository:
|
class EditRepository:
|
||||||
|
|
||||||
def __init__(self,repository,dbstate,parent_window=None,readonly=False):
|
def __init__(self,repository,dbstate,uistate,parent_window=None,readonly=False):
|
||||||
if repository:
|
if repository:
|
||||||
self.repository = repository
|
self.repository = repository
|
||||||
else:
|
else:
|
||||||
self.repository = RelLib.Repository()
|
self.repository = RelLib.Repository()
|
||||||
|
self.dbstate = dbstate
|
||||||
self.db = dbstate.db
|
self.db = dbstate.db
|
||||||
#self.parent = parent
|
#self.parent = parent
|
||||||
self.name_display = NameDisplay.displayer.display
|
self.name_display = NameDisplay.displayer.display
|
||||||
@ -366,7 +367,9 @@ class EditRepository:
|
|||||||
|
|
||||||
if repository.get_note():
|
if repository.get_note():
|
||||||
self.notes_buffer.set_text(repository.get_note())
|
self.notes_buffer.set_text(repository.get_note())
|
||||||
Utils.bold_label(self.notes_label)
|
# FIXME: this get a 'gtk.Label' object has no attribute 'get_children'
|
||||||
|
# from Utils.py", line 650
|
||||||
|
#Utils.bold_label(self.notes_label)
|
||||||
if repository.get_note_format() == 1:
|
if repository.get_note_format() == 1:
|
||||||
self.preform.set_active(1)
|
self.preform.set_active(1)
|
||||||
else:
|
else:
|
||||||
@ -462,7 +465,7 @@ class EditRepository:
|
|||||||
def on_add_repos_ref_clicked(self,widget):
|
def on_add_repos_ref_clicked(self,widget):
|
||||||
RepositoryRefEdit.RepositoryRefSourceEdit(RelLib.RepoRef(),
|
RepositoryRefEdit.RepositoryRefSourceEdit(RelLib.RepoRef(),
|
||||||
None,
|
None,
|
||||||
self.db,
|
self.dbstate,
|
||||||
self.repos_source_model.update,
|
self.repos_source_model.update,
|
||||||
self)
|
self)
|
||||||
|
|
||||||
@ -485,7 +488,7 @@ class EditRepository:
|
|||||||
|
|
||||||
RepositoryRefEdit.RepositoryRefSourceEdit(repos_ref,
|
RepositoryRefEdit.RepositoryRefSourceEdit(repos_ref,
|
||||||
source,
|
source,
|
||||||
self.db,
|
self.dbstate,
|
||||||
self.repos_source_model.update,
|
self.repos_source_model.update,
|
||||||
self)
|
self)
|
||||||
|
|
||||||
@ -632,7 +635,7 @@ class EditRepository:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DelReposQuery:
|
class DelRepositoryQuery:
|
||||||
def __init__(self,repository,db,sources):
|
def __init__(self,repository,db,sources):
|
||||||
self.repository = repository
|
self.repository = repository
|
||||||
self.db = db
|
self.db = db
|
||||||
|
@ -90,11 +90,10 @@ class ReposRefListModel(gtk.ListStore):
|
|||||||
|
|
||||||
class ReposRefListView:
|
class ReposRefListView:
|
||||||
|
|
||||||
def __init__(self, model, widget):
|
def __init__(self, dbstate, widget):
|
||||||
self._gramps_model = model
|
self._dbstate = dbstate
|
||||||
|
self.database_changed(self._dbstate.db)
|
||||||
self.database_changed(self._gramps_model.db)
|
self._db.connect('database-changed', self.database_changed)
|
||||||
self._gramps_model.connect('database-changed', self.database_changed)
|
|
||||||
|
|
||||||
self._widget = widget
|
self._widget = widget
|
||||||
|
|
||||||
@ -236,10 +235,10 @@ class EditSource:
|
|||||||
self.top_window.get_widget('sel_photo').set_sensitive(mode)
|
self.top_window.get_widget('sel_photo').set_sensitive(mode)
|
||||||
self.top_window.get_widget('delete_photo').set_sensitive(mode)
|
self.top_window.get_widget('delete_photo').set_sensitive(mode)
|
||||||
|
|
||||||
# self.repos_ref_view = ReposRefListView(self.parent,
|
self.repos_ref_view = ReposRefListView(self.dbstate,
|
||||||
# self.top_window.get_widget('repository_ref_list'))
|
self.top_window.get_widget('repository_ref_list'))
|
||||||
# self.repos_ref_model = ReposRefListModel(self.source)
|
self.repos_ref_model = ReposRefListModel(self.source)
|
||||||
# self.repos_ref_view.set_model(self.repos_ref_model)
|
self.repos_ref_view.set_model(self.repos_ref_model)
|
||||||
|
|
||||||
self.top_window.get_widget('add_repos_ref').set_sensitive(mode)
|
self.top_window.get_widget('add_repos_ref').set_sensitive(mode)
|
||||||
self.top_window.get_widget('edit_repos_ref').set_sensitive(mode)
|
self.top_window.get_widget('edit_repos_ref').set_sensitive(mode)
|
||||||
@ -347,7 +346,7 @@ class EditSource:
|
|||||||
model.remove(node)
|
model.remove(node)
|
||||||
|
|
||||||
def on_add_repos_ref_clicked(self,widget):
|
def on_add_repos_ref_clicked(self,widget):
|
||||||
RepositoryRefEdit.RepositoryRefEdit(RelLib.RepoRef(),self.db,
|
RepositoryRefEdit.RepositoryRefEdit(RelLib.RepoRef(),self.dbstate,
|
||||||
self.repos_ref_model.update,self)
|
self.repos_ref_model.update,self)
|
||||||
|
|
||||||
def on_delete_repos_ref_clicked(self,widget):
|
def on_delete_repos_ref_clicked(self,widget):
|
||||||
@ -365,7 +364,7 @@ class EditSource:
|
|||||||
if iter:
|
if iter:
|
||||||
repos_ref = model.get_value(iter,0)
|
repos_ref = model.get_value(iter,0)
|
||||||
|
|
||||||
RepositoryRefEdit.RepositoryRefEdit(repos_ref,self.db,
|
RepositoryRefEdit.RepositoryRefEdit(repos_ref,self.dbstate,
|
||||||
self.repos_ref_model.update,self)
|
self.repos_ref_model.update,self)
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,22 +66,24 @@ import AutoComp
|
|||||||
|
|
||||||
class RepositoryRefEditBase:
|
class RepositoryRefEditBase:
|
||||||
|
|
||||||
def __init__(self, reposref, database, update, parent):
|
def __init__(self, reposref, dbstate, update, parent):
|
||||||
|
|
||||||
self.db = database
|
self.dbstate = dbstate
|
||||||
|
self.db = dbstate.db
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
if self.parent.__dict__.has_key('child_windows'):
|
# FIXME: window manangement
|
||||||
self.win_parent = self.parent
|
# if self.parent.__dict__.has_key('child_windows'):
|
||||||
else:
|
# self.win_parent = self.parent
|
||||||
self.win_parent = self.parent.parent
|
# else:
|
||||||
if reposref:
|
# self.win_parent = self.parent.parent
|
||||||
if self.win_parent.child_windows.has_key(reposref):
|
# if reposref:
|
||||||
self.win_parent.child_windows[reposref].present(None)
|
# if self.win_parent.child_windows.has_key(reposref):
|
||||||
return
|
# self.win_parent.child_windows[reposref].present(None)
|
||||||
else:
|
# return
|
||||||
self.win_key = reposref
|
# else:
|
||||||
else:
|
# self.win_key = reposref
|
||||||
self.win_key = self
|
# else:
|
||||||
|
# self.win_key = self
|
||||||
self.update = update
|
self.update = update
|
||||||
self.repos_ref = reposref
|
self.repos_ref = reposref
|
||||||
self.child_windows = {}
|
self.child_windows = {}
|
||||||
@ -132,6 +134,8 @@ class RepositoryRefEditBase:
|
|||||||
self.child_windows = {}
|
self.child_windows = {}
|
||||||
|
|
||||||
def add_itself_to_menu(self):
|
def add_itself_to_menu(self):
|
||||||
|
# FIXME
|
||||||
|
return
|
||||||
self.win_parent.child_windows[self.win_key] = self
|
self.win_parent.child_windows[self.win_key] = self
|
||||||
label = _('Repository Reference')
|
label = _('Repository Reference')
|
||||||
self.parent_menu_item = gtk.MenuItem(label)
|
self.parent_menu_item = gtk.MenuItem(label)
|
||||||
@ -145,6 +149,8 @@ class RepositoryRefEditBase:
|
|||||||
self.winsmenu.append(self.menu_item)
|
self.winsmenu.append(self.menu_item)
|
||||||
|
|
||||||
def remove_itself_from_menu(self):
|
def remove_itself_from_menu(self):
|
||||||
|
#FIXME
|
||||||
|
return
|
||||||
del self.win_parent.child_windows[self.win_key]
|
del self.win_parent.child_windows[self.win_key]
|
||||||
self.menu_item.destroy()
|
self.menu_item.destroy()
|
||||||
self.winsmenu.destroy()
|
self.winsmenu.destroy()
|
||||||
@ -168,9 +174,9 @@ class RepositoryRefEditBase:
|
|||||||
|
|
||||||
class RepositoryRefEdit(RepositoryRefEditBase):
|
class RepositoryRefEdit(RepositoryRefEditBase):
|
||||||
|
|
||||||
def __init__(self, reposref, database, update, parent):
|
def __init__(self, reposref, dbstate, update, parent):
|
||||||
RepositoryRefEditBase.__init__(self, reposref,
|
RepositoryRefEditBase.__init__(self, reposref,
|
||||||
database, update,
|
dbstate, update,
|
||||||
parent)
|
parent)
|
||||||
|
|
||||||
self.top_window = gtk.glade.XML(const.gladeFile,"repositoryRefEditor","gramps")
|
self.top_window = gtk.glade.XML(const.gladeFile,"repositoryRefEditor","gramps")
|
||||||
@ -301,16 +307,16 @@ class RepositoryRefEdit(RepositoryRefEditBase):
|
|||||||
|
|
||||||
def add_repos_clicked(self,obj):
|
def add_repos_clicked(self,obj):
|
||||||
import EditRepository
|
import EditRepository
|
||||||
EditRepository.EditRepository(RelLib.Repository(),self.db, self)
|
EditRepository.EditRepository(RelLib.Repository(),self.dbstate, self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RepositoryRefSourceEdit(RepositoryRefEditBase):
|
class RepositoryRefSourceEdit(RepositoryRefEditBase):
|
||||||
"""Edit a Repository Reference from the perspective of the Repository."""
|
"""Edit a Repository Reference from the perspective of the Repository."""
|
||||||
|
|
||||||
def __init__(self, reposref, source, database, update, parent):
|
def __init__(self, reposref, source, dbstate, update, parent):
|
||||||
RepositoryRefEditBase.__init__(self, reposref,
|
RepositoryRefEditBase.__init__(self, reposref,
|
||||||
database, update,
|
dbstate, update,
|
||||||
parent)
|
parent)
|
||||||
|
|
||||||
self.top_window = gtk.glade.XML(const.gladeFile,"repositoryRefSourceEditor","gramps")
|
self.top_window = gtk.glade.XML(const.gladeFile,"repositoryRefSourceEditor","gramps")
|
||||||
@ -431,4 +437,4 @@ class RepositoryRefSourceEdit(RepositoryRefEditBase):
|
|||||||
|
|
||||||
def add_source_clicked(self,obj):
|
def add_source_clicked(self,obj):
|
||||||
import EditSource
|
import EditSource
|
||||||
EditSource.EditSource(RelLib.Source(),self.db, self.parent)
|
EditSource.EditSource(RelLib.Source(),self.dbstate, self.parent)
|
||||||
|
@ -114,47 +114,47 @@ class RepositoryView(PageView.ListView):
|
|||||||
|
|
||||||
def on_double_click(self,obj,event):
|
def on_double_click(self,obj,event):
|
||||||
handle = self.first_selected()
|
handle = self.first_selected()
|
||||||
place = self.dbstate.db.get_place_from_handle(handle)
|
repos = self.dbstate.db.get_repository_from_handle(handle)
|
||||||
EditRepository.EditRepository(place,self.dbstate, self.uistate)
|
EditRepository.EditRepository(repos,self.dbstate, self.uistate)
|
||||||
|
|
||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
EditRepository.EditRepository(RelLib.Repository(),self.dbstate, self.uistate)
|
EditRepository.EditRepository(RelLib.Repository(),self.dbstate, self.uistate)
|
||||||
|
|
||||||
def remove(self,obj):
|
def remove(self,obj):
|
||||||
for event_handle in self.selected_handles():
|
db = self.dbstate.db
|
||||||
db = self.dbstate.db
|
# for event_handle in self.selected_handles():
|
||||||
person_list = [ handle for handle in
|
# person_list = [ handle for handle in
|
||||||
db.get_person_handles(False)
|
# db.get_person_handles(False)
|
||||||
if db.get_person_from_handle(handle).has_handle_reference('Repository',event_handle) ]
|
# if db.get_person_from_handle(handle).has_handle_reference('Repository',event_handle) ]
|
||||||
family_list = [ handle for handle in
|
# family_list = [ handle for handle in
|
||||||
db.get_family_handles()
|
# db.get_family_handles()
|
||||||
if db.get_family_from_handle(handle).has_handle_reference('Repository',event_handle) ]
|
# if db.get_family_from_handle(handle).has_handle_reference('Repository',event_handle) ]
|
||||||
|
|
||||||
event = db.get_event_from_handle(event_handle)
|
# event = db.get_event_from_handle(event_handle)
|
||||||
|
|
||||||
ans = EditRepository.DelRepositoryQuery(event,db,
|
# ans = EditRepository.DelRepositoryQuery(event,db,
|
||||||
person_list,family_list)
|
# person_list,family_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 '
|
||||||
'will remove it from the database and from all '
|
# 'will remove it from the database and from all '
|
||||||
'people and families that reference it.')
|
# 'people and families that reference it.')
|
||||||
else:
|
# else:
|
||||||
msg = _('Deleting place will remove it from the database.')
|
# msg = _('Deleting place will remove it from the database.')
|
||||||
|
|
||||||
msg = "%s %s" % (msg,Utils.data_recover_msg)
|
# msg = "%s %s" % (msg,Utils.data_recover_msg)
|
||||||
descr = event.get_description()
|
# descr = event.get_description()
|
||||||
if descr == "":
|
# if descr == "":
|
||||||
descr = event.get_gramps_id()
|
# descr = event.get_gramps_id()
|
||||||
|
|
||||||
QuestionDialog(_('Delete %s?') % descr, msg,
|
# QuestionDialog(_('Delete %s?') % descr, msg,
|
||||||
_('_Delete Repository'),ans.query_response)
|
# _('_Delete Repository'),ans.query_response)
|
||||||
|
|
||||||
def edit(self,obj):
|
def edit(self,obj):
|
||||||
mlist = []
|
mlist = []
|
||||||
self.selection.selected_foreach(self.blist,mlist)
|
self.selection.selected_foreach(self.blist,mlist)
|
||||||
|
|
||||||
for handle in mlist:
|
for handle in mlist:
|
||||||
place = self.dbstate.db.get_place_from_handle(handle)
|
repos = self.dbstate.db.get_repository_from_handle(handle)
|
||||||
EditRepository.EditRepository(place, self.dbstate, self.uistate)
|
EditRepository.EditRepository(repos, self.dbstate, self.uistate)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user