Creating a gramplet link

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a gramplet link

Stephen Adams
Hi everyone,

I'm trying to determine what the valid values for link_type are in the gui.link  method.

The method calls  self.gui.link(text, link_type, data, size, tooltip).

Here gui is reference that was passed in during gramplet initialization so I have no reason to suspect it is not gramps.gui, except that there is no gramps.gui.link.  Thinking that perhaps gramps.gui.widgets.grampletpane,GuiGramplet.link might be the right thing I find that link_type gets buried into link_data and used:

self._tags.append(link_data) buffer.apply_tag(link_data[0], start, end)

So now that I've gone down the rabbit hole I'm going to ask "how do I make a link to a person similar to the built in gramplet "Records" which opens the person editor if double clicked" and "How could I modify that to instead go to the relationship view for the person when dobule clicked"?

When I look at gramps.plugins.gramplet.RecordsGramplet I see the code  self .link(str(name), handletype, handle), which is perfectly straightforward, however, the definition and possible values of handletype is unclear.

(excerpt from recordsgramplet.py)
records = find_records(self.dbstate.db, None, 3, CALLNAME_DONTUSE)
for (text, varname, top) in records:
     for (number, (sort, value, name, handletype, handle)) in enumerate (top):
          self.link(str(name), handletype, handle)

In the mean time I will investigate find_records and see what that turns up.

Greatly appreciated.

Steve


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Creating a gramplet link

Stephen Adams
Ok, I was close.  I found the list of supported types in gramps/gui/widgets/grampletpane.py down in on_button_press.

So the question I am left with, and I believe that it is not possible at the moment, is how can I have a double click that opens the relationship panel?   From what I read in lines 635-660 it looks like it's hard coded to always open EditPerson.

Thanks for your patience as i muddle through the code.

Steve

On Wed, May 30, 2018 at 11:10 AM, Stephen Adams <[hidden email]> wrote:
Hi everyone,

I'm trying to determine what the valid values for link_type are in the gui.link  method.

The method calls  self.gui.link(text, link_type, data, size, tooltip).

Here gui is reference that was passed in during gramplet initialization so I have no reason to suspect it is not gramps.gui, except that there is no gramps.gui.link.  Thinking that perhaps gramps.gui.widgets.grampletpane,GuiGramplet.link might be the right thing I find that link_type gets buried into link_data and used:

self._tags.append(link_data) buffer.apply_tag(link_data[0], start, end)

So now that I've gone down the rabbit hole I'm going to ask "how do I make a link to a person similar to the built in gramplet "Records" which opens the person editor if double clicked" and "How could I modify that to instead go to the relationship view for the person when dobule clicked"?

When I look at gramps.plugins.gramplet.RecordsGramplet I see the code  self .link(str(name), handletype, handle), which is perfectly straightforward, however, the definition and possible values of handletype is unclear.

(excerpt from recordsgramplet.py)
records = find_records(self.dbstate.db, None, 3, CALLNAME_DONTUSE)
for (text, varname, top) in records:
     for (number, (sort, value, name, handletype, handle)) in enumerate (top):
          self.link(str(name), handletype, handle)

In the mean time I will investigate find_records and see what that turns up.

Greatly appreciated.

Steve



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel