Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GraphView]Add popup menu[gramps50] #120

Merged

Conversation

vantu5z
Copy link
Contributor

@vantu5z vantu5z commented Mar 1, 2018

Add popup menu for node (on right mouse click).
Simplify add spouse or child to person which doesn't have family.
For node:
- edit
- add new partner
- set as home person

For family:
- just open editor

ToDo (in progress, testing and feedback needed):
After graph rebuild scroll to person which have been edited, and not to active person.

@vantu5z vantu5z changed the title add popup menu for node [GraphView] add popup menu for node Mar 1, 2018
@fxtmtrsine
Copy link

fxtmtrsine commented Mar 1, 2018

Add popup menu for node (on right mouse click).

@vantu5z Hope you don't mind some feedback if it's not too early? No popup menu here when I click on a node (person), only when I get click on a family marriage year (node) do I get a family screen.

Love how your improving this. Thanks 👍

@SNoiraud
Copy link
Member

SNoiraud commented Mar 1, 2018

If you add a popup menu, it could be interesting to add the possibility to set this node as a home person.
I have already done that in master : see the PR #446

I get the following error when I click with the right button :
2018-03-01 08:40:03.807: ERROR: grampsapp.py: line 143: Unhandled exception
Traceback (most recent call last):
File "/home/serge/.gramps/gramps50/plugins/GraphView/graphview.py", line 953, in select_node
self.node_menu(node_class, handle, event)
File "/home/serge/.gramps/gramps50/plugins/GraphView/graphview.py", line 981, in node_menu
menu.popup(None, None, None, None, event.button, event.time)
File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 1551, in popup
self.popup_for_device(None, parent_menu_shell, parent_menu_item, func, data, button, activate_time)
TypeError: Must be number, not EventButton

@PQYPLZXHGF
Copy link

No popup menu here also for rightclik on person or family.

10550: ERROR: grampsapp.py: line 143: Unhandled exception
Traceback (most recent call last):
File "/home/PQYPLZXHGF/.gramps/gramps50/plugins/GraphView/graphview.py", line 953, in select_node
self.node_menu(node_class, handle, event)
File "/home/PQYPLZXHGF/.gramps/gramps50/plugins/GraphView/graphview.py", line 984, in node_menu
menu.popup(None, None, None, None, event.button, event.time)
File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 1540, in popup
self.popup_for_device(None, parent_menu_shell, parent_menu_item, func, data, button, activate_time)
TypeError: Must be number, not EventButton

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 1, 2018

@SNoiraud , don't know why you get this exception, for me it works well.
I can make like this:

menu.popup(None, None, None, None, event.button, event.time)
to
menu.popup(None, None, None, None, 3, event.time)
or
menu.popup(None, None, None, None, event.get_button()[1], event.time)

@SNoiraud
Copy link
Member

SNoiraud commented Mar 1, 2018

I don't understand why we have these Gtk errors. The menu popups are created correctly for me.
I think there is a subtility somewhere...

I tried : menu.popup(None, None, None, None, event.get_button()[1], event.time)
and it works correctly. really strange

@PQYPLZXHGF
Copy link

PQYPLZXHGF commented Mar 1, 2018

No popup menu at all here.

Not sure if anthing to do wth it, I'm using ubuntu 16.04 that has gtk 3.18.9

@vantu5z @SNoiraud @fxtmtrsine What versions are you using? Remeber that Gramps supports gtk 3.10 or greater.

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 1, 2018

I use Arch with gtk3 3.22.28-1.

@SNoiraud
Copy link
Member

SNoiraud commented Mar 1, 2018

One remark on the second entry in the meny :
Add spouse for a women is not a good idea.
either we set Spouse/Husband or Partner or something better.
I think there was a discussion about that some time ago

@SNoiraud
Copy link
Member

SNoiraud commented Mar 1, 2018

I use :
python : 3.5.3
gramps : 5.0.0-beta2-e2426b979
gtk++ : 3.22.11
pygobject : 3.22.0
pango : 1.40.4
cairo : 1.14.8
pycairo : 1.10.0
osmgpsmap : 1.0
GExiv2 : 0.10
ICU : 57.1
PyICU : 1.9.5
o.s. : linux

@SNoiraud
Copy link
Member

SNoiraud commented Mar 1, 2018

When I said very strange, this is because I wrote the popup menu the same way in geography and I have not this problem.

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 1, 2018

find that popup() is:

Deprecated since version 3.22: Please use Gtk.Menu.popup_at_widget(), Gtk.Menu.popup_at_pointer(). or Gtk.Menu.popup_at_rect() instead

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 1, 2018

Remeber that Gramps supports gtk 3.10 or greater.
So we don't use new methods after gtk 3.10?

like this:
menu.popup_at_pointer(event)
that come from 3.22

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 1, 2018

Add spouse for a women is not a good idea.

Why not, translators adopt it.
But think we can use 'partner' instead.

@Nick-Hall
Copy link
Member

So we don't use new methods after gtk 3.10?

Correct.

