diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2013-11-07 20:49:56 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-11-08 14:07:40 (GMT) |
commit | 5dd843cf415d0c65e2927540225b0098f2b71cd0 (patch) | |
tree | 4e7471fbd786f939a95f1256fd642586d9dc7b73 | |
parent | 1b8c6358c7cb86ebd97fc096028a71ca36eae54e (diff) |
Delay speech initialization to speed up the activity startup
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r-- | AbiWordActivity.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/AbiWordActivity.py b/AbiWordActivity.py index 3addab7..e83f852 100644 --- a/AbiWordActivity.py +++ b/AbiWordActivity.py @@ -56,9 +56,6 @@ try: except: FILTER_TYPE_GENERIC_MIME = 'generic_mime' -import speech -from speechtoolbar import SpeechToolbar - logger = logging.getLogger('write-activity') @@ -111,12 +108,9 @@ class AbiWordActivity(activity.Activity): view_toolbar.props.label = _('View') toolbar_box.toolbar.insert(view_toolbar, -1) - if speech.supported: - self.speech_toolbar_button = ToolbarButton(icon_name='speak') - toolbar_box.toolbar.insert(self.speech_toolbar_button, -1) - self.speech_toolbar = SpeechToolbar(self) - self.speech_toolbar_button.set_page(self.speech_toolbar) - self.speech_toolbar_button.show() + self.speech_toolbar_button = ToolbarButton(icon_name='speak') + toolbar_box.toolbar.insert(self.speech_toolbar_button, -1) + GObject.idle_add(self._init_speech) separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) @@ -221,6 +215,14 @@ class AbiWordActivity(activity.Activity): self.abiword_canvas.connect('size-allocate', self.size_allocate_cb) + def _init_speech(self): + import speech + from speechtoolbar import SpeechToolbar + if speech.supported: + self.speech_toolbar = SpeechToolbar(self) + self.speech_toolbar_button.set_page(self.speech_toolbar) + self.speech_toolbar_button.show() + def size_allocate_cb(self, abi, alloc): GObject.idle_add(abi.queue_draw) |