~stewart/mythremote/quickly_trunk

« back to all changes in this revision

Viewing changes to mythremote/__init__.py

  • Committer: Stewart Smith
  • Date: 2012-02-05 04:40:51 UTC
  • Revision ID: stewart@flamingspork.com-20120205044051-b86m7edpcxosnziq
Initial project creation with Quickly!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 
2
### BEGIN LICENSE
 
3
# This file is in the public domain
 
4
### END LICENSE
 
5
 
 
6
import optparse
 
7
 
 
8
import gettext
 
9
from gettext import gettext as _
 
10
gettext.textdomain('mythremote')
 
11
 
 
12
import gtk
 
13
 
 
14
from mythremote import MythremoteWindow
 
15
 
 
16
from mythremote_lib import set_up_logging, preferences, get_version
 
17
 
 
18
def parse_options():
 
19
    """Support for command line options"""
 
20
    parser = optparse.OptionParser(version="%%prog %s" % get_version())
 
21
    parser.add_option(
 
22
        "-v", "--verbose", action="count", dest="verbose",
 
23
        help=_("Show debug messages (-vv debugs mythremote_lib also)"))
 
24
    (options, args) = parser.parse_args()
 
25
 
 
26
    set_up_logging(options)
 
27
 
 
28
def main():
 
29
    'constructor for your class instances'
 
30
    parse_options()
 
31
 
 
32
    # preferences
 
33
    # set some values for our first session
 
34
    # TODO: replace defaults with your own values
 
35
    default_preferences = {
 
36
    'example_entry': 'I remember stuff',
 
37
    }
 
38
    preferences.update(default_preferences)
 
39
    # user's stored preferences are used for 2nd and subsequent sessions
 
40
    preferences.db_connect()
 
41
    preferences.load()
 
42
 
 
43
    # Run the application.    
 
44
    window = MythremoteWindow.MythremoteWindow()
 
45
    window.show()
 
46
    gtk.main()
 
47
    
 
48
    preferences.save()