~thomas-deruyter-3/qreator/qreator

« back to all changes in this revision

Viewing changes to qreator/__init__.py

  • Committer: David Planella
  • Date: 2012-05-23 12:58:45 UTC
  • mto: This revision was merged to the branch mainline in revision 67.
  • Revision ID: david.planella@ubuntu.com-20120523125845-7589t51mtsj44kjm
Started using the gettext C API (locale module) instead of the Python one (gettext module), so that translations are loaded when installing the app in /opt. See http://askubuntu.com/questions/140552/how-to-make-glade-load-translations-from-opt. Minor whitespace fixes. Removed shebang from QRCode.py to stop Lintian complaining

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import optparse
18
18
 
19
 
import gettext
20
 
from gettext import gettext as _
21
 
gettext.textdomain('qreator')
 
19
TEXTDOMAIN = 'qreator'
 
20
LOCALEDIR = '/opt/extras.ubuntu.com/qreator/share/locale/'
 
21
import locale
 
22
from locale import gettext as _
 
23
locale.bind_textdomain_codeset(TEXTDOMAIN, LOCALEDIR, 'UTF-8')
 
24
locale.textdomain(TEXTDOMAIN)
22
25
 
23
26
from gi.repository import GtkClutter
24
27
## Needs to be called here, otherwise the GtkChamplain widget needs to be
25
28
## explicitly connected to signals and methods defined
26
29
GtkClutter.init([])
27
 
from gi.repository import Gtk # pylint: disable=E0611
 
30
from gi.repository import Gtk  # pylint: disable=E0611
28
31
 
29
32
from qreator import QreatorWindow
30
33
 
31
34
from qreator_lib import set_up_logging, get_version
32
35
 
 
36
 
33
37
def parse_options():
34
38
    """Support for command line options"""
35
39
    parser = optparse.OptionParser(version="%%prog %s" % get_version())
43
47
        "-t", "--text", dest="view", action="store_const", const="text",
44
48
        help=_("Create a QR code from text"))
45
49
    parser.add_option(
46
 
        "-l", "--location", dest="view", action="store_const", const="location",
47
 
        help=_("Create a QR code for a location"))
 
50
        "-l", "--location", dest="view", action="store_const",
 
51
        const="location", help=_("Create a QR code for a location"))
48
52
    parser.add_option(
49
53
        "-w", "--wifi", dest="view", action="store_const", const="wifi",
50
54
        help=_("Create a QR code for WiFi settings"))
53
57
    set_up_logging(options)
54
58
    return options
55
59
 
 
60
 
56
61
def main():
57
62
    'constructor for your class instances'
58
63
    options = parse_options()
59
64
 
60
 
    # Run the application. 
 
65
    # Run the application
61
66
    window = QreatorWindow.QreatorWindow()
62
67
    window.show()
63
68
    if getattr(options, 'view', None) is not None: