david1
December 3, 2024, 5:00am
1
GRAMPS: AIO64-5.2.3-r1-aa03f5a
Python: 3.11.9
BSDDB: 6.2.9 (6, 0, 30)
sqlite: 3.46.0 (2.6.0)
LANG: en_US.UTF-8
OS: Windows
When Graph View with Show Tags option is selected, only the tag color is displayed in the individual’s boxes. The text of the tag itself is not displayed. How would one display the tag text, rather than the tag color?
comeng
December 3, 2024, 7:46am
2
I have multiple Tags on anyone individual to have them as text would be
prohibitive in terms of space so the hover function is ideal when I am
not sure what each Tag stands for.
Hover by moving your mouse over the individual or event
phil
david1
December 3, 2024, 9:28am
3
Thanks, I was not aware hovering over the “tag” would reveal the messages hidden within.
I suggest improving this functionality in a future upgrade to allow tag text to be visible without hovering.
comeng
December 3, 2024, 11:49am
4
Whilst displaying the text associated with a tag might be desirable for some I am guessing that on my 27" monitor I would see maybe 3 or 4 people horizontally and 2 or 3 vertically
Not acceptable when needing to scoot around large trees.
Currently can look at about 7 generations vertically and still read the names and have upwards of 20 horizontally and that is without turning off the sidebars
phil
A “key” or “Legend” of Tag colors used in the graph might be more space efficient.
2 Likes
You might want to look at Vantu5z’s patch for themes in Graph View:
gramps-project:maintenance/gramps51
← vantu5z:graphview_person_theme
opened 12:25PM - 09 Feb 21 UTC
Attempt to provide opportunity to add custom themes [12108](https://gramps-proje… ct.org/bugs/view.php?id=12108) (aditional fields).
Fix [11397](https://gramps-project.org/bugs/view.php?id=11397) (underline call name).
Family theme is only one and hard coded for now.
Added experimental feature to display attributes (for now - eye and hair colors).
To add custom person theme you should put it to `GraphView/themes` folder.
You should have some python knowledge and know Gramps structure to create custom themes.
![Снимок экрана от 2021-02-09 10-31-34](https://user-images.githubusercontent.com/8698003/107330515-b6eb3680-6ac2-11eb-9731-7d15f3f2a848.png)
Example for occupation :
```
# -*- coding: utf-8 -*-
from default_0 import Theme as DefaultTheme
from gramps.gen.lib import EventType
from gramps.gen.const import GRAMPS_LOCALE as glocale
try:
_trans = glocale.get_addon_translator(__file__)
except ValueError:
_trans = glocale.translation
_ = _trans.gettext
class Theme(DefaultTheme):
"""
Use person DefaultTheme as base.
Add occupation info.
"""
THEME_KIND = 'person'
def __init__(self, dot_generator, options, functions):
DefaultTheme.__init__(self, dot_generator, options, functions)
self.index = 5
self.name = _('Example occupation')
self.html = ('%(img)s'
'%(name)s'
'%(dates)s'
'%(occup)s' # we want add occupation data befor tags
'%(tags)s')
def get_some_data(self, person):
"""
Function to get some data from database.
For example it is occupation.
"""
occupation = ''
event_ref_list = person.get_event_ref_list()
for event_ref in event_ref_list:
event = self.functions.dbstate.db.get_event_from_handle(
event_ref.ref)
if event.type == EventType.OCCUPATION:
if occupation:
occupation += '<BR/>' + event.get_description()
else:
occupation = event.get_description()
return self.table_row_fmt % occupation if occupation else ''
def build(self, person, html):
"""
Build html table.
Get if from DefaultTheme and edit.
"""
return html % {'img': self.get_image_str(person),
'name': self.get_name_str(person),
'dates': self.get_dates_str(person),
'tags': self.get_tags_str(person),
'attrs' : self.get_attrs_str(person),
'occup' : self.get_some_data(person) # add this line
}
```
1 Like
david1
December 4, 2024, 5:35pm
7
I would think Tags are relatively simple objects, comprised mainly of “Tag text” and “Tag color”. If someone could point me towards the portion of the Graph View display code where “Tag color” is pulled out from the Person, perhaps I could tweak to pull the “Tag text” instead?
comeng
December 4, 2024, 7:51pm
8
Please could I ask if you do this you put it into view configuration so
that it can be turned on or more importantly for me off
phil
david1
December 4, 2024, 8:25pm
9
Not to worry. If I can figure this out, it would only be on my local version.
for tag_handle in obj.get_tag_list():
tags.append(self.dbstate.db.get_tag_from_handle(tag_handle))
# prepare html table of tags
if tags:
tag_table = ('<TABLE BORDER="0" CELLBORDER="0" '
'CELLPADDING="5"><TR>')
for tag in tags:
rgba = Gdk.RGBA()
rgba.parse(tag.get_color())
value = '#%02x%02x%02x' % (int(rgba.red * 255),
int(rgba.green * 255),
int(rgba.blue * 255))
tag_table += '<TD BGCOLOR="%s"></TD>' % value
tag_table += '</TR></TABLE>'
return tags, tag_table
def get_person_themes(self, index=-1):
"""
And here is the Developer (in Sphinx) for TagBase
Please continue to discuss your progress here. The community tends to be engaged and might help evolve it into something you’ll want to share.
1 Like
The documentation for the Tag object would also be worth reading. You can retrieve the tag name using the get_name
method.
2 Likes