From 7a7d2f93eb7eabe66d85c3cacb4bd067b78625d7 Mon Sep 17 00:00:00 2001 From: Muflone Date: Fri, 19 Jun 2009 17:19:04 +0000 Subject: [PATCH] --- DialogAbout.py | 40 +++ DialogFileOpenSave.py | 54 +++ DialogSimpleMessages.py | 30 ++ DialogYesNo.py | 33 ++ copyright | 17 + doc/changelog | 6 + doc/copyright | 17 + gespeaker | 3 + gespeaker.desktop | 10 + gespeaker.glade | 489 ++++++++++++++++++++++++++ gespeaker.png | Bin 0 -> 4049 bytes gespeaker.py | 22 ++ gespeakerUI.py | 205 +++++++++++ locale/en_US/LC_MESSAGES/gespeaker.mo | Bin 0 -> 1574 bytes locale/it/LC_MESSAGES/gespeaker.mo | Bin 0 -> 1612 bytes 15 files changed, 926 insertions(+) create mode 100644 DialogAbout.py create mode 100644 DialogFileOpenSave.py create mode 100644 DialogSimpleMessages.py create mode 100644 DialogYesNo.py create mode 100644 copyright create mode 100644 doc/changelog create mode 100644 doc/copyright create mode 100755 gespeaker create mode 100644 gespeaker.desktop create mode 100644 gespeaker.glade create mode 100644 gespeaker.png create mode 100755 gespeaker.py create mode 100644 gespeakerUI.py create mode 100644 locale/en_US/LC_MESSAGES/gespeaker.mo create mode 100644 locale/it/LC_MESSAGES/gespeaker.mo diff --git a/DialogAbout.py b/DialogAbout.py new file mode 100644 index 0000000..2889d38 --- /dev/null +++ b/DialogAbout.py @@ -0,0 +1,40 @@ +## +# Project: gespeaker - A GTK frontend for espeak +# Author: Muflone Ubuntu Trucchi +## + +import gtk + +def DialogAbout(name=None, version=None, comment=None, + copyright=None, license=None, + website=None, website_label=None, + authors=None, translation=None, + logo=None, icon=None): + "Show an About Dialog with specified arguments" + about = gtk.AboutDialog() + if name: + about.set_name(name) + if version: + about.set_version(version) + if comment: + about.set_comments(comment) + if copyright: + about.set_copyright(copyright) + if license: + about.set_license(license) + if website: + about.set_website(website) + if website_label: + about.set_website_label(website_label) + gtk.about_dialog_set_url_hook(lambda url, data=None: url) + if authors: + about.set_authors(authors) + if translation: + about.set_translator_credits(translation) + if logo: + about.set_logo(gtk.gdk.pixbuf_new_from_file(logo)) + if icon: + about.set_icon_from_file('gespeaker.png') + + about.run() + about.destroy() diff --git a/DialogFileOpenSave.py b/DialogFileOpenSave.py new file mode 100644 index 0000000..b7db9c8 --- /dev/null +++ b/DialogFileOpenSave.py @@ -0,0 +1,54 @@ +## +# Project: gespeaker - A GTK frontend for espeak +# Author: Muflone Ubuntu Trucchi +## + +import gtk + +class DialogFileOpenSave(gtk.FileChooserDialog): + def __init__(self, useForOpen=True, title=None, initialDir=None, initialFile=None, askOverwrite=True): + gtk.FileChooserDialog.__init__( + self, title=title, parent=None, + action=gtk.FILE_CHOOSER_ACTION_SAVE, + buttons=( + gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_SAVE, gtk.RESPONSE_OK + ) + ) + self.connect('response', self._response_callback) + if initialDir: + self.set_current_folder(initialDir) + if initialFile: + self.set_current_name(initialFile) + self.set_do_overwrite_confirmation(askOverwrite) + self.filename = None + + def _response_callback(self, *args): + self.response = args[1] + if args[1] == gtk.RESPONSE_OK: + self.filename = self.get_filename() + self.destroy() + + def show(self): + super(self.__class__, self).run() + return self.response==gtk.RESPONSE_OK + +class DialogFileSave(DialogFileOpenSave): + def __init__(self, title=None, initialDir=None, initialFile=None, askOverwrite=True): + super(self.__class__, self).__init__( + useForOpen=False, + title=title, + initialDir=initialDir, + initialFile=initialFile, + askOverwrite=askOverwrite + ) + +class DialogFileOpen(DialogFileOpenSave): + def __init__(self, title=None, initialDir=None, initialFile=None): + super(self.__class__, self).__init__( + useForOpen=True, + title=title, + initialDir=initialDir, + initialFile=initialFile, + askOverwrite=False + ) diff --git a/DialogSimpleMessages.py b/DialogSimpleMessages.py new file mode 100644 index 0000000..b89f301 --- /dev/null +++ b/DialogSimpleMessages.py @@ -0,0 +1,30 @@ +## +# Project: gespeaker - A GTK frontend for espeak +# Author: Muflone Ubuntu Trucchi +## + +import gtk + +def ShowDialogGeneric(type, title=None, text=None, showOk=True): + dialog = gtk.MessageDialog( + parent=None, flags=gtk.DIALOG_MODAL, type=type, + buttons=showOk and gtk.BUTTONS_OK or gtk.BUTTONS_NONE, + message_format=text + ) + if title: + print title + dialog.set_title(title) + dialog.connect('response', lambda self, args: self.destroy()) + dialog.run() + +def ShowDialogWarning(title=None, text=None, showOk=True): + return ShowDialogGeneric(gtk.MESSAGE_WARNING, title=title, text=text, showOk=showOk) + +def ShowDialogError(title=None, text=None, showOk=True): + return ShowDialogGeneric(gtk.MESSAGE_ERROR, title=title, text=text, showOk=showOk) + +def ShowDialogInfo(title=None, text=None, showOk=True): + return ShowDialogGeneric(gtk.MESSAGE_INFO, title=title, text=text, showOk=showOk) + +def ShowDialogQuestion(title=None, text=None, showOk=True): + return ShowDialogGeneric(gtk.MESSAGE_QUESTION, title=title, text=text, showOk=showOk) diff --git a/DialogYesNo.py b/DialogYesNo.py new file mode 100644 index 0000000..2deef35 --- /dev/null +++ b/DialogYesNo.py @@ -0,0 +1,33 @@ +## +# Project: gespeaker - A GTK frontend for espeak +# Author: Muflone Ubuntu Trucchi +## + +import gtk + +class DialogYesNo(gtk.MessageDialog): + def __init__(self, message=None, default_button=gtk.RESPONSE_YES): + super(self.__class__, self).__init__(parent=None, flags=gtk.DIALOG_MODAL, + type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_YES_NO, + message_format=message) + self.response = None + self.set_default_response(default_button == gtk.RESPONSE_YES + and gtk.RESPONSE_YES or gtk.RESPONSE_NO) + self.connect('response', self._response_callback) + + def _response_callback(self, *args): + self.response = args[1] + self.destroy() + + def show(self): + super(self.__class__, self).run() + return self.response + + def responseIsYes(self): + return self.response == gtk.RESPONSE_YES + + def responseIsNo(self): + return self.response == gtk.RESPONSE_NO + + def responseIsCancel(self): + return self.response == gtk.RESPONSE_DELETE_EVENT diff --git a/copyright b/copyright new file mode 100644 index 0000000..26511d8 --- /dev/null +++ b/copyright @@ -0,0 +1,17 @@ +Copyright 2009 by Muflone + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +The full text of the GNU General Public License is available on Debian +systems in /usr/share/common-licenses/GPL-2. diff --git a/doc/changelog b/doc/changelog new file mode 100644 index 0000000..95f578e --- /dev/null +++ b/doc/changelog @@ -0,0 +1,6 @@ +gespeaker (0.1-1) jaunty; urgency=low + + * Initial release + + -- Muflone Sat, 13 Jun 2009 00:00:00 +0100 + diff --git a/doc/copyright b/doc/copyright new file mode 100644 index 0000000..26511d8 --- /dev/null +++ b/doc/copyright @@ -0,0 +1,17 @@ +Copyright 2009 by Muflone + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +The full text of the GNU General Public License is available on Debian +systems in /usr/share/common-licenses/GPL-2. diff --git a/gespeaker b/gespeaker new file mode 100755 index 0000000..0eff0f6 --- /dev/null +++ b/gespeaker @@ -0,0 +1,3 @@ +#!/bin/bash +cd /usr/share/gespeaker +env python gespeaker.py diff --git a/gespeaker.desktop b/gespeaker.desktop new file mode 100644 index 0000000..1afb024 --- /dev/null +++ b/gespeaker.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=Gespeaker +Comment=A frontend for espeak +Type=Application +Comment[it_IT]=Un frontend per espeak +Exec=/usr/bin/gespeaker +Icon=/usr/share/gespeaker/gespeaker.png +Terminal=false +Categories=AudioVideo;Audio;Player;GTK; diff --git a/gespeaker.glade b/gespeaker.glade new file mode 100644 index 0000000..c579e07 --- /dev/null +++ b/gespeaker.glade @@ -0,0 +1,489 @@ + + + + + + + + + True + vertical + + + True + + + True + _File + True + + + True + + + gtk-new + True + True + True + + + + + + gtk-open + True + True + True + + + + + + gtk-save-as + True + True + True + + + + + + True + + + + + gtk-quit + True + True + True + + + + + + + + + + True + _Edit + True + + + True + + + gtk-media-play + True + True + True + + + + + + gtk-media-record + True + False + True + True + + + + + + gtk-revert-to-saved + True + True + True + + + + + + + + + + True + _Help + True + + + True + + + gtk-about + True + True + True + + + + + + + + + + False + 0 + + + + + True + + + True + True + True + gtk-new + + + + False + True + + + + + True + True + True + gtk-open + + + + False + True + + + + + True + True + True + gtk-save-as + + + + False + True + + + + + True + + + False + True + + + + + True + False + True + True + gtk-media-record + + + + False + True + + + + + True + + + False + True + + + + + True + True + True + gtk-revert-to-saved + + + + False + True + + + + + True + True + True + gtk-quit + + + + False + True + + + + + False + 1 + + + + + True + 4 + + + True + 0 + + + 200 + True + + + True + vertical + + + True + True + 0 0 200 20 180 200 + 0 0 131 13.100000000000001 117.90000000000001 131 + automatic + automatic + + + True + True + False + + + + + 0 + + + + + gtk-media-play + True + True + True + True + + + + False + 1 + + + + + + + + + True + <b>Insert text to play</b> + True + + + label_item + + + + + 0 + + + + + True + 0 + out + + + 250 + True + 0.99000000953674316 + 4 + + + True + 5 + 2 + + + True + True + 50 0 99 1 10 0 + 0 + + + 1 + 2 + + + + + True + 0 + P_itch + True + hscPitch + + + GTK_FILL + + + + + True + 0 + _Volume + True + hscVolume + + + 1 + 2 + GTK_FILL + + + + + True + True + discontinuous + 100 0 200 1 10 0 + 0 + + + 1 + 2 + 1 + 2 + + + + + True + 0 + _Speed + True + hscSpeed + + + 2 + 3 + GTK_FILL + + + + + True + True + discontinuous + 170 80 390 1 10 0 + 0 + + + 1 + 2 + 2 + 3 + + + + + True + True + 10 5 100 1 10 0 + 0 + + + 1 + 2 + 3 + 4 + + + + + True + 0 + _Delay + True + hscDelay + + + 3 + 4 + GTK_FILL + + + + + True + + + 1 + 2 + 4 + 5 + GTK_EXPAND + + + + + True + 0 + _Language + True + cboLanguages + + + 4 + 5 + GTK_FILL + GTK_EXPAND + + + + + + + + + True + <b>Settings</b> + True + + + label_item + + + + + 1 + + + + + 2 + + + + + + diff --git a/gespeaker.png b/gespeaker.png new file mode 100644 index 0000000000000000000000000000000000000000..baaaefa4c080eba0ca5dec0bf9d4164d92e96314 GIT binary patch literal 4049 zcmWkx2{hDi7ykVQV;Nf%r6DByuJE@fOH9O+C}gD75?R_XMrB{ij2T-bW62uHSert^ zWZx5$T{Vm?gJHh;&U@~A&%NiKbMO0{d!KvWI0t)c0X_*n000DR&RZba8uNeQfwJ#b z6VGn80)vp&=0HUce3@-PZy>BK0M`FcUUN|z+rt}h{%Q~az(oHqAds1Tl0+QE2P{Sl(N--+ma~BQ& zuKQ707(a3^CU;m=(E_I#E>Z<|5m4pIKO%)ZPCrbSqX(Pj0CW9x*!{j9LD#XsI z!D^p;n>roY@myZgg6n7mGyp~~GRyxu;v@W6kReVr4O*UC69&BQFmF-?slAcgoTv>r zM2bR8+a6k%ljv?^I+2^nWq?huJhi#jB+jZMF_$~+I0I$oSL`PP*oR{qfBxOofrQ2L zftrwwBJel{7ZQ+&KEp|F%!tsU?@N4GNq8egF5R-RP}Po5sv_DGgy`PtIYTl)*upfx zJUXrCq47bDCoR?mb&y21LP54HBLOq7I0}oP#gM%P-;h3-|1O3q>Ti{5@meU}kzLr- z;?n0P__ZWZ#`lrbzrw&NKsvq44Hi~+fnv(X1Q>eM46W-uo5vi2L6+ectu1Y4LXi)q zo!s^yu}J)}F%KYYsT~1U4S!LWNHUs5jHMzJQtE%prFWeMKXDXbd^&*Ncs4HnBd35H zC6vpp%pJjwEiw8X^2z$(z^ZJR2;$Z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qPL(1Ur7cRWpz zpuzn+1rG^`<@O{E9S0T^ajhw3w9@x)gdkawr4+cYO~r13u9EA?)PBtpD|>D08C$!M zzWe*HTAAPTg0NGo=S~LjUq1hDvtY7R zZSja0g4c^)Z*L)R3J|8PjD&{2r5jB)<>suYd>T+3@U|#h2{Yo|B-zl6-N|GA9}+KS<5ewYBV-u->T3Rdxseq zI*Y^;d}XN_Jz?nanbsKYcb@h#z}K^T`Te{dA65q2HU6>JhuZMzA_uO-=Y@|RZCj%v z>2Du&c!>u?{J-M7$K4l#(25}3@k*EJ+|7yc^Os{!?`A<6R}zq+4f&2*Z@(Cra$?+t xRl8c(pe~i3%k*5KFHz#kTenF_87H-U(~u{6?H>|nlG*=lz{b+vqQV^Y?0=HNs&fDU literal 0 HcmV?d00001 diff --git a/gespeaker.py b/gespeaker.py new file mode 100755 index 0000000..c4c8474 --- /dev/null +++ b/gespeaker.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +## +# Project: gespeaker - A GTK frontend for espeak +# Author: Muflone Ubuntu Trucchi +## + +import sys +import gettext +import gtk.glade +import gespeakerUI + +APP_NAME = 'gespeaker' +APP_TITLE = 'Gespeaker' +APP_VERSION = '0.1' +LOCALE_DIR = '/usr/share/locale' + +if __name__ == '__main__': + for module in (gettext, gtk.glade): + module.bindtextdomain(APP_NAME, LOCALE_DIR) + module.textdomain(APP_NAME) + main = gespeakerUI.gespeakerUI(APP_NAME, APP_TITLE, APP_VERSION) diff --git a/gespeakerUI.py b/gespeakerUI.py new file mode 100644 index 0000000..4205c3e --- /dev/null +++ b/gespeakerUI.py @@ -0,0 +1,205 @@ +## +# Project: gespeaker - A GTK frontend for espeak +# Author: Muflone Ubuntu Trucchi +## + +import gtk +import gtk.glade +import pygtk +pygtk.require("2.0") + +import subprocess +from gettext import gettext as _ + +from DialogYesNo import DialogYesNo +from DialogFileOpenSave import DialogFileOpen, DialogFileSave +from DialogSimpleMessages import * +from DialogAbout import DialogAbout + +espeakcmd = '/usr/bin/espeak' +espeakargs = '--stdout -a %d -p %d -s %d -g %d -v %s "%s" | aplay 2> /dev/null' + +class gespeakerUI(): + def __init__(self, app_name, app_title, app_version): + print 'starting gespeaker' + gladeUI = 'gespeaker.glade' + self.app_name = app_name + self.app_title = app_title + self.app_version = app_version + print 'loading interface from %s' % gladeUI + self.gladeFile = gtk.glade.XML(fname=gladeUI, domain=self.app_name) + # Signals handler + segnali = { + 'on_imgmenuFileQuit_activate': self.on_imgmenuFileQuit_activate, + 'on_imgmenuEditPlay_activate': self.on_imgmenuEditPlay_activate, + 'on_imgmenuFileNew_activate': self.on_imgmenuFileNew_activate, + 'on_imgmenuFileOpen_activate': self.on_imgmenuFileOpen_activate, + 'on_imgmenuFileSaveAs_activate': self.on_imgmenuFileSaveAs_activate, + 'on_imgmenuEditResetSettings_activate': self.on_imgmenuEditResetSettings_activate, + 'on_imgmenuHelpAbout_activate': self.on_imgmenuHelpAbout_activate + } + self.gladeFile.signal_autoconnect(segnali) + # Load window and controls + self.loadControls() + self.winMain.show() + gtk.main() + + def loadControls(self): + "Load controls and other values" + # Load controls from gladeFile + print 'loading controls from UI' + self.winMain = self.gladeFile.get_widget('winMain') + self.winMain.set_title(self.app_title) + self.winMain.set_icon_from_file('gespeaker.png') + self.txvBuffer = self.gladeFile.get_widget('txvText').get_buffer() + self.hscVolume = self.gladeFile.get_widget('hscVolume') + self.hscPitch = self.gladeFile.get_widget('hscPitch') + self.hscSpeed = self.gladeFile.get_widget('hscSpeed') + self.hscDelay = self.gladeFile.get_widget('hscDelay') + self.cboLanguages = self.gladeFile.get_widget('cboLanguages') + # Useful lambda to get txvBuffer's text + self.getText = lambda buffer=self.txvBuffer: buffer.get_text( + buffer.get_start_iter(), buffer.get_end_iter() + ) + # Create model for cboLanguages by (language, shortname) + listLanguages = gtk.ListStore(str, str) + self.cboLanguages.set_model(listLanguages) + cell = gtk.CellRendererText() + self.cboLanguages.pack_start(cell, True) + self.cboLanguages.add_attribute(cell, 'text', 0) + # Load languages list from espeak --voices + print 'loading languages from %s --voices' % espeakcmd + p = subprocess.Popen((espeakcmd, '--voices'), stdout=subprocess.PIPE) + self.defaultLanguage = 0 + for langs in p.communicate()[0].split('\n')[1:-1]: + lang = langs[22:52].rsplit(None, 1) + listLanguages.append(lang) + if lang[0] == _('default language'): + self.defaultLanguage = listLanguages.iter_n_children(None) - 1 + # Sets default language + self.cboLanguages.set_active(self.defaultLanguage) + + def on_imgmenuFileQuit_activate(self, widget, data=None): + "Close the program" + print 'quitting' + gtk.main_quit() + return 0 + + def on_imgmenuEditPlay_activate(self, widget, data=None): + "Play whole text" + text = self.getText(self.txvBuffer) + text = text.replace('\\', '\\\\') + text = text.replace('`', '\\`') + text = text.replace('"', '\\"') + text = text.replace('$', '\\$') + print text + if text: + cmd = '%s %s' % (espeakcmd, espeakargs % ( + self.hscVolume.get_value(), + self.hscPitch.get_value(), + self.hscSpeed.get_value(), + self.hscDelay.get_value(), + self.cboLanguages.get_model()[self.cboLanguages.get_active()][1], + text + ) + ) + print cmd + processPlay = subprocess.Popen(cmd, shell=True) + + def on_imgmenuFileNew_activate(self, widget, data=None): + "Clears the whole text" + if self.getText(self.txvBuffer): + dialog = DialogYesNo( + message=_('Do you want to delete the current text?'), + default_button=gtk.RESPONSE_NO + ) + dialog.set_icon_from_file('gespeaker.png') + dialog.show() + if dialog.responseIsYes(): + self.txvBuffer.set_text('') + print 'text cleared' + + def on_imgmenuFileOpen_activate(self, widget, data=None): + "Loads an external file" + dialog = DialogFileOpen(title=_('Please select the file to open')) + dialog.set_icon_from_file('gespeaker.png') + if dialog.show(): + file = None + try: + file = open(dialog.filename, 'r') + self.txvBuffer.set_text(file.read()) + print 'loading text from %s' % dialog.filename + except IOError, (errno, strerror): + ShowDialogError( + text=_('Error opening the file') + '\n\n%s' % strerror, + showOk=True + ) + print "unable to load %s (I/O error %s: %s)" % ( + dialog.filename, errno, strerror + ) + except: + ShowDialogError(text=_('Error opening the file'), showOk=True) + print 'error loading %s' % dialog.filename + finally: + if file: + file.close() + + def on_imgmenuFileSaveAs_activate(self, widget, data=None): + "Saves the whole text in the specified filename" + dialog = DialogFileSave(title=_('Please select where to save the file')) + dialog.set_icon_from_file('gespeaker.png') + if dialog.show(): + print 'saving text in %s' % dialog.filename + file = None + try: + file = open(dialog.filename, 'w') + file.write(self.getText(self.txvBuffer)) + print 'file %s saved' % dialog.filename + except IOError, (errno, strerror): + ShowDialogError( + text=_('Error saving the file') + '\n\n%s' % strerror, + showOk=True + ) + print "unable to save %s (I/O error %s: %s)" % ( + dialog.filename, errno, strerror + ) + except: + ShowDialogError(text=_('Error saving the file'), showOk=True) + print 'error saving %s' % dialog.filename + finally: + if file: + file.close() + + def on_imgmenuEditResetSettings_activate(self, widget, data=None): + "Restore default settings" + dialog = DialogYesNo( + message=_('Do you want to reset the default settings?'), + default_button=gtk.RESPONSE_NO + ) + dialog.set_icon_from_file('gespeaker.png') + dialog.show() + if dialog.responseIsYes(): + self.hscVolume.set_value(100) + self.hscPitch.set_value(50) + self.hscSpeed.set_value(170) + self.hscDelay.set_value(10) + if self.defaultLanguage: + self.cboLanguages.set_active(self.defaultLanguage) + print 'restored default settings' + + def on_imgmenuHelpAbout_activate(self, widget, data=None): + "Shows the about dialog" + print 'show about dialog' + DialogAbout( + name=self.app_title, + version=self.app_version, + comment=_('A GTK frontend for espeak'), + copyright='Copyright 2009 Muflone', + license=file('copyright', 'r').read(), + website='http://ubuntrucchi.wordpress.com/', + website_label='Ubuntu Trucchi', + authors=['Muflone '], + translation=_('translation'), + logo='gespeaker.png', + icon='gespeaker.png' + ) diff --git a/locale/en_US/LC_MESSAGES/gespeaker.mo b/locale/en_US/LC_MESSAGES/gespeaker.mo new file mode 100644 index 0000000000000000000000000000000000000000..72d3006982271fea6cdb7ff7ce3fd68e796aeb35 GIT binary patch literal 1574 zcmeH_&rcIU6vs!!UyDCMNi=H4gv4K2XsZ}3P(&!$NMj?FlSwn}zP2mV-OcPQ*qi@? z2fcaqPw<2X6pQ_uy%84Lk~d1y6y$zzg8OZpJQy1#kd#!IR))a3A;#JO@4p2f@|U{u$hh z{d&r8DSv0FQC!ak7Pz) z0W|vVgC_nGX!I#?5PXu_UxN6tS1I45dVE-M2ytu9wxP2T* z4Uiw-H?aknJdmP0 zK3p%DqXp91^;%)PpW<`XJG`lUPm|~Hrmr}K0f{9xE8&GwXxB$hJ4 zl7R(|_B~p5P3FJ)jbszQc@b*6nkx6zP717zYS>j0ojfmkE$N1Bt6VA#I(f v=UxzR!-?D&8rGalT=e+)37)+)X8mt!{;y3<$$PT&UHO)t=JoCl?a6)vH%^}%L}c!V5bp!|3)#C|Rq>JfS!?t^PEv?7id@O>WhWVMX_2)zh(p20*Z zjLmN^cC;hwxu;L@F}zS>Z~pT3VsLGe_fijCTwmiid$;+(8tqBvd|)gmSCF{FmJQ!C zCBG|ljF6KePu%Yi&q`}4SP^{b@IFh9;KH_?2BK7+V;%D?u@!3(-xQ>gKkgYwMYY+9 z-TzqEQ|YrEwysDxLJ&n+6*rs-cM5S1x$o|fjXngcYK;lfWy1Ygx{^!J($$bNy+x{E z>6*~PQVg-)EQoTJ_Khk>#KyI&vEN&vof2Lev?jmE8|xqSk{gy{l4MzUYV(<9 z^Mj=Me$u+aXJ*>(&A!`&1sjtM+La;m|L(ims`jl3=aXJtxv@{GpfT=7(jzfy^Ntrv z3f<^-x+@1aZA~{DH=;T3pEVLCM!BKIi9)A zXSbzqtgF%rm8=>&a&4}QxO59Ma}aFsEWD-p8w~BA!=c1&#{RTt zG@9?f`(@Od{8D5=1H+dOah+9@B)GwbPV)ic)W2>?N literal 0 HcmV?d00001