1#
2# Gramps - a GTK+/GNOME based genealogy program
3#
4# Copyright (C) 2003-2006  Donald N. Allingham
5#               2009       Gary Burton
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21
22"""Handling of selection dialog for selecting notes
23"""
24
25#-------------------------------------------------------------------------
26#
27# Python Modules
28#
29#-------------------------------------------------------------------------
30
31#-------------------------------------------------------------------------
32#
33# Gramps Modules
34#
35#-------------------------------------------------------------------------
36from gramps.gen.const import GRAMPS_LOCALE as glocale
37_ = glocale.translation.sgettext
38from ..views.treemodels import NoteModel
39from .baseselector import BaseSelector
40from gramps.gen.const import URL_MANUAL_SECT1
41
42#-------------------------------------------------------------------------
43#
44# Constants
45#
46#-------------------------------------------------------------------------
47
48#-------------------------------------------------------------------------
49#
50# SelectNote
51#
52#-------------------------------------------------------------------------
53class SelectNote(BaseSelector):
54    """ Class that handles the selection of a note
55    """
56
57    def _local_init(self):
58        """
59        Perform local initialisation for this class
60        """
61        self.setup_configs('interface.note-sel', 600, 450)
62
63    def get_window_title(self):
64        return _("Select Note")
65
66    def get_model_class(self):
67        return NoteModel
68
69    def get_column_titles(self):
70        return [
71            (_('Preview'), 350, BaseSelector.TEXT, 0),
72            (_('ID'),      75,  BaseSelector.TEXT, 1),
73            (_('Type'),    100, BaseSelector.TEXT, 2),
74            (_('Tags'),    100, BaseSelector.TEXT, 4),
75            (_('Last Change'), 150, BaseSelector.TEXT, 5),
76            ]
77
78    def get_from_handle_func(self):
79        return self.db.get_note_from_handle
80
81    WIKI_HELP_PAGE = URL_MANUAL_SECT1
82    WIKI_HELP_SEC = _('manual|Select_Note_selector')
83