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>
* src/DisplayTabs/_EmbeddedList.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)
except AttributeError, msg:
from QuestionDialog import RunDatabaseRepair
import traceback
traceback.print_exc()
RunDatabaseRepair(str(msg))
return

View File

@ -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'

View File

@ -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

View File

@ -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: "