From 3f217aeed1488190c7966c9a900200b8e6de2d1e Mon Sep 17 00:00:00 2001 From: Sven Wehner Date: Sun, 17 May 2020 18:17:57 +0200 Subject: [PATCH] EditLink: When changing the link type choose the active object as default. --- gramps/gui/editors/editlink.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gramps/gui/editors/editlink.py b/gramps/gui/editors/editlink.py index b503d42e6..3b50e7745 100644 --- a/gramps/gui/editors/editlink.py +++ b/gramps/gui/editors/editlink.py @@ -208,17 +208,28 @@ class EditLink(ManagedWindow): (object_class, prop, value)) def _on_type_changed(self, widget): - self.selected.set_text("") if self.uri_list.get_active() == WEB: self.url_link.set_sensitive(True) self.pick_item.set_sensitive(False) self.new_button.set_sensitive(False) self.edit_button.set_sensitive(False) + self.selected.set_text("") + self.url_link.set_text("https://") else: self.url_link.set_sensitive(False) self.pick_item.set_sensitive(True) self.new_button.set_sensitive(True) self.edit_button.set_sensitive(True) + object_class = OBJECT_MAP[self.uri_list.get_active()] + handle = self.uistate.get_active(object_class) + if handle: + self.selected.set_text(self.display_link( + object_class, "handle", handle)) + self.url_link.set_text("gramps://%s/handle/%s" % + (object_class, handle)) + else: + self.selected.set_text("") + self.url_link.set_text("") def get_uri(self): if self.uri_list.get_active() == WEB: