6780: Add privacy column to displaytabs

svn: r22428
This commit is contained in:
Benny Malengier 2013-05-27 12:16:59 +00:00
parent 188587bbaf
commit 8f412bae1c
15 changed files with 67 additions and 53 deletions

View File

@ -56,7 +56,7 @@ class AddrEmbedList(EmbeddedList):
Derives from the EmbeddedList class.
"""
_HANDLE_COL = 6
_HANDLE_COL = 7
_DND_TYPE = DdTargets.ADDRESS
_MSG = {
@ -70,12 +70,13 @@ class AddrEmbedList(EmbeddedList):
#index = column in model. Value =
# (name, sortcol in model, width, markup/text, weigth_col
_column_names = [
(_('Date'), 0, 150, MARKUP_COL, -1, None),
(_('Street'), 1, 225, TEXT_COL, -1, None),
(_('Locality'), 2, 100, TEXT_COL, -1, None),
(_('City'), 3, 100, TEXT_COL, -1, None),
(_('State/County'), 4, 100, TEXT_COL, -1, None),
(_('Country'), 5, 75, TEXT_COL, -1, None),
(_('Date'), 0, 150, MARKUP_COL, -1, None),
(_('Street'), 1, 225, TEXT_COL, -1, None),
(_('Locality'), 2, 100, TEXT_COL, -1, None),
(_('City'), 3, 100, TEXT_COL, -1, None),
(_('State/County'), 4, 100, TEXT_COL, -1, None),
(_('Country'), 5, 75, TEXT_COL, -1, None),
(_('Private'), 6, 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, data):
@ -99,7 +100,7 @@ class AddrEmbedList(EmbeddedList):
"""
Return the column order of the columns in the display tab.
"""
return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5))
return ((1,6), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5))
def add_button_clicked(self, obj):
"""

View File

@ -52,7 +52,7 @@ class AddressModel(Gtk.ListStore):
"""
AddressModel derives from the ListStore, defining te items in the list
"""
Gtk.ListStore.__init__(self, str, str, str, str, str, str, object)
Gtk.ListStore.__init__(self, str, str, str, str, str, str, bool, object)
self.db = dbase
for obj in obj_list:
self.append(row=[
@ -61,6 +61,7 @@ class AddressModel(Gtk.ListStore):
obj.locality,
obj.city,
obj.state,
obj.country,
obj.country,
obj.get_privacy(),
obj,
])

View File

@ -64,7 +64,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
Derives from the EmbeddedList class.
"""
_HANDLE_COL = 4 # Column number from CitationRefModel
_HANDLE_COL = 5 # Column number from CitationRefModel
_DND_TYPE = DdTargets.CITATION_LINK
_DND_EXTRA = DdTargets.SOURCE_LINK
@ -80,10 +80,11 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
#index = column in model. Value =
# (name, sortcol in model, width, markup/text, weigth_col
_column_names = [
(_('Title'), 0, 200, TEXT_COL, -1, None),
(_('Author'), 1, 125, TEXT_COL, -1, None),
(_('Page'), 2, 100, TEXT_COL, -1, None),
(_('ID'), 3, 75, TEXT_COL, -1, None),
(_('Title'), 0, 200, TEXT_COL, -1, None),
(_('Author'), 1, 125, TEXT_COL, -1, None),
(_('Page'), 2, 100, TEXT_COL, -1, None),
(_('ID'), 3, 75, TEXT_COL, -1, None),
(_('Private'), 4, 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, data, callertitle=None):
@ -123,7 +124,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
"""
Return the column order of the columns in the display tab.
"""
return ((1, 0), (1, 1), (1, 2), (1, 3))
return ((1, 4), (1, 0), (1, 1), (1, 2), (1, 3))
def add_button_clicked(self, obj):
"""

View File

@ -36,10 +36,11 @@ from gi.repository import Gtk
class CitationRefModel(Gtk.ListStore):
def __init__(self, citation_list, db):
Gtk.ListStore.__init__(self, str, str, str, str, object)
Gtk.ListStore.__init__(self, str, str, str, str, bool, str)
self.db = db
for handle in citation_list:
citation = self.db.get_citation_from_handle(handle)
src = self.db.get_source_from_handle(citation.get_reference_handle())
self.append(row=[src.title, src.author, citation.page,
citation.gramps_id, handle, ])
citation.gramps_id, citation.get_privacy(),
handle, ])

View File

