From 6a6b107b217fc775837ccffd6ae4d207468f7756 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Fri, 08 Jul 2011 18:53:53 +0000 Subject: Fix load of keybindings - OLPC #11049 Moved call to load of keybindings to map callback of activity to delay the call, without this, when we open a new file keybindings are not applied. --- (limited to 'AbiWordActivity.py') diff --git a/AbiWordActivity.py b/AbiWordActivity.py index 06b9cf8..09543dd 100644 --- a/AbiWordActivity.py +++ b/AbiWordActivity.py @@ -169,6 +169,7 @@ class AbiWordActivity(activity.Activity): self.set_canvas(self.abiword_canvas) self.abiword_canvas.connect_after('map-event', self.__map_event_cb) self.abiword_canvas.show() + self.connect_after('map-event', self.__map_activity_event_cb) self._zoom_handler = self.abiword_canvas.connect("zoom", self.__zoom_cb) @@ -202,13 +203,6 @@ class AbiWordActivity(activity.Activity): def __map_event_cb(self, event, activity): logger.debug('__map_event_cb') - # set custom keybindings for Write - logger.debug('Loading keybindings') - keybindings_file = os.path.join(get_bundle_path(), 'keybindings.xml') - self.abiword_canvas.invoke_cmd( - 'com.abisource.abiword.loadbindings.fromURI', - keybindings_file, 0, 0) - # no ugly borders please self.abiword_canvas.set_property("shadow-type", gtk.SHADOW_NONE) @@ -238,6 +232,15 @@ class AbiWordActivity(activity.Activity): # we are creating the activity logger.error("We are creating an activity") + def __map_activity_event_cb(self, event, activity): + # set custom keybindings for Write + # we do it later because have problems if done before - OLPC #11049 + logger.error('Loading keybindings') + keybindings_file = os.path.join(get_bundle_path(), 'keybindings.xml') + self.abiword_canvas.invoke_cmd( + 'com.abisource.abiword.loadbindings.fromURI', + keybindings_file, 0, 0) + def get_preview(self): if not hasattr(self.abiword_canvas, 'render_page_to_image'): return activity.Activity.get_preview(self) -- cgit v0.9.1