2007-10-19 Benny Malengier <benny.malengier@gramps-project.org>

* 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
This commit is contained in:
Benny Malengier 2007-10-19 22:03:15 +00:00
parent 0d285b9bb4
commit 132f884c4e
5 changed files with 26 additions and 15 deletions

View File

@ -1,3 +1,10 @@
2007-10-19 Benny Malengier <benny.malengier@gramps-project.org>
* 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 <gary.burton@zen.co.uk> 2007-10-19 Gary Burton <gary.burton@zen.co.uk>
* src/DisplayTabs/_EmbeddedList.py: * src/DisplayTabs/_EmbeddedList.py:
* src/DisplayTabs/_ButtonTab.py: * src/DisplayTabs/_ButtonTab.py:

View File

@ -406,6 +406,8 @@ class EmbeddedList(ButtonTab):
self.model = self.build_model(self.get_data(), self.dbstate.db) self.model = self.build_model(self.get_data(), self.dbstate.db)
except AttributeError, msg: except AttributeError, msg:
from QuestionDialog import RunDatabaseRepair from QuestionDialog import RunDatabaseRepair
import traceback
traceback.print_exc()
RunDatabaseRepair(str(msg)) RunDatabaseRepair(str(msg))
return return

View File

@ -56,11 +56,13 @@ from DdTargets import DdTargets
class NoteTab(EmbeddedList): class NoteTab(EmbeddedList):
_HANDLE_COL = 2 _HANDLE_COL = 2
_DND_TYPE = DdTargets.NOTE_LINK
_MSG = { _MSG = {
'add' : _('Create and add a new note'), 'add' : _('Create and add a new note'),
'del' : _('Remove the existing note'), 'del' : _('Remove the existing note'),
'edit' : _('Edit the selected note'), 'edit' : _('Edit the selected note'),
'share' : _('Add an existing note'),
'up' : _('Move the selected note upwards'), 'up' : _('Move the selected note upwards'),
'down' : _('Move the selected note downwards'), 'down' : _('Move the selected note downwards'),
} }
@ -76,19 +78,7 @@ class NoteTab(EmbeddedList):
self.callertitle = callertitle self.callertitle = callertitle
self.notetype = notetype self.notetype = notetype
EmbeddedList.__init__(self, dbstate, uistate, track, EmbeddedList.__init__(self, dbstate, uistate, track,
_("Notes"), NoteModel, move=True) _("Notes"), NoteModel, share=True, 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)
def get_editor(self): def get_editor(self):
pass pass
@ -130,7 +120,16 @@ class NoteTab(EmbeddedList):
extratype = [self.notetype] ) extratype = [self.notetype] )
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass 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): def get_icon_name(self):
return 'gramps-notes' return 'gramps-notes'

View File

@ -51,7 +51,7 @@ class SelectNote(BaseSelector):
""" """
def get_window_title(self): def get_window_title(self):
return _("Select General Note") return _("Select Note")
def get_model_class(self): def get_model_class(self):
return NoteModel return NoteModel

View File

@ -44,6 +44,9 @@ def selector_factory(classname):
elif classname == 'Repository': elif classname == 'Repository':
from _SelectRepository import SelectRepository from _SelectRepository import SelectRepository
cls = SelectRepository cls = SelectRepository
elif classname == 'Note':
from _SelectNote import SelectNote
cls = SelectNote
else: else:
raise SelectorException("Attempt to create unknown " raise SelectorException("Attempt to create unknown "
"selector class: " "selector class: "