@vantu5z vantu5z force-pushed the GraphView_node_menu branch from 32c7d31 to 3ee074f Compare March 1, 2018 16:00
@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 1, 2018

So we don't use new methods after gtk 3.10?

Correct.

Ok. Will use: menu.popup(None, None, None, None, event.get_button()[1], event.time)

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 1, 2018

Try to focus on person (not active) after editing or add family and graph rebuilding.

Have some problem.

    def _connect_db_signals(self):
        """
        Set up callbacks for changes to person and family nodes.
        """
        self.callman.add_db_signal('person-update', self.goto_handle)
        self.callman.add_db_signal('family-update', self.goto_handle)

family-update is not emited when family event is changed.
And I don't want to call it manually because some time graph will be build twice.

    def goto_handle(self, handle):
        """
        Go to a named handle.
        """
        if self.active:
            if self.get_active() != "":
                self.graph_widget.clear()
                self.graph_widget.populate(self.get_active())
                self.graph_widget.load_bookmarks()
        else:
            self.dirty = True

I don't understand which handle come here?

@vantu5z vantu5z force-pushed the GraphView_node_menu branch from f0db50e to 117171f Compare March 1, 2018 16:47
@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 1, 2018

As solution I see only change active person.
Any advice will good :)

to catch date event changing and update node
@fxtmtrsine
Copy link

@PQYPLZXHGF ubuntu 14.04 with gtk 3.10.8 looks like I have the oldest!

@vantu5z With the latest version still get no popup menu here for the person; only clicking on a family marriage works as before. so no change for me :(

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 2, 2018

@fxtmtrsine Try now, rewrite menu creation using gramps widgets (add_menuitem).

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 7, 2018

I don't like that

@SNoiraud Why not?
You don't need to follow the lines by eyes, just look to the list and click, and get animation to selected person. And other useful stuff as add partner, add parents, add_tags, goto siblings that can be far from each other.

Now I try to perform double click to edit person or family without popup.
So using popup is stay only if you want to do something else.

@SNoiraud
Copy link
Member

SNoiraud commented Mar 7, 2018

Sound good to me.
Tested all cases.
The only remaining problem is go to person not already displayed in the current graph.

on move to person from popup menu
@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 7, 2018

The only remaining problem is go to person not already displayed in the current graph.

@SNoiraud Try it now :)

@SNoiraud
Copy link
Member

SNoiraud commented Mar 7, 2018

Yes it works.

I had the following problems when i modify the number of descendants:

07075: ERROR: grampsapp.py: line 143: Unhandled exception
Traceback (most recent call last):
File "/home/serge/.gramps/gramps50/plugins/GraphView/graphview.py", line 2759, in stop_shake_animation
if (self.counter[item.title] < self.max_count) and (not stoped):
KeyError: 'b3d9dfcc99644708fd6'

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 7, 2018

@SNoiraud What do you think about family menu, should we add something else?

@SNoiraud
Copy link
Member

SNoiraud commented Mar 7, 2018

No more problems.
OK for children submenu.

@sam-m888
Copy link
Member

sam-m888 commented Mar 7, 2018

@vantu5z Looks good, haven't found any issue added from this PR.

Is it almost ready to merge?

What remains to be done?

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 7, 2018

@sam-m888 It is not ready yet.
Extra menu (on background) is not implemented properly.

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 11, 2018

Add items from config to extra menu (on background).
Think that color and animation settings should not be in this menu.
So config dialog should exist.

Should we add something else?

@@ -1023,6 +1023,59 @@ def background_menu(self, event):
self.menu = Gtk.Menu()
self.menu.set_reserve_toggle_size(False)

menu_item = Gtk.CheckMenuItem(_('Show images'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we had decided to move away from putting configuration settings in the context menus

@sam-m888
Copy link
Member

sam-m888 commented Mar 12, 2018

@vantu5z Tested ok, so far 👍

Should we add something else?

Possibly like mentioned by @fxtmtrsine also add an identical help entry to each of the three menus called "About Graph View" that leads to the url: https://gramps-project.org/wiki/index.php?title=Graph_View like shown in Timeline pedigree and htreeview eg:

2018-03-12 12_22_38-timelinepedigreeview-addon-example-50 png png image 991 x 801 pixels

Apart from that I'd say this is finished as is. 👍

@sam-m888
Copy link
Member

@vantu5z Nicely done 🥇 When you're ready for this to be merged remove the "Work in Progress" label.

Screenshots of the three menus:

Config menu:
config-menu-graphview-50

Edit Family menu:
edit-family-menu-graphview-50

Edit Person menu:
edit-person-menu-graphview-50

@vantu5z
Copy link
Contributor Author

vantu5z commented Mar 13, 2018

Yes, I think it can be merged.

@sam-m888 sam-m888 merged commit eff2b75 into gramps-project:maintenance/gramps50 Mar 13, 2018
@sam-m888
Copy link
Member

Thank you

@vantu5z vantu5z deleted the GraphView_node_menu branch March 14, 2018 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants