~carifio/+junk/ua0

« back to all changes in this revision

Viewing changes to ua0/PreferencesUa0Dialog.py

  • Committer: Mike Carifio
  • Date: 2012-02-16 19:18:41 UTC
  • Revision ID: michael.carifio@canonical.com-20120216191841-j9ye1np5v95zb8zr
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
# This is your preferences dialog.
 
7
#
 
8
# Define your preferences dictionary in the __init__.main() function.
 
9
# The widget names in the PreferencesTestProjectDialog.ui
 
10
# file need to correspond to the keys in the preferences dictionary.
 
11
#
 
12
# Each preference also need to be defined in the 'widget_methods' map below
 
13
# to show up in the dialog itself.  Provide three bits of information:
 
14
#  1) The first entry is the method on the widget that grabs a value from the
 
15
#     widget.
 
16
#  2) The second entry is the method on the widget that sets the widgets value
 
17
#      from a stored preference.
 
18
#  3) The third entry is a signal the widget will send when the contents have
 
19
#     been changed by the user. The preferences dictionary is always up to
 
20
# date and will signal the rest of the application about these changes.
 
21
# The values will be saved to desktopcouch when the application closes.
 
22
#
 
23
# TODO: replace widget_methods with your own values
 
24
 
 
25
 
 
26
widget_methods = {
 
27
    'example_entry': ['get_text', 'set_text', 'changed'],
 
28
}
 
29
 
 
30
import gettext
 
31
from gettext import gettext as _
 
32
gettext.textdomain('ua0')
 
33
 
 
34
import logging
 
35
logger = logging.getLogger('ua0')
 
36
 
 
37
from ua0_lib.PreferencesDialog import PreferencesDialog
 
38
 
 
39
class PreferencesUa0Dialog(PreferencesDialog):
 
40
    __gtype_name__ = "PreferencesUa0Dialog"
 
41
 
 
42
    def finish_initializing(self, builder): # pylint: disable=E1002
 
43
        """Set up the preferences dialog"""
 
44
        super(PreferencesUa0Dialog, self).finish_initializing(builder)
 
45
 
 
46
        # populate the dialog from the preferences dictionary
 
47
        # using the methods from widget_methods
 
48
        self.widget_methods = widget_methods
 
49
        self.set_widgets_from_preferences() # pylint: disable=E1101
 
50
 
 
51
        # Code for other initialization actions should be added here.