~dpm/qreator/snap

« back to all changes in this revision

Viewing changes to qreator/__init__.py

  • Committer: David Planella
  • Date: 2012-05-28 14:50:08 UTC
  • Revision ID: david.planella@ubuntu.com-20120528145008-dqhvnthrdcmid3mv
Make optparse not crash when using gettext, thanks Nicolas Delvaux for the help

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from qreator_lib import set_up_logging, get_version
30
30
 
31
31
 
 
32
def UTF8_(message):
 
33
    return _(message).decode('UTF-8')
 
34
 
 
35
 
32
36
def parse_options():
33
37
    """Support for command line options"""
34
38
    parser = optparse.OptionParser(version="%%prog %s" % get_version())
35
39
    parser.add_option(
36
40
        "-v", "--verbose", action="count", dest="verbose",
37
 
        help=_("Show debug messages (-vv debugs qreator_lib also)"))
 
41
        help=UTF8_("Show debug messages (-vv debugs qreator_lib also)"))
38
42
    parser.add_option(
39
43
        "-u", "--url", dest="view", action="store_const", const="url",
40
 
        help=_("Create a QR code for a URL"))
 
44
        help=UTF8_("Create a QR code for a URL"))
41
45
    parser.add_option(
42
46
        "-t", "--text", dest="view", action="store_const", const="text",
43
 
        help=_("Create a QR code from text"))
 
47
        help=UTF8_("Create a QR code from text"))
44
48
    parser.add_option(
45
49
        "-l", "--location", dest="view", action="store_const",
46
 
        const="location", help=_("Create a QR code for a location"))
 
50
        const="location", help=UTF8_("Create a QR code for a location"))
47
51
    parser.add_option(
48
52
        "-w", "--wifi", dest="view", action="store_const", const="wifi",
49
 
        help=_("Create a QR code for WiFi settings"))
 
53
        help=UTF8_("Create a QR code for WiFi settings"))
50
54
    (options, args) = parser.parse_args()
51
55
 
52
56
    set_up_logging(options)