Yup. I had done anything correct, but couldn’t find it.
Did it again, and found that I didn’t have to activate it, it was automatically started after using a selector.
It looks very promising.
Thanks for your help
@emyoulation @kku This addon is absolutely great. Thanks!
It may also need something to clean out deleted Trees from the lists.
I create a LOT test trees when bug testing or validating steps for supports.
@kku Does the JSON list ever get pruned of dead tree debris?
And sometimes, I’ll remove folders from the database manually in the OS or change the database path.
Good observation. No, the program does not prune deleted trees from the list. This should be added at some point. There doesn’t seem to be a “database-deleted” signal - so this has to be done in some other way.
On the other hand, the program does not need to monitor the “object deleted” signals since it will skip over deleted objects when building the “recent items” list. The deleted handles will gradually drop from the list as new items are being added.
Maybe the JSON could write a today() Date after the Tree handle when adding to the Recents? And any Tree handle that has a geriatric date (say, more than a year… or a NULL for backwards compatibility) could be automatically pruned.
If this becomes a core plug-in (with or without the modifications @Nick-Hall suggested) maybe pruning could be performed during the Plugin Registration? Cleaning this level of clutter would be excessive if done more than once a session.
I think that the time needed for pruning the JSON file is not noticeable. I made a quick unscientific test and it took about 1 millisecond to scan and remove deleted databases from the list in memory (I have 168 databases and 27 of them had recent items).
A new version of recent-items with this change is now in Github. Checking for the deleted databases is now done each time the json file is updated, for example when the user selects an object from a selector.
This plugin is close to my practice, namely: I do not use the notepad but the search function (criteria: last modification especially, search key seen/number of views for citations, …) of the editors of the different objects.
So I like the automatic introduction of these recent items
So I installed this plugin it works only I have small worries:
in particular for Citations/Sources:
the first column is really too narrow to choose at first glance the appropriate item
Is this normal?
Yes, that is a problem. I try to find a solution.
I looks like the recent-list is using the original spacings set in the core selector files. If you edit /gramps/gui/selectors/selectcitation.py
you can give yourself more space in the columns.
At Line 70 (5.2.3)
def get_column_titles(self):
return [
(_("Source: Title or Citation: Volume/Page"), 350, BaseSelector.TEXT, 0),
(_("Abbreviation"), 100, BaseSelector.TEXT, 8),
(_("ID"), 75, BaseSelector.TEXT, 1),
(_("Last Change"), 150, BaseSelector.TEXT, 6),
]
You can add space to Source: from 350 to something close to your manually set selector columns.
Maybe @kku can figure out how to use the stored settings from gramps.ini.
Thanks
I’m just starting to use this plugin which fits in with my use of Gramps
Thanks but I can’t find these files on my KDE Neon linux system
I already made a patch for this problem. I use the persistentTreeview. The only problem I have is when we resize a column, the recent view is not updated. I close the window and reopen it. I can share the patch.
--- /home/gramps/kku/addons/recent-items/recent-items.py 2024-12-01 09:56:22.165907652 +0100
+++ recent-items.py 2024-12-15 10:47:02.473016419 +0100
@@ -65,6 +65,7 @@
from gramps.gui.selectors.selectplace import SelectPlace
from gramps.gui.selectors.baseselector import BaseSelector
from gramps.gui.widgets import SimpleButton
+from gramps.gui.widgets.persistenttreeview import PersistentTreeView
# ------------------------------------------------------------------------
#
@@ -194,7 +195,8 @@
numcolumns = maxindex + 1
args = [str] * (numcolumns + 1) # one for the handle
model = Gtk.ListStore(*args)
- tree = Gtk.TreeView()
+ # tree = Gtk.TreeView()
+ tree = PersistentTreeView(config_name=self.__class__.__name__.lower())
tree.set_model(model)
tree.set_headers_visible(False)
@@ -266,6 +268,7 @@
# activate a row on the recent items list but do not select it yet
tree.set_activate_on_single_click(True)
+ tree.restore_column_size()
tree.connect(
"row-activated",
lambda tree, path, col: row_activated(self, model, tree, path, col),
Thanks. I fixed this also in a similar way. My solution allows independent resizing of the columns in the recent-items and in the main list. This required that the column headers were made visible in the recent-items list. This version is in Github (gramps/addons/recent-items at master · kkujansuu/gramps · GitHub).
The problem is we have two headers and this make the window too wide.
With my version the columns are the same size in the recent list and in the list.
Can you take a look at the Edit Person’s Multiple Surnames table too?
The Prefix
and Connector
columns widths are too narrow in a more extreme way and adjustments are not remembered. (The Prefix overlap actually causes consistent failure of drag’n’drop or paste to the surname column.)
A bug was filed:
0013365: Broken layout in the “Multiple Surnames” section
@Nick-Hall mentioned a maintenance release this weekend. A fix is probably too late for that but would be nice if this is to be a a final 5.x.x release.
I don’t have this problem. The columns size is remembered.
The name column is always set to the maximun available size.
I also had written about this problem.
GRAMPS: 5.2.3
Python: 3.10.12
BSDDB: 6.2.9 (5, 3, 28)
sqlite: 3.37.2 (2.6.0)
LANG: en_US.UTF-8
OS: Linux
Distribution: 6.8.0-49-generic
Now there is a horizontal scrollbar. Hopefully it is better now.
Sorry, I prefer my version.
It does not solve my problem.
1 - I don’t want a header for the recent items.
2 - I want the recent items columns size follow the items list
3 - 6 visible items in the recent list is too big.
I have a new patch based on your last version:
I can’t attach the patch file, so I copy it here
--- addons/recent-items/recent-items.py 2024-12-16 09:06:41.652248970 +0100
+++ /home/serge/.gramps/gramps52/plugins/recent-items/recent-items.py 2024-12-20 13:47:43.326977922 +0100
@@ -202,17 +202,26 @@
numcolumns = maxindex + 1
args = [str] * (numcolumns + 1) # one for the handle
model = Gtk.ListStore(*args)
-
- config_name = self.get_config_name() + "-recent-items"
- tree = PersistentTreeView(self.uistate, config_name)
-
+ tree = PersistentTreeView(config_name=self.__class__.__name__.lower())
tree.set_model(model)
- # tree.set_headers_visible(False)
+ tree.set_headers_visible(False)
BaseSelector.add_columns(self, tree)
tree.restore_column_size()
filterobj = self.filter[1]
+ def resizes(child):
+ if isinstance(child, Gtk.ScrolledWindow):
+ oldtree = child.get_child()
+ for col in oldtree.get_columns():
+ col.connect("notify::width", change_column_size, oldtree, tree)
+
+ def change_column_size(col, width, oldtree, tree):
+ oldtree.save_column_info()
+ tree.restore_column_size()
+
+ vbox.forall(resizes)
+
namespace = get_namespace(self)
if namespace == "Person":
if isinstance(filterobj, FastFemaleFilter):
@@ -267,7 +276,8 @@
header.add(lbl)
sw = Gtk.ScrolledWindow()
- sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER)
+ sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ sw.set_max_content_width(3)
sw.add(tree)
recent_box.add(header)
recent_box.add(sw)