Workaround to have popup shown in GTK3 on grampsbar, and fixes in gramplets

svn: r19961
This commit is contained in:
Benny Malengier 2012-07-08 03:09:25 +00:00
parent fbe91910dc
commit 9a7a6548f3
4 changed files with 11 additions and 3 deletions

View File

@ -319,7 +319,7 @@ class GrampsBar(Gtk.Notebook):
height = min(int(self.uistate.screen_height() * 0.20), 400) height = min(int(self.uistate.screen_height() * 0.20), 400)
gramplet.set_size_request(width, height) gramplet.set_size_request(width, height)
page_num = self.append_page(gramplet, Gtk.Label(label=msg)) page_num = self.append_page(gramplet, Gtk.Label(label=''))
return page_num return page_num
def __create_tab_label(self, gramplet): def __create_tab_label(self, gramplet):
@ -444,7 +444,12 @@ class GrampsBar(Gtk.Notebook):
rd_menu.show() rd_menu.show()
menu.append(rd_menu) menu.append(rd_menu)
menu.popup(None, None, None, None, 1, event.time) menu.show_all()
#GTK3 does not show the popup, workaround: pass position function
menu.popup(None, None,
lambda menu, data: (event.get_root_coords()[0],
event.get_root_coords()[1], True),
None, event.button, event.time)
return True return True
return False return False

View File

@ -29,6 +29,7 @@ Provide the basic functionality for a list view
# GTK # GTK
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gi.repository import Gdk
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Pango from gi.repository import Pango
from gen.const import THUMBSCALE from gen.const import THUMBSCALE
@ -429,6 +430,7 @@ class ListModel(object):
""" """
Add the data to the model at the end of the model Add the data to the model at the end of the model
""" """
info = info or ''
self.count += 1 self.count += 1
need_to_set = True need_to_set = True
# Create the node: # Create the node:

View File

@ -24,6 +24,7 @@
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gi.repository import GObject
from gi.repository import Gtk from gi.repository import Gtk
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -65,7 +65,7 @@ class Gallery(Gramplet):
photo = Photo(self.uistate.screen_height() < 1000) photo = Photo(self.uistate.screen_height() < 1000)
photo.set_image(full_path, mime_type, media_ref.get_rectangle()) photo.set_image(full_path, mime_type, media_ref.get_rectangle())
self.image_list.append(photo) self.image_list.append(photo)
self.top.pack_start(photo, expand=False, fill=False) self.top.pack_start(photo, False, False, 0)
self.top.show_all() self.top.show_all()
count += 1 count += 1
self.set_has_data(count > 0) self.set_has_data(count > 0)