diff --git a/ChangeLog b/ChangeLog index 773b403cb..6d58ad7f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-01-16 Martin Hawlisch + * src/Editors/*: Switch notebook tabs during DnD + 2007-01-15 Don Allingham * src/DataViews/_PersonView.py: use watch cursor on node expand * src/GrampsDb/_ReadGedcom.py: handle empty repo instances diff --git a/src/Editors/_EditAddress.py b/src/Editors/_EditAddress.py index ff2632d69..57194962f 100644 --- a/src/Editors/_EditAddress.py +++ b/src/Editors/_EditAddress.py @@ -142,6 +142,7 @@ class EditAddress(EditSecondary): NoteTab(self.dbstate, self.uistate, self.track, self.obj.get_note_object())) + self._setup_notebook_tabs( notebook) notebook.show_all() self.top.get_widget('vbox').pack_start(notebook,True) diff --git a/src/Editors/_EditAttribute.py b/src/Editors/_EditAttribute.py index be8495130..a9daa6c29 100644 --- a/src/Editors/_EditAttribute.py +++ b/src/Editors/_EditAttribute.py @@ -119,6 +119,7 @@ class EditAttribute(EditSecondary): NoteTab(self.dbstate, self.uistate, self.track, self.obj.get_note_object())) + self._setup_notebook_tabs( notebook) notebook.show_all() self.top.get_widget('vbox').pack_start(notebook,True) diff --git a/src/Editors/_EditChildRef.py b/src/Editors/_EditChildRef.py index 35d6d489b..49d973aa0 100644 --- a/src/Editors/_EditChildRef.py +++ b/src/Editors/_EditChildRef.py @@ -122,6 +122,7 @@ class EditChildRef(EditSecondary): NoteTab(self.dbstate, self.uistate, self.track, self.obj.get_note_object())) + self._setup_notebook_tabs( notebook) notebook.show_all() self.top.get_widget('vbox').pack_start(notebook,True) diff --git a/src/Editors/_EditEvent.py b/src/Editors/_EditEvent.py index 7a6ef4cd9..0bce4806a 100644 --- a/src/Editors/_EditEvent.py +++ b/src/Editors/_EditEvent.py @@ -192,6 +192,9 @@ class EditEvent(EditPrimary): except AttributeError: print "Attribute list not available yet" + + self._setup_notebook_tabs( notebook) + notebook.show_all() self.top.get_widget('vbox').pack_start(notebook,True) @@ -318,4 +321,3 @@ class DelEventQuery: self.db.remove_event(self.event.get_handle(),trans) self.db.transaction_commit( trans,_("Delete Event (%s)") % self.event.get_gramps_id()) - diff --git a/src/Editors/_EditEventRef.py b/src/Editors/_EditEventRef.py index 505cebddd..f9e9f4d70 100644 --- a/src/Editors/_EditEventRef.py +++ b/src/Editors/_EditEventRef.py @@ -161,7 +161,7 @@ class EditEventRef(EditReference): notebook = self.top.get_widget('notebook') notebook_ref = self.top.get_widget('notebook_ref') - + self.srcref_list = self._add_tab( notebook, SourceEmbedList(self.dbstate,self.uistate,self.track,self.source)) @@ -203,6 +203,9 @@ class EditEventRef(EditReference): except AttributeError: print "Attribute list not available yet" + self._setup_notebook_tabs( notebook) + self._setup_notebook_tabs( notebook_ref) + def build_menu_names(self,eventref): if self.source: event_name = str(self.source.get_type()) diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 082aac458..643b5db8a 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -558,6 +558,7 @@ class EditFamily(EditPrimary): FamilyLdsEmbedList(self.dbstate,self.uistate,self.track, self.obj.get_lds_ord_list())) + self._setup_notebook_tabs( notebook) notebook.show_all() self.hidden = (notebook, self.top.get_widget('info')) diff --git a/src/Editors/_EditLdsOrd.py b/src/Editors/_EditLdsOrd.py index 3fbfaab63..fbc935dc3 100644 --- a/src/Editors/_EditLdsOrd.py +++ b/src/Editors/_EditLdsOrd.py @@ -257,6 +257,7 @@ class EditLdsOrd(EditSecondary): NoteTab(self.dbstate, self.uistate, self.track, self.obj.get_note_object())) + self._setup_notebook_tabs( notebook) notebook.show_all() self.top.get_widget('vbox').pack_start(notebook,True) diff --git a/src/Editors/_EditMedia.py b/src/Editors/_EditMedia.py index 3c394594c..106a16de1 100644 --- a/src/Editors/_EditMedia.py +++ b/src/Editors/_EditMedia.py @@ -180,6 +180,7 @@ class EditMedia(EditPrimary): MediaBackRefList(self.dbstate,self.uistate,self.track, self.db.find_backlink_handles(self.obj.handle))) + self._setup_notebook_tabs( notebook) notebook.show_all() self.glade.get_widget('vbox').pack_start(notebook,True) @@ -305,4 +306,3 @@ class DeleteMediaQuery: self.db.enable_signals() self.db.remove_object(self.media_handle,trans) self.db.transaction_commit(trans,_("Remove Media Object")) - diff --git a/src/Editors/_EditMediaRef.py b/src/Editors/_EditMediaRef.py index 0e59f1fe5..0bcda671e 100644 --- a/src/Editors/_EditMediaRef.py +++ b/src/Editors/_EditMediaRef.py @@ -1,4 +1,4 @@ -0# +# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2000-2006 Donald N. Allingham @@ -155,7 +155,7 @@ class EditMediaRef(EditReference): """ notebook_ref = self.top.get_widget('notebook_ref') notebook_src = self.top.get_widget('notebook_shared') - + self.srcref_list = self._add_tab( notebook_ref, SourceEmbedList(self.dbstate,self.uistate,self.track, @@ -193,6 +193,9 @@ class EditMediaRef(EditReference): NoteTab(self.dbstate, self.uistate, self.track, self.source.get_note_object())) + self._setup_notebook_tabs( notebook_src) + self._setup_notebook_tabs( notebook_ref) + def save(self,*obj): coord = ( diff --git a/src/Editors/_EditName.py b/src/Editors/_EditName.py index 00f9b5342..62798c6bb 100644 --- a/src/Editors/_EditName.py +++ b/src/Editors/_EditName.py @@ -198,6 +198,8 @@ class EditName(EditSecondary): NoteTab(self.dbstate, self.uistate, self.track, self.obj.get_note_object())) + self._setup_notebook_tabs( notebook) + def build_menu_names(self,name): if name: ntext = NameDisplay.displayer.display_name(name) diff --git a/src/Editors/_EditPerson.py b/src/Editors/_EditPerson.py index f1b5155e7..28e6c2a69 100644 --- a/src/Editors/_EditPerson.py +++ b/src/Editors/_EditPerson.py @@ -338,6 +338,7 @@ class EditPerson(EditPrimary): PersonBackRefList(self.dbstate, self.uistate, self.track, self.db.find_backlink_handles(self.obj.handle))) + self._setup_notebook_tabs( notebook) notebook.show_all() self.top.get_widget('vbox').pack_start(notebook, True) diff --git a/src/Editors/_EditPersonRef.py b/src/Editors/_EditPersonRef.py index 360417d2a..99cf831b2 100644 --- a/src/Editors/_EditPersonRef.py +++ b/src/Editors/_EditPersonRef.py @@ -132,6 +132,7 @@ class EditPersonRef(EditSecondary): NoteTab(self.dbstate, self.uistate, self.track, self.obj.get_note_object())) + self._setup_notebook_tabs( notebook) notebook.show_all() self.top.get_widget('vbox').pack_start(notebook,True) @@ -155,4 +156,3 @@ class EditPersonRef(EditSecondary): _('No person selected'), _('You must either select a person or Cancel ' 'the edit')) - diff --git a/src/Editors/_EditPlace.py b/src/Editors/_EditPlace.py index 4bc024777..ddcb2312f 100644 --- a/src/Editors/_EditPlace.py +++ b/src/Editors/_EditPlace.py @@ -184,6 +184,8 @@ class EditPlace(EditPrimary): PlaceBackRefList(self.dbstate,self.uistate,self.track, self.db.find_backlink_handles(self.obj.handle))) + self._setup_notebook_tabs( notebook) + def _cleanup_on_exit(self): self.backref_list.close() (width, height) = self.window.get_size() diff --git a/src/Editors/_EditPrimary.py b/src/Editors/_EditPrimary.py index d4e9b354d..1aca82b82 100644 --- a/src/Editors/_EditPrimary.py +++ b/src/Editors/_EditPrimary.py @@ -85,9 +85,19 @@ class EditPrimary(ManagedWindow.ManagedWindow): else: return id(self) + def _setup_notebook_tabs(self, notebook): + for child in notebook.get_children(): + label = notebook.get_tab_label(child) + page_no = notebook.page_num(child) + label.drag_dest_set(0, [], 0) + label.connect('drag_motion', self._switch_page_on_dnd,notebook,page_no) + + def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no): + if notebook.get_current_page() != page_no: + notebook.set_current_page(page_no) + def _add_tab(self,notebook,page): - notebook.insert_page(page) - notebook.set_tab_label(page,page.get_tab_widget()) + notebook.insert_page(page, page.get_tab_widget()) return page def _cleanup_on_exit(self): diff --git a/src/Editors/_EditReference.py b/src/Editors/_EditReference.py index 9948c6f99..eb40588bd 100644 --- a/src/Editors/_EditReference.py +++ b/src/Editors/_EditReference.py @@ -87,9 +87,19 @@ class EditReference(ManagedWindow.ManagedWindow): """ pass + def _setup_notebook_tabs(self, notebook): + for child in notebook.get_children(): + label = notebook.get_tab_label(child) + page_no = notebook.page_num(child) + label.drag_dest_set(0, [], 0) + label.connect('drag_motion', self._switch_page_on_dnd,notebook,page_no) + + def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no): + if notebook.get_current_page() != page_no: + notebook.set_current_page(page_no) + def _add_tab(self,notebook,page): - notebook.insert_page(page) - notebook.set_tab_label(page,page.get_tab_widget()) + notebook.insert_page(page, page.get_tab_widget()) return page def _add_db_signal(self, name, callback): @@ -140,4 +150,3 @@ class EditReference(ManagedWindow.ManagedWindow): Config.set(self.WIDTH_KEY, width) Config.set(self.HEIGHT_KEY, height) Config.sync() - diff --git a/src/Editors/_EditRepoRef.py b/src/Editors/_EditRepoRef.py index 035a49d89..dcc761836 100644 --- a/src/Editors/_EditRepoRef.py +++ b/src/Editors/_EditRepoRef.py @@ -151,6 +151,9 @@ class EditRepoRef(EditReference): self.db.find_backlink_handles(self.source.handle), self.enable_warnbox)) + self._setup_notebook_tabs( notebook_src) + self._setup_notebook_tabs( notebook_ref) + def build_menu_names(self,sourceref): if self.source: source_name = self.source.get_name() diff --git a/src/Editors/_EditRepository.py b/src/Editors/_EditRepository.py index 1b72f33dc..a43fa5a64 100644 --- a/src/Editors/_EditRepository.py +++ b/src/Editors/_EditRepository.py @@ -131,6 +131,7 @@ class EditRepository(EditPrimary): SourceBackRefList(self.dbstate, self.uistate, self.track, self.db.find_backlink_handles(self.obj.handle))) + self._setup_notebook_tabs( notebook) notebook.show_all() self.glade.get_widget("vbox").pack_start(notebook,True,True) diff --git a/src/Editors/_EditSecondary.py b/src/Editors/_EditSecondary.py index 12ae92319..2a0f90a03 100644 --- a/src/Editors/_EditSecondary.py +++ b/src/Editors/_EditSecondary.py @@ -83,9 +83,19 @@ class EditSecondary(ManagedWindow.ManagedWindow): def build_window_key(self,obj): return id(obj) + def _setup_notebook_tabs(self, notebook): + for child in notebook.get_children(): + label = notebook.get_tab_label(child) + page_no = notebook.page_num(child) + label.drag_dest_set(0, [], 0) + label.connect('drag_motion', self._switch_page_on_dnd,notebook,page_no) + + def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no): + if notebook.get_current_page() != page_no: + notebook.set_current_page(page_no) + def _add_tab(self,notebook,page): - notebook.insert_page(page) - notebook.set_tab_label(page,page.get_tab_widget()) + notebook.insert_page(page, page.get_tab_widget()) return page def _cleanup_on_exit(self): @@ -114,4 +124,3 @@ class EditSecondary(ManagedWindow.ManagedWindow): Config.set(self.WIDTH_KEY, width) Config.set(self.HEIGHT_KEY, height) Config.sync() - diff --git a/src/Editors/_EditSource.py b/src/Editors/_EditSource.py index 2bb29e5a2..4dc82b76d 100644 --- a/src/Editors/_EditSource.py +++ b/src/Editors/_EditSource.py @@ -152,6 +152,7 @@ class EditSource(EditPrimary): SourceBackRefList(self.dbstate, self.uistate, self.track, self.db.find_backlink_handles(self.obj.handle))) + self._setup_notebook_tabs( notebook) notebook.show_all() self.glade.get_widget('vbox').pack_start(notebook,True) @@ -232,4 +233,3 @@ class DelSrcQuery: self.db.remove_source(self.source.get_handle(),trans) self.db.transaction_commit( trans,_("Delete Source (%s)") % self.source.get_title()) - diff --git a/src/Editors/_EditSourceRef.py b/src/Editors/_EditSourceRef.py index 5f6541de4..678e0a9e9 100644 --- a/src/Editors/_EditSourceRef.py +++ b/src/Editors/_EditSourceRef.py @@ -189,6 +189,9 @@ class EditSourceRef(EditReference): NoteTab(self.dbstate, self.uistate, self.track, self.source_ref.get_note_object(),_('Comments'))) + self._setup_notebook_tabs( notebook_src) + self._setup_notebook_tabs( notebook_ref) + def build_menu_names(self,sourceref): if self.source: source_name = self.source.get_title()