~phoenix1987/gtumbler/uas

« back to all changes in this revision

Viewing changes to gtumbler/PreferencesGtumblerDialog.py

  • Committer: Gabriele N. Tornetta
  • Date: 2012-06-25 16:18:04 UTC
  • Revision ID: phoenix1987@gmail.com-20120625161804-qjyy0b6wc8svt5kx
quickly saved

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
# Copyright (C) 2012 Phoenix87 <phoenix1987@gmail.com>
 
4
# This program is free software: you can redistribute it and/or modify it 
 
5
# under the terms of the GNU General Public License version 3, as published 
 
6
# by the Free Software Foundation.
 
7
 
8
# This program is distributed in the hope that it will be useful, but 
 
9
# WITHOUT ANY WARRANTY; without even the implied warranties of 
 
10
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
 
11
# PURPOSE.  See the GNU General Public License for more details.
 
12
 
13
# You should have received a copy of the GNU General Public License along 
 
14
# with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
### END LICENSE
 
16
 
 
17
# This is your preferences dialog.
 
18
#
 
19
# Define your preferences dictionary in the __init__.main() function.
 
20
# The widget names in the PreferencesTestProjectDialog.ui
 
21
# file need to correspond to the keys in the preferences dictionary.
 
22
#
 
23
# Each preference also need to be defined in the 'widget_methods' map below
 
24
# to show up in the dialog itself.  Provide three bits of information:
 
25
#  1) The first entry is the method on the widget that grabs a value from the
 
26
#     widget.
 
27
#  2) The second entry is the method on the widget that sets the widgets value
 
28
#      from a stored preference.
 
29
#  3) The third entry is a signal the widget will send when the contents have
 
30
#     been changed by the user. The preferences dictionary is always up to
 
31
# date and will signal the rest of the application about these changes.
 
32
# The values will be saved to desktopcouch when the application closes.
 
33
#
 
34
# TODO: replace widget_methods with your own values
 
35
 
 
36
 
 
37
widget_methods = {
 
38
    'chk_convert': ['get_active', 'set_active', 'toggled'],
 
39
}
 
40
 
 
41
import gettext
 
42
from gettext import gettext as _
 
43
gettext.textdomain('gtumbler')
 
44
 
 
45
import logging
 
46
logger = logging.getLogger('gtumbler')
 
47
 
 
48
from gtumbler_lib.PreferencesDialog import PreferencesDialog
 
49
 
 
50
class PreferencesGtumblerDialog(PreferencesDialog):
 
51
    __gtype_name__ = "PreferencesGtumblerDialog"
 
52
 
 
53
    def finish_initializing(self, builder): # pylint: disable=E1002
 
54
        """Set up the preferences dialog"""
 
55
        super(PreferencesGtumblerDialog, self).finish_initializing(builder)
 
56
 
 
57
        # populate the dialog from the preferences dictionary
 
58
        # using the methods from widget_methods
 
59
        self.widget_methods = widget_methods
 
60
        self.set_widgets_from_preferences() # pylint: disable=E1101
 
61
 
 
62
        # Code for other initialization actions should be added here.