From 132f884c4e924be7c7e3e7ba6ea0ae181c1c7931 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Fri, 19 Oct 2007 22:03:15 +0000 Subject: [PATCH] 2007-10-19 Benny Malengier * src/DisplayTabs/_EmbeddedList.py: traceback to console on ErrorDialog * src/DisplayTabs/_NoteTab.py: * src/Selectors/_SelectNote.py: * src/Selectors/_SelectorFactory.py: Share button on notetab, enable note selector, normal drag and drop svn: r9215 --- ChangeLog | 7 +++++++ src/DisplayTabs/_EmbeddedList.py | 2 ++ src/DisplayTabs/_NoteTab.py | 27 +++++++++++++-------------- src/Selectors/_SelectNote.py | 2 +- src/Selectors/_SelectorFactory.py | 3 +++ 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f67ce14d..5af971a68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-10-19 Benny Malengier + * src/DisplayTabs/_EmbeddedList.py: traceback to console on ErrorDialog + * src/DisplayTabs/_NoteTab.py: + * src/Selectors/_SelectNote.py: + * src/Selectors/_SelectorFactory.py: + Share button on notetab, enable note selector, normal drag and drop + 2007-10-19 Gary Burton * src/DisplayTabs/_EmbeddedList.py: * src/DisplayTabs/_ButtonTab.py: diff --git a/src/DisplayTabs/_EmbeddedList.py b/src/DisplayTabs/_EmbeddedList.py index 10ad7f19c..019691b30 100644 --- a/src/DisplayTabs/_EmbeddedList.py +++ b/src/DisplayTabs/_EmbeddedList.py @@ -406,6 +406,8 @@ class EmbeddedList(ButtonTab): self.model = self.build_model(self.get_data(), self.dbstate.db) except AttributeError, msg: from QuestionDialog import RunDatabaseRepair + import traceback + traceback.print_exc() RunDatabaseRepair(str(msg)) return diff --git a/src/DisplayTabs/_NoteTab.py b/src/DisplayTabs/_NoteTab.py index f6eeb0925..edfd091b9 100644 --- a/src/DisplayTabs/_NoteTab.py +++ b/src/DisplayTabs/_NoteTab.py @@ -56,11 +56,13 @@ from DdTargets import DdTargets class NoteTab(EmbeddedList): _HANDLE_COL = 2 + _DND_TYPE = DdTargets.NOTE_LINK _MSG = { 'add' : _('Create and add a new note'), 'del' : _('Remove the existing note'), 'edit' : _('Edit the selected note'), + 'share' : _('Add an existing note'), 'up' : _('Move the selected note upwards'), 'down' : _('Move the selected note downwards'), } @@ -76,19 +78,7 @@ class NoteTab(EmbeddedList): self.callertitle = callertitle self.notetype = notetype EmbeddedList.__init__(self, dbstate, uistate, track, - _("Notes"), NoteModel, move=True) - - self.tree.drag_dest_set(gtk.DEST_DEFAULT_ALL, - [DdTargets.NOTE_LINK.target()], - gtk.gdk.ACTION_COPY) - self.tree.connect('drag_data_received', self.on_drag_data_received) - - def on_drag_data_received(self, widget, context, x, y, - selection, info, time): - """Insert the received note to the note list of current object. - """ - (drag_type, idval, obj, val) = pickle.loads(selection.data) - self.add_callback(obj) + _("Notes"), NoteModel, share=True, move=True) def get_editor(self): pass @@ -130,7 +120,16 @@ class NoteTab(EmbeddedList): extratype = [self.notetype] ) except Errors.WindowActiveError: pass - + + def share_button_clicked(self, obj): + from Selectors import selector_factory + SelectNote = selector_factory('Note') + + sel = SelectNote(self.dbstate,self.uistate,self.track) + note = sel.run() + if note: + self.add_callback(note.handle) + def get_icon_name(self): return 'gramps-notes' diff --git a/src/Selectors/_SelectNote.py b/src/Selectors/_SelectNote.py index 6e200161c..94d7e17c9 100644 --- a/src/Selectors/_SelectNote.py +++ b/src/Selectors/_SelectNote.py @@ -51,7 +51,7 @@ class SelectNote(BaseSelector): """ def get_window_title(self): - return _("Select General Note") + return _("Select Note") def get_model_class(self): return NoteModel diff --git a/src/Selectors/_SelectorFactory.py b/src/Selectors/_SelectorFactory.py index a5d640a5f..c11c3e99a 100644 --- a/src/Selectors/_SelectorFactory.py +++ b/src/Selectors/_SelectorFactory.py @@ -44,6 +44,9 @@ def selector_factory(classname): elif classname == 'Repository': from _SelectRepository import SelectRepository cls = SelectRepository + elif classname == 'Note': + from _SelectNote import SelectNote + cls = SelectNote else: raise SelectorException("Attempt to create unknown " "selector class: "