* src/Editors/*: Switch notebook tabs during DnD
svn: r7915
This commit is contained in:
parent
88e4ddc0a6
commit
838b35e8f2
@ -1,3 +1,6 @@
|
||||
2007-01-16 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||
* src/Editors/*: Switch notebook tabs during DnD
|
||||
|
||||
2007-01-15 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_PersonView.py: use watch cursor on node expand
|
||||
* src/GrampsDb/_ReadGedcom.py: handle empty repo instances
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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())
|
||||
|
||||
|
@ -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())
|
||||
|
@ -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'))
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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"))
|
||||
|
||||
|
@ -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 = (
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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'))
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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):
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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())
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user