~ubuntu-branches/ubuntu/saucy/solfege/saucy

« back to all changes in this revision

Viewing changes to solfege/optionparser.py

  • Committer: Bazaar Package Importer
  • Author(s): Tom Cato Amundsen
  • Date: 2010-03-28 06:34:28 UTC
  • mfrom: (1.1.10 upstream) (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100328063428-wg2bqvoce2aq4xfb
Tags: 3.15.9-1
* New upstream release.
* Redo packaging. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# GNU Solfege - free ear training software
 
2
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008  Tom Cato Amundsen
 
3
#
 
4
# This program is free software: you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation, either version 3 of the License, or
 
7
# (at your option) any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 
 
17
from __future__ import absolute_import
 
18
 
 
19
import optparse
 
20
import sys
 
21
 
 
22
class SolfegeOptionParser(optparse.OptionParser):
 
23
    def __init__(self):
 
24
        optparse.OptionParser.__init__(self)
 
25
        self.add_option('-v', '--version', action='store_true', dest='version')
 
26
        self.add_option('-w', '--warranty', action='store_true', dest='warranty',
 
27
            help=_('Show warranty and copyright.'))
 
28
        self.add_option('--no-splash', action='store_true', dest='no_splash',
 
29
            help=_('Do not show the startup window.'),
 
30
            default=False)
 
31
        self.add_option('--verbose-sound-init', action='store_true',
 
32
            default=False,
 
33
            dest='verbose_sound_init',
 
34
            help=_('Display more info about the sound setup.'))
 
35
        self.add_option('--no-sound', action='store_true', dest='no_sound',
 
36
            default=False,
 
37
            help=_('Do not play any sounds. Instead some data is printed to standard output. Use this for debugging and porting.'))
 
38
        self.add_option('--debug', action='store_true', dest='debug',
 
39
            help=_('Include features used by the Solfege developers to debug the program.'))
 
40
        self.add_option('--disable-exception-handler', action='store_true',
 
41
            dest='disable_exception_handler',
 
42
            help=_("Disable the exception handling in Gui.standard_exception_handler."))
 
43
        self.add_option('--no-random', action='store_true', dest='no_random',
 
44
            help=_('For debugging only: Select questions from lesson files in sequential order.'))
 
45
        self.add_option('--show-gtk-warnings', action='store_true',
 
46
            dest='show_gtk_warnings',
 
47
            help=_('Show GtkWarnings and PangoWarnings in the traceback window.'))
 
48
    def print_help(self, outfile=None):
 
49
        if outfile is None:
 
50
            outfile = sys.stdout
 
51
        encoding = outfile.encoding
 
52
        if not encoding:
 
53
            encoding = "iso-8859-1"
 
54
        outfile.write(self.format_help().encode(encoding, 'replace'))
 
55
 
 
56
 
 
57