~popey/+junk/impunity

« back to all changes in this revision

Viewing changes to impunity_lib/PreferencesDialog.py

  • Committer: Alan Pope
  • Date: 2012-03-09 18:28:37 UTC
  • Revision ID: alan.pope@canonical.com-20120309182837-ro4kz76j6733f8q6
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 dialog adjusts values in gsettings
 
7
"""
 
8
 
 
9
from gi.repository import Gtk # pylint: disable=E0611
 
10
import logging
 
11
logger = logging.getLogger('impunity_lib')
 
12
 
 
13
from . helpers import get_builder, show_uri, get_help_uri
 
14
 
 
15
class PreferencesDialog(Gtk.Dialog):
 
16
    __gtype_name__ = "PreferencesDialog"
 
17
 
 
18
    def __new__(cls):
 
19
        """Special static method that's automatically called by Python when 
 
20
        constructing a new instance of this class.
 
21
        
 
22
        Returns a fully instantiated PreferencesDialog object.
 
23
        """
 
24
        builder = get_builder('PreferencesImpunityDialog')
 
25
        new_object = builder.get_object("preferences_impunity_dialog")
 
26
        new_object.finish_initializing(builder)
 
27
        return new_object
 
28
 
 
29
    def finish_initializing(self, builder):
 
30
        """Called while initializing this instance in __new__
 
31
 
 
32
        finish_initalizing should be called after parsing the ui definition
 
33
        and creating a PreferencesDialog object with it in order to
 
34
        finish initializing the start of the new PerferencesImpunityDialog
 
35
        instance.
 
36
        
 
37
        Put your initialization code in here and leave __init__ undefined.
 
38
        """
 
39
 
 
40
        # Get a reference to the builder and set up the signals.
 
41
        self.builder = builder
 
42
        self.ui = builder.get_ui(self, True)
 
43
 
 
44
        # code for other initialization actions should be added here
 
45
 
 
46
    def on_btn_close_clicked(self, widget, data=None):
 
47
        self.destroy()
 
48
 
 
49
    def on_btn_help_clicked(self, widget, data=None):
 
50
        show_uri(self, "ghelp:%s" % get_help_uri('preferences'))
 
51