@@ -686,6 +686,9 @@ def __init__(self, view, dbstate, uistate):
686
686
# Gtk style context for scrollwindow to operate with theme colors
687
687
self .sw_style_context = scrolled_win .get_style_context ()
688
688
689
+ # used for popup menu, prevent destroy menu as local variable
690
+ self .menu = None
691
+
689
692
def set_person_to_focus (self , handle ):
690
693
"""
691
694
Set person that will focus (once) after graph rebuilding.
@@ -944,7 +947,7 @@ def button_press(self, item, target, event):
944
947
return False
945
948
946
949
if button == 3 :
947
- PopupMenu (self , kind = 'background' ).show_menu (event )
950
+ self . menu = PopupMenu (self , kind = 'background' ).show_menu (event )
948
951
return True
949
952
950
953
return False
@@ -1043,9 +1046,9 @@ def select_node(self, item, target, event):
1043
1046
1044
1047
elif button == 3 and node_class : # right mouse
1045
1048
if node_class == 'node' :
1046
- PopupMenu (self , 'person' , handle ).show_menu (event )
1049
+ self . menu = PopupMenu (self , 'person' , handle ).show_menu (event )
1047
1050
elif node_class == 'familynode' :
1048
- PopupMenu (self , 'family' , handle ).show_menu (event )
1051
+ self . menu = PopupMenu (self , 'family' , handle ).show_menu (event )
1049
1052
1050
1053
elif button == 2 : # middle mouse
1051
1054
# to enter in scroll mode (we should change "item" to root item)
@@ -2543,10 +2546,17 @@ def show_menu(self, event=None):
2543
2546
"""
2544
2547
Show popup menu.
2545
2548
"""
2546
- # new from gtk 3.22:
2547
- # self.popup_at_pointer(event)
2548
- self .popup (None , None , None , None ,
2549
- event .get_button ()[1 ], event .time )
2549
+ if (Gtk .MAJOR_VERSION >= 3 ) and (Gtk .MINOR_VERSION >= 22 ):
2550
+ #new from gtk 3.22:
2551
+ self .popup_at_pointer (event )
2552
+ else :
2553
+ if event :
2554
+ self .popup (None , None , None , None ,
2555
+ event .get_button ()[1 ], event .time )
2556
+ else :
2557
+ self .popup (None , None , None , None ,
2558
+ 0 , Gtk .get_current_event_time ())
2559
+ #self.popup(None, None, None, None, 0, 0)
2550
2560
2551
2561
def background_menu (self ):
2552
2562
"""
0 commit comments