diff --git a/data/grampsxml.dtd b/data/grampsxml.dtd
index 309530ec1..8c0759e3e 100644
--- a/data/grampsxml.dtd
+++ b/data/grampsxml.dtd
@@ -3,8 +3,9 @@
-
+
- 3
False
+ 3
diff --git a/src/glade/mergefamily.glade b/src/glade/mergefamily.glade
index bf242fb32..d52fa1172 100644
--- a/src/glade/mergefamily.glade
+++ b/src/glade/mergefamily.glade
@@ -1,7 +1,7 @@
-
+
True
500
@@ -24,6 +24,7 @@
False
False
15
+ 0
@@ -44,6 +45,7 @@ primary data for the merged family.
True
True
+ False
True
@@ -55,12 +57,14 @@ primary data for the merged family.
False
False
+ 0
True
True
+ False
True
handle_btn1
@@ -94,7 +98,7 @@ primary data for the merged family.
True
6
- 6
+ 5
4
6
6
@@ -227,41 +231,6 @@ primary data for the merged family.
-
-
- Marker:
- True
- True
- False
- True
- True
-
-
- 4
- 5
- GTK_FILL
-
-
-
-
-
- Marker:
- True
- True
- False
- True
- True
- marker_btn1
-
-
- 2
- 3
- 4
- 5
- GTK_FILL
-
-
-
Gramps ID:
@@ -272,8 +241,8 @@ primary data for the merged family.
True
- 5
- 6
+ 4
+ 5
GTK_FILL
@@ -291,8 +260,8 @@ primary data for the merged family.
2
3
- 5
- 6
+ 4
+ 5
GTK_FILL
@@ -381,34 +350,6 @@ primary data for the merged family.
-
-
- True
- True
- False
-
-
- 1
- 2
- 4
- 5
-
-
-
-
-
- True
- True
- False
-
-
- 3
- 4
- 4
- 5
-
-
-
True
@@ -418,8 +359,8 @@ primary data for the merged family.
1
2
- 5
- 6
+ 4
+ 5
@@ -432,8 +373,8 @@ primary data for the merged family.
3
4
- 5
- 6
+ 4
+ 5
@@ -443,42 +384,15 @@ primary data for the merged family.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ 0
+
True
- Events, lds_ord, media objects, attributes, notes and sources of both families will be combined.
+ Events, lds_ord, media objects, attributes, notes, sources and tags of both families will be combined.
True
@@ -496,8 +410,8 @@ primary data for the merged family.
- 3
False
+ 3
diff --git a/src/glade/mergemedia.glade b/src/glade/mergemedia.glade
index 042d3e44c..eb4390307 100644
--- a/src/glade/mergemedia.glade
+++ b/src/glade/mergemedia.glade
@@ -1,7 +1,7 @@
-
+
True
500
@@ -23,6 +23,7 @@
False
False
15
+ 0
@@ -43,6 +44,7 @@ primary data for the merged object.
True
True
+ False
True
@@ -54,12 +56,14 @@ primary data for the merged object.
False
False
+ 0
True
True
+ False
True
handle_btn1
@@ -379,42 +383,15 @@ primary data for the merged object.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ 0
+
True
- Attributes, sources and notes of both objects will be combined.
+ Attributes, sources, notes and tags of both objects will be combined.
True
@@ -432,8 +409,8 @@ primary data for the merged object.
- 3
False
+ 3
diff --git a/src/glade/mergenote.glade b/src/glade/mergenote.glade
index 9533bb7c9..fbe30e4a9 100644
--- a/src/glade/mergenote.glade
+++ b/src/glade/mergenote.glade
@@ -1,7 +1,7 @@
-
+
True
600
@@ -23,6 +23,7 @@
False
False
15
+ 0
@@ -43,6 +44,7 @@ primary data for the merged note.
True
True
+ False
True
@@ -54,12 +56,14 @@ primary data for the merged note.
False
False
+ 0
True
True
+ False
True
handle_btn1
@@ -93,7 +97,7 @@ primary data for the merged note.
True
6
- 6
+ 5
4
6
6
@@ -226,41 +230,6 @@ primary data for the merged note.
-
-
- Marker:
- True
- True
- False
- True
- True
-
-
- 4
- 5
- GTK_FILL
-
-
-
-
-
- Marker:
- True
- True
- False
- True
- True
- marker_btn1
-
-
- 2
- 3
- 4
- 5
- GTK_FILL
-
-
-
Gramps ID:
@@ -271,8 +240,8 @@ primary data for the merged note.
True
- 5
- 6
+ 4
+ 5
GTK_FILL
@@ -290,8 +259,8 @@ primary data for the merged note.
2
3
- 5
- 6
+ 4
+ 5
GTK_FILL
@@ -331,7 +300,6 @@ primary data for the merged note.
True
True
False
- word
@@ -399,34 +367,6 @@ primary data for the merged note.
-
-
- True
- True
- False
-
-
- 1
- 2
- 4
- 5
-
-
-
-
-
- True
- True
- False
-
-
- 3
- 4
- 4
- 5
-
-
-
True
@@ -436,8 +376,8 @@ primary data for the merged note.
1
2
- 5
- 6
+ 4
+ 5
@@ -450,8 +390,8 @@ primary data for the merged note.
3
4
- 5
- 6
+ 4
+ 5
@@ -461,42 +401,14 @@ primary data for the merged note.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ 0
+
True
-
True
diff --git a/src/glade/mergeperson.glade b/src/glade/mergeperson.glade
index 43d1f00e3..94e4607ea 100644
--- a/src/glade/mergeperson.glade
+++ b/src/glade/mergeperson.glade
@@ -1,7 +1,7 @@
-
+
True
700
@@ -23,6 +23,7 @@
False
False
15
+ 0
@@ -43,6 +44,7 @@ primary data for the merged person.
True
True
+ False
True
@@ -54,12 +56,14 @@ primary data for the merged person.
False
False
+ 0
True
True
+ False
True
handle_btn1
@@ -93,7 +97,7 @@ primary data for the merged person.
True
6
- 5
+ 4
4
6
6
@@ -191,41 +195,6 @@ primary data for the merged person.
-
-
- Marker:
- True
- True
- False
- True
- True
-
-
- 3
- 4
- GTK_FILL
-
-
-
-
-
- Marker:
- True
- True
- False
- True
- True
- marker_btn1
-
-
- 2
- 3
- 3
- 4
- GTK_FILL
-
-
-
Gramps ID:
@@ -236,8 +205,8 @@ primary data for the merged person.
True
- 4
- 5
+ 3
+ 4
GTK_FILL
@@ -255,8 +224,8 @@ primary data for the merged person.
2
3
- 4
- 5
+ 3
+ 4
GTK_FILL
@@ -317,34 +286,6 @@ primary data for the merged person.
-
-
- True
- True
- False
-
-
- 1
- 2
- 3
- 4
-
-
-
-
-
- True
- True
- False
-
-
- 3
- 4
- 3
- 4
-
-
-
True
@@ -354,8 +295,8 @@ primary data for the merged person.
1
2
- 4
- 5
+ 3
+ 4
@@ -368,8 +309,8 @@ primary data for the merged person.
3
4
- 4
- 5
+ 3
+ 4
@@ -379,36 +320,15 @@ primary data for the merged person.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ 0
+
True
- Events, media objects, addresses, attributes, urls, notes and sources of both persons will be combined.
+ Events, media objects, addresses, attributes, urls, notes, sources and tags of both persons will be combined.
True
@@ -426,8 +346,8 @@ primary data for the merged person.
- 3
False
+ 3
@@ -437,7 +357,6 @@ primary data for the merged person.
True
- horizontal
5
diff --git a/src/gui/editors/editfamily.py b/src/gui/editors/editfamily.py
index 9d54f60ed..c2fff573e 100644
--- a/src/gui/editors/editfamily.py
+++ b/src/gui/editors/editfamily.py
@@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -67,7 +68,8 @@ from editperson import EditPerson
from displaytabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
FamilyAttrEmbedList, NoteTab, GalleryTab,
FamilyLdsEmbedList, ChildModel)
-from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType)
+from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
+ MonitoredTagList)
from gen.plug import CATEGORY_QR_FAMILY
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
MessageHideDialog)
@@ -95,8 +97,8 @@ class ChildEmbedList(EmbeddedList):
'del' : _('Remove the child from the family'),
'edit' : _('Edit the child reference'),
'share' : _('Add an existing person as a child of the family'),
- 'up' : _('Move the child up in the childrens list'),
- 'down' : _('Move the child down in the childrens list'),
+ 'up' : _('Move the child up in the childrens list'),
+ 'down' : _('Move the child down in the childrens list'),
}
_column_names = [
@@ -485,7 +487,7 @@ class EditFamily(EditPrimary):
self.obj.mother_handle != objreal.mother_handle or
self.obj.private != objreal.private or
self.obj.type != objreal.type or
- self.obj.marker != objreal.marker or
+ self.obj.get_tag_list() != objreal.get_tag_list() or
self.obj.child_ref_list != objreal.child_ref_list)
if maindatachanged:
self.obj.gramps_id = objreal.gramps_id
@@ -493,7 +495,7 @@ class EditFamily(EditPrimary):
self.obj.mother_handle = objreal.mother_handle
self.obj.private = objreal.private
self.obj.type = objreal.type
- self.obj.marker = objreal.marker
+ self.obj.set_tag_list(objreal.get_tag_list())
self.obj.child_ref_list = objreal.child_ref_list
self.reload_people()
@@ -625,13 +627,14 @@ class EditFamily(EditPrimary):
self.obj.get_gramps_id,
self.db.readonly)
- self.marker = MonitoredDataType(
- self.top.get_object('marker'),
- self.obj.set_marker,
- self.obj.get_marker,
- self.db.readonly,
- self.db.get_marker_types(),
- )
+ self.tags = MonitoredTagList(
+ self.top.get_object("tag_label"),
+ self.top.get_object("tag_button"),
+ self.obj.set_tag_list,
+ self.obj.get_tag_list,
+ self.db,
+ self.uistate, self.track,
+ self.db.readonly)
self.data_type = MonitoredDataType(
self.top.get_object('marriage_type'),
diff --git a/src/gui/editors/editmedia.py b/src/gui/editors/editmedia.py
index 5667bb131..53dd4c9d0 100644
--- a/src/gui/editors/editmedia.py
+++ b/src/gui/editors/editmedia.py
@@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,7 +47,8 @@ import gen.mime
import ThumbNails
import Utils
from editprimary import EditPrimary
-from gui.widgets import MonitoredDate, MonitoredEntry, PrivacyButton
+from gui.widgets import (MonitoredDate, MonitoredEntry, PrivacyButton,
+ MonitoredTagList)
from displaytabs import (SourceEmbedList, AttrEmbedList, NoteTab,
MediaBackRefList)
from addmedia import AddMediaObject
@@ -125,6 +127,15 @@ class EditMedia(EditPrimary):
self.obj.set_gramps_id,
self.obj.get_gramps_id, self.db.readonly)
+ self.tags = MonitoredTagList(
+ self.glade.get_object("tag_label"),
+ self.glade.get_object("tag_button"),
+ self.obj.set_tag_list,
+ self.obj.get_tag_list,
+ self.db,
+ self.uistate, self.track,
+ self.db.readonly)
+
self.privacy = PrivacyButton(self.glade.get_object("private"),
self.obj, self.db.readonly)
diff --git a/src/gui/editors/editnote.py b/src/gui/editors/editnote.py
index 3f02135fe..c32788996 100644
--- a/src/gui/editors/editnote.py
+++ b/src/gui/editors/editnote.py
@@ -2,8 +2,9 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
-# 2009 Gary Burton
-# 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,7 +51,7 @@ import const
from editprimary import EditPrimary
from displaytabs import GrampsTab, NoteBackRefList
from gui.widgets import (MonitoredDataType, MonitoredCheckbox,
- MonitoredEntry, PrivacyButton)
+ MonitoredEntry, PrivacyButton, MonitoredTagList)
from gen.lib import Note
from QuestionDialog import ErrorDialog
from glade import Glade
@@ -204,13 +205,15 @@ class EditNote(EditPrimary):
self.obj.set_gramps_id,
self.obj.get_gramps_id,
self.db.readonly)
-
- self.marker = MonitoredDataType(
- self.top.get_object('marker'),
- self.obj.set_marker,
- self.obj.get_marker,
- self.db.readonly,
- self.db.get_marker_types())
+
+ self.tags = MonitoredTagList(
+ self.top.get_object("tag_label"),
+ self.top.get_object("tag_button"),
+ self.obj.set_tag_list,
+ self.obj.get_tag_list,
+ self.db,
+ self.uistate, self.track,
+ self.db.readonly)
self.priv = PrivacyButton(
self.top.get_object("private"),
diff --git a/src/gui/editors/editperson.py b/src/gui/editors/editperson.py
index 712ecc297..fc8037dd4 100644
--- a/src/gui/editors/editperson.py
+++ b/src/gui/editors/editperson.py
@@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -253,14 +254,6 @@ class EditPerson(EditPrimary):
),
self.db.readonly)
- self.marker = widgets.MonitoredDataType(
- self.top.get_object('marker'),
- self.obj.set_marker,
- self.obj.get_marker,
- self.db.readonly,
- self.db.get_marker_types(),
- )
-
self.ntype_field = widgets.MonitoredDataType(
self.top.get_object("ntype"),
self.pname.set_type,
diff --git a/src/gui/views/listview.py b/src/gui/views/listview.py
index b9037250f..f3852ab14 100644
--- a/src/gui/views/listview.py
+++ b/src/gui/views/listview.py
@@ -225,9 +225,9 @@ class ListView(NavigationView):
column = gtk.TreeViewColumn(name, self.renderer)
- if self.model and self.model.marker_column() is not None:
- mcol = self.model.marker_column()
- column.add_attribute(self.renderer, 'foreground', mcol)
+ if self.model and self.model.color_column() is not None:
+ fg_col = self.model.color_column()
+ column.add_attribute(self.renderer, 'foreground', fg_col)
if pair[1] in self.markup_columns:
column.add_attribute(self.renderer, 'markup', pair[1])
diff --git a/src/gui/views/treemodels/familymodel.py b/src/gui/views/treemodels/familymodel.py
index 25bdff7e2..c4863a921 100644
--- a/src/gui/views/treemodels/familymodel.py
+++ b/src/gui/views/treemodels/familymodel.py
@@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,6 +27,7 @@
#-------------------------------------------------------------------------
import logging
log = logging.getLogger(".")
+import locale
#-------------------------------------------------------------------------
#
@@ -56,8 +58,6 @@ from gui.views.treemodels.flatbasemodel import FlatBaseModel
#-------------------------------------------------------------------------
class FamilyModel(FlatBaseModel):
- _MARKER_COL = 13
-
def __init__(self, db, scol=0, order=gtk.SORT_ASCENDING, search=None,
skip=set(), sort_map=None):
self.gen_cursor = db.get_family_cursor
@@ -68,11 +68,11 @@ class FamilyModel(FlatBaseModel):
self.column_mother,
self.column_type,
self.column_marriage,
+ self.column_tags,
self.column_change,
self.column_handle,
- self.column_tooltip,
- self.column_marker_text,
- self.column_marker_color,
+ self.column_tag_color,
+ self.column_tooltip,
]
self.smap = [
self.column_id,
@@ -80,20 +80,20 @@ class FamilyModel(FlatBaseModel):
self.sort_mother,
self.column_type,
self.sort_marriage,
+ self.column_tags,
self.sort_change,
self.column_handle,
- self.column_tooltip,
- self.column_marker_text,
- self.column_marker_color,
+ self.column_tag_color,
+ self.column_tooltip,
]
- FlatBaseModel.__init__(self, db, scol, order, tooltip_column=7,
+ FlatBaseModel.__init__(self, db, scol, order, tooltip_column=9,
search=search, skip=skip, sort_map=sort_map)
- def marker_column(self):
+ def color_column(self):
"""
- Return the column for marker colour.
+ Return the color column.
"""
- return 9
+ return 8
def on_get_n_columns(self):
return len(self.fmap)+1
@@ -159,27 +159,6 @@ class FamilyModel(FlatBaseModel):
def column_change(self, data):
return Utils.format_time(data[12])
- def column_marker_text(self, data):
- try:
- if data[FamilyModel._MARKER_COL]:
- return str(data[FamilyModel._MARKER_COL])
- except IndexError:
- return ""
- return ""
-
- def column_marker_color(self, data):
- try:
- col = data[FamilyModel._MARKER_COL][0]
- if col == gen.lib.MarkerType.COMPLETE:
- return self.complete_color
- elif col == gen.lib.MarkerType.TODO_TYPE:
- return self.todo_color
- elif col == gen.lib.MarkerType.CUSTOM:
- return self.custom_color
- except IndexError:
- pass
- return None
-
def column_tooltip(self, data):
if const.USE_TIPS:
try:
@@ -191,3 +170,30 @@ class FamilyModel(FlatBaseModel):
return t
else:
return u''
+
+ def get_tag_name(self, tag_handle):
+ """
+ Return the tag name from the given tag handle.
+ """
+ return self.db.get_tag_from_handle(tag_handle).get_name()
+
+ def column_tag_color(self, data):
+ """
+ Return the tag color.
+ """
+ tag_color = '#000000000000'
+ tag_priority = None
+ for handle in data[13]:
+ tag = self.db.get_tag_from_handle(handle)
+ this_priority = tag.get_priority()
+ if tag_priority is None or this_priority < tag_priority:
+ tag_color = tag.get_color()
+ tag_priority = this_priority
+ return tag_color
+
+ def column_tags(self, data):
+ """
+ Return the sorted list of tags.
+ """
+ tag_list = map(self.get_tag_name, data[13])
+ return ', '.join(sorted(tag_list, key=locale.strxfrm))
diff --git a/src/gui/views/treemodels/flatbasemodel.py b/src/gui/views/treemodels/flatbasemodel.py
index 22235e05f..679b9b8db 100644
--- a/src/gui/views/treemodels/flatbasemodel.py
+++ b/src/gui/views/treemodels/flatbasemodel.py
@@ -2,7 +2,8 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
-# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -493,9 +494,9 @@ class FlatBaseModel(gtk.GenericTreeModel):
"""
return self._tooltip_column
- def marker_column(self):
+ def color_column(self):
"""
- Return the column for marker colour.
+ Return the color column.
"""
return None
diff --git a/src/gui/views/treemodels/mediamodel.py b/src/gui/views/treemodels/mediamodel.py
index e8af129ce..21c750877 100644
--- a/src/gui/views/treemodels/mediamodel.py
+++ b/src/gui/views/treemodels/mediamodel.py
@@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,6 +28,7 @@
from gen.ggettext import gettext as _
import logging
log = logging.getLogger(".")
+import locale
#-------------------------------------------------------------------------
#
@@ -64,9 +66,11 @@ class MediaModel(FlatBaseModel):
self.column_id,
self.column_mime,
self.column_path,
- self.column_change,
self.column_date,
+ self.column_tags,
+ self.column_change,
self.column_handle,
+ self.column_tag_color,
self.column_tooltip
]
@@ -75,13 +79,22 @@ class MediaModel(FlatBaseModel):
self.column_id,
self.column_mime,
self.column_path,
- self.sort_change,
self.sort_date,
+ self.column_tags,
+ self.sort_change,
self.column_handle,
+ self.column_tag_color,
+ self.column_tooltip
]
- FlatBaseModel.__init__(self, db, scol, order, tooltip_column=7,
+ FlatBaseModel.__init__(self, db, scol, order, tooltip_column=9,
search=search, skip=skip, sort_map=sort_map)
+ def color_column(self):
+ """
+ Return the color column.
+ """
+ return 8
+
def on_get_n_columns(self):
return len(self.fmap)+1
@@ -141,3 +154,30 @@ class MediaModel(FlatBaseModel):
return t
else:
return u''
+
+ def get_tag_name(self, tag_handle):
+ """
+ Return the tag name from the given tag handle.
+ """
+ return self.db.get_tag_from_handle(tag_handle).get_name()
+
+ def column_tag_color(self, data):
+ """
+ Return the tag color.
+ """
+ tag_color = '#000000000000'
+ tag_priority = None
+ for handle in data[10]:
+ tag = self.db.get_tag_from_handle(handle)
+ this_priority = tag.get_priority()
+ if tag_priority is None or this_priority < tag_priority:
+ tag_color = tag.get_color()
+ tag_priority = this_priority
+ return tag_color
+
+ def column_tags(self, data):
+ """
+ Return the sorted list of tags.
+ """
+ tag_list = map(self.get_tag_name, data[10])
+ return ', '.join(sorted(tag_list, key=locale.strxfrm))
diff --git a/src/gui/views/treemodels/notemodel.py b/src/gui/views/treemodels/notemodel.py
index bdb1ea4e8..99631b83d 100644
--- a/src/gui/views/treemodels/notemodel.py
+++ b/src/gui/views/treemodels/notemodel.py
@@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,6 +27,7 @@
#-------------------------------------------------------------------------
import logging
_LOG = logging.getLogger(".gui.notemodel")
+import locale
#-------------------------------------------------------------------------
#
@@ -41,7 +43,7 @@ import gtk
#-------------------------------------------------------------------------
import Utils
from gui.views.treemodels.flatbasemodel import FlatBaseModel
-from gen.lib import (Note, NoteType, MarkerType, StyledText)
+from gen.lib import (Note, NoteType, StyledText)
#-------------------------------------------------------------------------
#
@@ -60,26 +62,26 @@ class NoteModel(FlatBaseModel):
self.column_preview,
self.column_id,
self.column_type,
- self.column_marker,
+ self.column_tags,
self.column_change,
self.column_handle,
- self.column_marker_color
+ self.column_tag_color
]
self.smap = [
self.column_preview,
self.column_id,
self.column_type,
- self.column_marker,
+ self.column_tags,
self.sort_change,
self.column_handle,
- self.column_marker_color
+ self.column_tag_color
]
FlatBaseModel.__init__(self, db, scol, order, search=search,
skip=skip, sort_map=sort_map)
- def marker_column(self):
+ def color_column(self):
"""
- Return the column for marker colour.
+ Return the color column.
"""
return 6
@@ -101,12 +103,6 @@ class NoteModel(FlatBaseModel):
temp.set(data[Note.POS_TYPE])
return unicode(str(temp))
- def column_marker(self, data):
- """Return the marker type of the Note in readable format."""
- temp = MarkerType()
- temp.set(data[Note.POS_MARKER])
- return unicode(str(temp))
-
def column_preview(self, data):
"""Return a shortend version of the Note's text."""
#data is the encoding in the database, make it a unicode object
@@ -118,23 +114,35 @@ class NoteModel(FlatBaseModel):
else:
return note
- def column_marker_color(self, data):
- """Return the color of the Note's marker type if exist."""
- try:
- col = data[Note.POS_MARKER][MarkerType.POS_VALUE]
- if col == MarkerType.COMPLETE:
- return self.complete_color
- elif col == MarkerType.TODO_TYPE:
- return self.todo_color
- elif col == MarkerType.CUSTOM:
- return self.custom_color
- else:
- return None
- except IndexError:
- return None
-
def sort_change(self, data):
return "%012x" % data[Note.POS_CHANGE]
def column_change(self,data):
return Utils.format_time(data[Note.POS_CHANGE])
+
+ def get_tag_name(self, tag_handle):
+ """
+ Return the tag name from the given tag handle.
+ """
+ return self.db.get_tag_from_handle(tag_handle).get_name()
+
+ def column_tag_color(self, data):
+ """
+ Return the tag color.
+ """
+ tag_color = '#000000000000'
+ tag_priority = None
+ for handle in data[Note.POS_TAGS]:
+ tag = self.db.get_tag_from_handle(handle)
+ this_priority = tag.get_priority()
+ if tag_priority is None or this_priority < tag_priority:
+ tag_color = tag.get_color()
+ tag_priority = this_priority
+ return tag_color
+
+ def column_tags(self, data):
+ """
+ Return the sorted list of tags.
+ """
+ tag_list = map(self.get_tag_name, data[Note.POS_TAGS])
+ return ', '.join(sorted(tag_list, key=locale.strxfrm))
diff --git a/src/gui/views/treemodels/peoplemodel.py b/src/gui/views/treemodels/peoplemodel.py
index 80ac892cc..1a5114e9b 100644
--- a/src/gui/views/treemodels/peoplemodel.py
+++ b/src/gui/views/treemodels/peoplemodel.py
@@ -3,7 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
-# Copyright (C) 2009 Nick Hall
+# Copyright (C) 2009-2010 Nick Hall
# Copyright (C) 2009 Benny Malengier
#
# This program is free software; you can redistribute it and/or modify
@@ -57,7 +57,7 @@ _LOG = logging.getLogger(".")
#
#-------------------------------------------------------------------------
import const
-from gen.lib import Name, EventRef, EventType, EventRoleType, MarkerType
+from gen.lib import Name, EventRef, EventType, EventRoleType
from gen.display.name import displayer as name_displayer
import DateHandler
import ToolTips
@@ -79,9 +79,8 @@ COLUMN_DEATH = 5
COLUMN_BIRTH = 6
COLUMN_EVENT = 7
COLUMN_FAMILY = 8
-COLUMN_TAGS = 21
COLUMN_CHANGE = 17
-COLUMN_MARKER = 18
+COLUMN_TAGS = 18
invalid_date_format = config.get('preferences.invalid-date-format')
@@ -121,7 +120,6 @@ class PeopleBaseModel(object):
self.column_tags,
self.column_change,
self.column_int_id,
- self.column_marker_text,
self.column_tag_color,
self.column_tooltip,
]
@@ -137,7 +135,6 @@ class PeopleBaseModel(object):
self.column_tags,
self.sort_change,
self.column_int_id,
- self.column_marker_text,
self.column_tag_color,
self.column_tooltip,
]
@@ -150,11 +147,11 @@ class PeopleBaseModel(object):
self.lru_bdate = LRU(PeopleBaseModel._CACHE_SIZE)
self.lru_ddate = LRU(PeopleBaseModel._CACHE_SIZE)
- def marker_column(self):
+ def color_column(self):
"""
- Return the column for marker colour.
+ Return the color column.
"""
- return 12
+ return 11
def clear_local_cache(self, handle=None):
""" Clear the LRU cache """
@@ -419,11 +416,6 @@ class PeopleBaseModel(object):
return "" + cgi.escape(place_title) + ""
return u""
- def column_marker_text(self, data):
- if COLUMN_MARKER < len(data):
- return str(data[COLUMN_MARKER])
- return ""
-
def column_tooltip(self, data):
if const.USE_TIPS:
return ToolTips.TipFromFunction(
@@ -446,7 +438,7 @@ class PeopleBaseModel(object):
"""
Return the tag color.
"""
- tag_color = None
+ tag_color = '#000000000000'
tag_priority = None
for handle in data[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle)
diff --git a/src/gui/views/treemodels/treebasemodel.py b/src/gui/views/treemodels/treebasemodel.py
index 277bfb7a4..8b2cab908 100644
--- a/src/gui/views/treemodels/treebasemodel.py
+++ b/src/gui/views/treemodels/treebasemodel.py
@@ -379,9 +379,9 @@ class TreeBaseModel(gtk.GenericTreeModel):
"""
return self._tooltip_column
- def marker_column(self):
+ def color_column(self):
"""
- Return the marker color column.
+ Return the color column.
"""
return None
@@ -772,7 +772,7 @@ class TreeBaseModel(gtk.GenericTreeModel):
node = self.nodemap.node(nodeid)
if node.handle is None:
# Header rows dont get the foreground color set
- if col == self.marker_column():
+ if col == self.color_column():
return None
# Look for header fuction for column and call it
diff --git a/src/gui/widgets/monitoredwidgets.py b/src/gui/widgets/monitoredwidgets.py
index 68afbcd96..e654ac55d 100644
--- a/src/gui/widgets/monitoredwidgets.py
+++ b/src/gui/widgets/monitoredwidgets.py
@@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/export/ExportXml.py b/src/plugins/export/ExportXml.py
index 056d6193b..aaf6912ee 100644
--- a/src/plugins/export/ExportXml.py
+++ b/src/plugins/export/ExportXml.py
@@ -7,6 +7,7 @@
# Copyright (C) 2008 Robert Cheramy
# Copyright (C) 2009 Douglas S. Blank
# Copyright (C) 2010 Jakim Friant
+# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -429,7 +430,7 @@ class GrampsXmlWriter(UpdateCallback):
ntype = escxml(note.get_type().xml_str())
format = note.get_format()
text = note.get_styledtext()
- tags = text.get_tags()
+ styles = text.get_tags()
text = str(text)
self.g.write(' type="%s"' % ntype)
@@ -439,23 +440,25 @@ class GrampsXmlWriter(UpdateCallback):
self.write_text('text', text, index + 1)
- if tags:
- self.write_texttags(tags, index + 1)
+ if styles:
+ self.write_styles(styles, index + 1)
+
+ for tag_handle in note.get_tag_list():
+ self.write_ref("tagref", tag_handle, index+1)
self.g.write(' ' * index + '\n')
-
- def write_texttags(self, tags, index=3):
- for tag in tags:
- name = tag.name.xml_str()
- value = tag.value
+ def write_styles(self, styles, index=3):
+ for style in styles:
+ name = style.name.xml_str()
+ value = style.value
self.g.write(' ' * index + '