Geography : Gtk.Menu didn't work with gtk3.

svn: r22488
This commit is contained in:
Serge Noiraud 2013-06-10 20:45:40 +00:00
parent 34b13775b7
commit f80bf8eb15
8 changed files with 48 additions and 24 deletions

View File

@ -270,7 +270,8 @@ class GeoGraphyView(OsmGps, NavigationView):
""" """
Builds the menu for actions on the map. Builds the menu for actions on the map.
""" """
menu = Gtk.Menu() self.menu = Gtk.Menu()
menu = self.menu
menu.set_title(_('Map Menu')) menu.set_title(_('Map Menu'))
if config.get("geography.show_cross"): if config.get("geography.show_cross"):
@ -322,7 +323,8 @@ class GeoGraphyView(OsmGps, NavigationView):
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
changemap = Gtk.Menu() self.changemap = Gtk.Menu()
changemap = self.changemap
changemap.set_title(title) changemap.set_title(title)
changemap.show() changemap.show()
add_item.set_submenu(changemap) add_item.set_submenu(changemap)
@ -744,7 +746,8 @@ class GeoGraphyView(OsmGps, NavigationView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)

View File

@ -460,7 +460,8 @@ class GeoClose(GeoGraphyView):
""" """
Create the menu for the selected marker Create the menu for the selected marker
""" """
menu = Gtk.Menu() self.newmenu = Gtk.Menu()
menu = self.newmenu
menu.set_title("person") menu.set_title("person")
events = [] events = []
message = "" message = ""
@ -499,10 +500,12 @@ class GeoClose(GeoGraphyView):
descr = _('No description') descr = _('No description')
message = "(%s) %s => %s" % ( date, plce[11], descr) message = "(%s) %s => %s" % ( date, plce[11], descr)
prevmark = plce prevmark = plce
add_item = Gtk.MenuItem(label=message) self.add_item = Gtk.MenuItem(label=message)
add_item = self.add_item
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)

View File

@ -295,7 +295,8 @@ class GeoEvents(GeoGraphyView):
self._create_markers() self._create_markers()
def bubble_message(self, event, lat, lon, marks): def bubble_message(self, event, lat, lon, marks):
menu = Gtk.Menu() self.menu = Gtk.Menu()
menu = self.menu
menu.set_title("events") menu.set_title("events")
message = "" message = ""
oldplace = "" oldplace = ""
@ -305,7 +306,8 @@ class GeoEvents(GeoGraphyView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)
@ -332,7 +334,8 @@ class GeoEvents(GeoGraphyView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)
@ -364,7 +367,8 @@ class GeoEvents(GeoGraphyView):
add_item = Gtk.MenuItem(label=_("Centering on Place")) add_item = Gtk.MenuItem(label=_("Centering on Place"))
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(_("Centering on Place")) itemoption.set_title(_("Centering on Place"))
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)

View File

@ -604,7 +604,8 @@ class GeoFamClose(GeoGraphyView):
""" """
Create the menu for the selected marker Create the menu for the selected marker
""" """
menu = Gtk.Menu() self.menu = Gtk.Menu()
menu = self.menu
menu.set_title("family") menu.set_title("family")
events = [] events = []
message = "" message = ""
@ -646,7 +647,8 @@ class GeoFamClose(GeoGraphyView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)

View File

@ -377,7 +377,8 @@ class GeoFamily(GeoGraphyView):
self._create_markers() self._create_markers()
def add_event_bubble_message(self, event, lat, lon, mark, menu): def add_event_bubble_message(self, event, lat, lon, mark, menu):
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.show() itemoption.show()
menu.set_submenu(itemoption) menu.set_submenu(itemoption)
modify = Gtk.MenuItem(label=_("Edit Family")) modify = Gtk.MenuItem(label=_("Edit Family"))
@ -398,7 +399,8 @@ class GeoFamily(GeoGraphyView):
itemoption.append(center) itemoption.append(center)
def bubble_message(self, event, lat, lon, marks): def bubble_message(self, event, lat, lon, marks):
menu = Gtk.Menu() self.menu = Gtk.Menu()
menu = self.menu
menu.set_title("family") menu.set_title("family")
message = "" message = ""
oldplace = "" oldplace = ""

View File

@ -544,7 +544,8 @@ class GeoMoves(GeoGraphyView):
""" """
Create the menu for the selected marker Create the menu for the selected marker
""" """
menu = Gtk.Menu() self.menu = Gtk.Menu()
menu = self.menu
menu.set_title("descendance") menu.set_title("descendance")
events = [] events = []
message = "" message = ""
@ -585,7 +586,8 @@ class GeoMoves(GeoGraphyView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)

View File

@ -390,7 +390,8 @@ class GeoPerson(GeoGraphyView):
self._create_markers() self._create_markers()
def bubble_message(self, event, lat, lon, marks): def bubble_message(self, event, lat, lon, marks):
menu = Gtk.Menu() self.menu = Gtk.Menu()
menu = self.menu
menu.set_title("person") menu.set_title("person")
message = "" message = ""
oldplace = "" oldplace = ""
@ -400,7 +401,8 @@ class GeoPerson(GeoGraphyView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
message = "" message = ""
@ -420,7 +422,8 @@ class GeoPerson(GeoGraphyView):
add_item = Gtk.MenuItem() add_item = Gtk.MenuItem()
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
message = "" message = ""
@ -459,7 +462,8 @@ class GeoPerson(GeoGraphyView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)

View File

@ -297,7 +297,8 @@ class GeoPlaces(GeoGraphyView):
self._create_markers() self._create_markers()
def bubble_message(self, event, lat, lon, marks): def bubble_message(self, event, lat, lon, marks):
menu = Gtk.Menu() self.menu = Gtk.Menu()
menu = self.menu
menu.set_title("places") menu.set_title("places")
message = "" message = ""
prevmark = None prevmark = None
@ -306,7 +307,8 @@ class GeoPlaces(GeoGraphyView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)
@ -325,7 +327,8 @@ class GeoPlaces(GeoGraphyView):
add_item = Gtk.MenuItem(label=message) add_item = Gtk.MenuItem(label=message)
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(message) itemoption.set_title(message)
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)
@ -357,7 +360,8 @@ class GeoPlaces(GeoGraphyView):
add_item = Gtk.MenuItem(label=_("Centering on Place")) add_item = Gtk.MenuItem(label=_("Centering on Place"))
add_item.show() add_item.show()
menu.append(add_item) menu.append(add_item)
itemoption = Gtk.Menu() self.itemoption = Gtk.Menu()
itemoption = self.itemoption
itemoption.set_title(_("Centering on Place")) itemoption.set_title(_("Centering on Place"))
itemoption.show() itemoption.show()
add_item.set_submenu(itemoption) add_item.set_submenu(itemoption)