Replacing set_data/get_data with a python attribute
set_data/get_data not available anymore is not available anymore [1]. The
recommended approach is using a python attribute, which we do.
Changing to use the attribute in the activity class slipped by mistake
into 6330204e91
.
[1] https://bugzilla.gnome.org/show_bug.cgi?id=641944
Signed-off-by: Simon Schampijer <simon@laptop.org>
Tested-by: Manuel Quiñones <manuq@laptop.org>
This commit is contained in:
parent
e97e5cac6d
commit
af320f91f8
@ -396,11 +396,11 @@ def _add_accelerator(tool_button):
|
||||
|
||||
# TODO: should we remove the accelerator from the prev top level?
|
||||
|
||||
accel_group = tool_button.get_toplevel().get_data('sugar-accel-group')
|
||||
if not accel_group:
|
||||
if not hasattr(tool_button.get_toplevel(), 'sugar_accel_group'):
|
||||
logging.warning('No Gtk.AccelGroup in the top level window.')
|
||||
return
|
||||
|
||||
accel_group = tool_button.get_toplevel().sugar_accel_group
|
||||
keyval, mask = Gtk.accelerator_parse(tool_button.props.accelerator)
|
||||
# the accelerator needs to be set at the child, so the Gtk.AccelLabel
|
||||
# in the palette can pick it up.
|
||||
|
@ -75,11 +75,11 @@ class MenuItem(Gtk.ImageMenuItem):
|
||||
|
||||
# TODO: should we remove the accelerator from the prev top level?
|
||||
|
||||
accel_group = self.get_toplevel().get_data('sugar-accel-group')
|
||||
if not accel_group:
|
||||
if not hasattr(self.get_toplevel(), 'sugar_accel_group'):
|
||||
logging.warning('No Gtk.AccelGroup in the top level window.')
|
||||
return
|
||||
|
||||
accel_group = self.get_toplevel().sugar_accel_group
|
||||
keyval, mask = Gtk.accelerator_parse(self._accelerator)
|
||||
self.add_accelerator('activate', accel_group, keyval, mask,
|
||||
Gtk.AccelFlags.LOCKED | Gtk.AccelFlags.VISIBLE)
|
||||
|
@ -80,7 +80,7 @@ class _PaletteMenuWidget(Gtk.Menu):
|
||||
Gtk.Menu.__init__(self)
|
||||
|
||||
accel_group = Gtk.AccelGroup()
|
||||
self.set_data('sugar-accel-group', accel_group)
|
||||
self.sugar_accel_group = accel_group
|
||||
self.get_toplevel().add_accel_group(accel_group)
|
||||
|
||||
self._popup_position = (0, 0)
|
||||
@ -248,7 +248,7 @@ class _PaletteWindowWidget(Gtk.Window):
|
||||
self.set_position(Gtk.WindowPosition.NONE)
|
||||
|
||||
accel_group = Gtk.AccelGroup()
|
||||
self.set_data('sugar-accel-group', accel_group)
|
||||
self.sugar_accel_group = accel_group
|
||||
self.add_accel_group(accel_group)
|
||||
|
||||
self._old_alloc = None
|
||||
|
@ -35,12 +35,11 @@ def _add_accelerator(tool_button):
|
||||
return
|
||||
|
||||
# TODO: should we remove the accelerator from the prev top level?
|
||||
|
||||
accel_group = tool_button.get_toplevel().get_data('sugar-accel-group')
|
||||
if not accel_group:
|
||||
if not hasattr(tool_button.get_toplevel(), 'sugar_accel_group'):
|
||||
logging.warning('No Gtk.AccelGroup in the top level window.')
|
||||
return
|
||||
|
||||
accel_group = tool_button.get_toplevel().sugar_accel_group
|
||||
keyval, mask = Gtk.accelerator_parse(tool_button.props.accelerator)
|
||||
# the accelerator needs to be set at the child, so the Gtk.AccelLabel
|
||||
# in the palette can pick it up.
|
||||
|
Loading…
Reference in New Issue
Block a user