@ -46,7 +46,7 @@ from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL
#-------------------------------------------------------------------------
class LdsEmbedList(EmbeddedList):
_HANDLE_COL = 5
_HANDLE_COL = 6
# _DND_TYPE = DdTargets.ADDRESS
_MSG = {
@ -64,7 +64,8 @@ class LdsEmbedList(EmbeddedList):
(_('Date'), 1, 150, MARKUP_COL, -1, None),
(_('Status'), 3, 75, TEXT_COL, -1, None),
(_('Temple'), 2, 200, TEXT_COL, -1, None),
(_('Place'), 3, 100, TEXT_COL, -1, None),
(_('Place'), 3, 100, TEXT_COL, -1, None),
(_('Private'), 5, 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, data):
@ -83,7 +84,7 @@ class LdsEmbedList(EmbeddedList):
return self.data
def column_order(self):
return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4))
return ((1, 5), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4))
def add_button_clicked(self, obj):
try:

View File

@ -51,7 +51,7 @@ class LdsModel(Gtk.ListStore):
_HANDLE_COL = 5
def __init__(self, lds_list, db):
Gtk.ListStore.__init__(self, str, str, str, str, str, object)
Gtk.ListStore.__init__(self, str, str, str, str, str, bool, object)
self.db = db
for lds_ord in lds_list:
@ -60,7 +60,8 @@ class LdsModel(Gtk.ListStore):
get_date(lds_ord),
lds_ord.status2str(),
TEMPLES.name(lds_ord.get_temple()),
self.column_place(lds_ord),
self.column_place(lds_ord),
lds_ord.get_privacy(),
lds_ord,
])

View File

@ -35,15 +35,16 @@ from gi.repository import Gtk
class NoteModel(Gtk.ListStore):
def __init__(self, note_list, db):
Gtk.ListStore.__init__(self, str, str, object)
Gtk.ListStore.__init__(self, str, str, bool, str)
self.db = db
for handle in note_list:
note = self.db.get_note_from_handle(handle)
text = note.get().replace('\n', ' ')
text = note.get()[:85].replace('\n', ' ')
if len(text) > 80:
text = text[:80]+"..."
self.append(row=[
str(note.get_type()),
text,
note.get_privacy(),
handle,
])

View File

@ -60,7 +60,7 @@ class NoteTab(EmbeddedList, DbGUIElement):
Derives from the EmbeddedList class.
"""
_HANDLE_COL = 2
_HANDLE_COL = 3
_DND_TYPE = DdTargets.NOTE_LINK
_MSG = {
@ -75,8 +75,9 @@ class NoteTab(EmbeddedList, DbGUIElement):
#index = column in model. Value =
# (name, sortcol in model, width, markup/text, weigth_col
_column_names = [
(_('Type'), 0, 100, TEXT_COL, -1, None),
(_('Preview'), 1, 200, TEXT_COL, -1, None),
(_('Type'), 0, 100, TEXT_COL, -1, None),
(_('Preview'), 1, 200, TEXT_COL, -1, None),
(_('Private'), 2, 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, data, callertitle=None,
@ -117,7 +118,7 @@ class NoteTab(EmbeddedList, DbGUIElement):
"""
Return the column order of the columns in the display tab.
"""
return ((1, 0), (1, 1))
return ((1, 2), (1, 0), (1, 1))
def add_button_clicked(self, obj):
"""

View File

