Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
muflone committed Jun 19, 2009
1 parent 3c47032 commit 7a7d2f9
Show file tree
Hide file tree
Showing 15 changed files with 926 additions and 0 deletions.
40 changes: 40 additions & 0 deletions DialogAbout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##
# Project: gespeaker - A GTK frontend for espeak
# Author: Muflone Ubuntu Trucchi <[email protected]>
##

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()
54 changes: 54 additions & 0 deletions DialogFileOpenSave.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
##
# Project: gespeaker - A GTK frontend for espeak
# Author: Muflone Ubuntu Trucchi <[email protected]>
##

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
)
30 changes: 30 additions & 0 deletions DialogSimpleMessages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
##
# Project: gespeaker - A GTK frontend for espeak
# Author: Muflone Ubuntu Trucchi <[email protected]>
##

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)
33 changes: 33 additions & 0 deletions DialogYesNo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
##
# Project: gespeaker - A GTK frontend for espeak
# Author: Muflone Ubuntu Trucchi <[email protected]>
##

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
17 changes: 17 additions & 0 deletions copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Copyright 2009 by Muflone <[email protected]>

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.
6 changes: 6 additions & 0 deletions doc/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gespeaker (0.1-1) jaunty; urgency=low

* Initial release

-- Muflone <[email protected]> Sat, 13 Jun 2009 00:00:00 +0100

17 changes: 17 additions & 0 deletions doc/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Copyright 2009 by Muflone <[email protected]>

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.
3 changes: 3 additions & 0 deletions gespeaker
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
cd /usr/share/gespeaker
env python gespeaker.py
10 changes: 10 additions & 0 deletions gespeaker.desktop
Original file line number Diff line number Diff line change
@@ -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;
Loading

0 comments on commit 7a7d2f9

Please sign in to comment.