@ -47,7 +47,7 @@ from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL
#-------------------------------------------------------------------------
class PersonRefEmbedList(EmbeddedList):
_HANDLE_COL = 3
_HANDLE_COL = 4
_DND_TYPE = DdTargets.PERSONREF
_MSG = {
@ -61,9 +61,10 @@ class PersonRefEmbedList(EmbeddedList):
#index = column in model. Value =
# (name, sortcol in model, width, markup/text
_column_names = [
(_('Name'), 0, 250, TEXT_COL, -1, None),
(_('ID'), 1, 100, TEXT_COL, -1, None),
(_('Association'), 2, 100, TEXT_COL, -1, None),
(_('Name'), 0, 250, TEXT_COL, -1, None),
(_('ID'), 1, 100, TEXT_COL, -1, None),
(_('Association'), 2, 100, TEXT_COL, -1, None),
(_('Private'), 3, 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, data):
@ -80,7 +81,7 @@ class PersonRefEmbedList(EmbeddedList):
return self.data
def column_order(self):
return ((1, 0), (1, 1), (1, 2))
return ((1,3), (1, 0), (1, 1), (1, 2))
def add_button_clicked(self, obj):
from .. import EditPersonRef

View File

@ -42,12 +42,13 @@ from gramps.gen.display.name import displayer as name_displayer
class PersonRefModel(Gtk.ListStore):
def __init__(self, obj_list, db):
Gtk.ListStore.__init__(self, str, str, str, object)
Gtk.ListStore.__init__(self, str, str, str, bool, object)
self.db = db
for obj in obj_list:
p = self.db.get_person_from_handle(obj.ref)
if p:
data = [name_displayer.display(p), p.gramps_id, obj.rel, obj]
data = [name_displayer.display(p), p.gramps_id, obj.rel,
obj.get_privacy(), obj]
else:
data = ['unknown','unknown', obj.rel, obj]
data = ['unknown','unknown', obj.rel, obj.get_privacy(), obj]
self.append(row=data)

View File

@ -49,7 +49,7 @@ from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL
#-------------------------------------------------------------------------
class RepoEmbedList(EmbeddedList, DbGUIElement):
_HANDLE_COL = 4
_HANDLE_COL = 5
_DND_TYPE = DdTargets.REPOREF
_DND_EXTRA = DdTargets.REPO_LINK
@ -65,10 +65,11 @@ class RepoEmbedList(EmbeddedList, DbGUIElement):
#index = column in model. Value =
# (name, sortcol in model, width, markup/text, weigth_col
_column_names = [
(_('ID'), 0, 75, TEXT_COL, -1, None),
(_('Title'), 1, 200, TEXT_COL, -1, None),
(_('Call Number'), 2, 125, TEXT_COL, -1, None),
(_('Type'), 3, 100, TEXT_COL, -1, None),
(_('ID'), 0, 75, TEXT_COL, -1, None),
(_('Title'), 1, 200, TEXT_COL, -1, None),
(_('Call Number'), 2, 125, TEXT_COL, -1, None),
(_('Type'), 3, 100, TEXT_COL, -1, None),
(_('Private'), 4, 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, obj):
@ -98,7 +99,7 @@ class RepoEmbedList(EmbeddedList, DbGUIElement):
return self.obj
def column_order(self):
return ((1, 0), (1, 1), (1, 2), (1, 3))
return ((1, 4), (1, 0), (1, 1), (1, 2), (1, 3))
def handle_extra_type(self, objtype, obj):
from .. import EditRepoRef

View File

@ -42,7 +42,7 @@ from gi.repository import Gtk
class RepoRefModel(Gtk.ListStore):
def __init__(self, ref_list, db):
Gtk.ListStore.__init__(self, str, str, str, str, object)
Gtk.ListStore.__init__(self, str, str, str, str, bool, object)
self.db = db
for ref in ref_list:
repo = self.db.get_repository_from_handle(ref.ref)
@ -51,4 +51,5 @@ class RepoRefModel(Gtk.ListStore):
repo.name,
ref.call_number,
str(repo.get_type()),
ref.get_privacy(),
ref, ])

View File

@ -61,8 +61,8 @@ class SrcAttrEmbedList(EmbeddedList):
#index = column in model. Value =
# (name, sortcol in model, width, markup/text, weigth_col, icon
_column_names = [
(_('Type'), 0, 250, TEXT_COL, -1, None),
(_('Value'), 1, 200, TEXT_COL, -1, None),
(_('Type'), 0, 250, TEXT_COL, -1, None),
(_('Value'), 1, 200, TEXT_COL, -1, None),
(_('Private'), 2, 30, ICON_COL, -1, 'gramps-lock')
]

View File

@ -48,7 +48,7 @@ from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL
#-------------------------------------------------------------------------
class WebEmbedList(EmbeddedList):
_HANDLE_COL = 3
_HANDLE_COL = 4
_DND_TYPE = DdTargets.URL
_MSG = {
@ -63,9 +63,10 @@ class WebEmbedList(EmbeddedList):
#index = column in model. Value =
# (name, sortcol in model, width, markup/text, weigth_col
_column_names = [
(_('Type') , 0, 100, TEXT_COL, -1, None),
(_('Path') , 1, 200, TEXT_COL, -1, None),
(_('Description'), 2, 150, TEXT_COL, -1, None),
(_('Type') , 0, 100, TEXT_COL, -1, None),
(_('Path') , 1, 200, TEXT_COL, -1, None),
(_('Description'), 2, 150, TEXT_COL, -1, None),
(_('Private'), 3, 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, data):
@ -80,7 +81,7 @@ class WebEmbedList(EmbeddedList):
return self.data
def column_order(self):
return ((1, 0), (1, 1), (1, 2))
return ((1, 3), (1, 0), (1, 1), (1, 2))
def add_button_clicked(self, obj):
from .. import EditUrl

View File

@ -42,7 +42,8 @@ class WebModel(Gtk.ListStore):
"""
def __init__(self, obj_list, dbase):
Gtk.ListStore.__init__(self, str, str, str, object)
Gtk.ListStore.__init__(self, str, str, str, bool, object)
self.db = dbase
for obj in obj_list:
self.append(row=[str(obj.type), obj.path, obj.desc, obj])
self.append(row=[str(obj.type), obj.path, obj.desc,
obj.get_privacy(), obj])