~ubuntu-branches/ubuntu/natty/lernid/natty-backports

« back to all changes in this revision

Viewing changes to lernid/AboutLernidDialog.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-02-24 22:58:17 UTC
  • Revision ID: james.westby@ubuntu.com-20100224225817-0wio9xi53xv0fsbw
Tags: 0.6
Initial release in ubuntu (LP: #527312)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
### BEGIN LICENSE
 
3
# Copyright (C) 2009 Jono Bacon <jono@ubuntu.com>
 
4
# Copyright (C) 2010 Michael Budde <mbudde@gmail.com>
 
5
#
 
6
#This program is free software: you can redistribute it and/or modify it
 
7
#under the terms of the GNU General Public License version 3, as published
 
8
#by the Free Software Foundation.
 
9
#
 
10
#This program is distributed in the hope that it will be useful, but
 
11
#WITHOUT ANY WARRANTY; without even the implied warranties of
 
12
#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
13
#PURPOSE.  See the GNU General Public License for more details.
 
14
#
 
15
#You should have received a copy of the GNU General Public License along
 
16
#with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
### END LICENSE
 
18
 
 
19
import os
 
20
import gtk
 
21
 
 
22
from lernid.lernidconfig import *
 
23
 
 
24
 
 
25
class AboutLernidDialog(gtk.AboutDialog):
 
26
    __gtype_name__ = "AboutLernidDialog"
 
27
 
 
28
    def __init__(self):
 
29
        """__init__ - This function is typically not called directly.
 
30
        Creation of a AboutLernidDialog requires redeading the associated ui
 
31
        file and parsing the ui definition extrenally,
 
32
        and then calling AboutLernidDialog.finish_initializing().
 
33
 
 
34
        Use the convenience function NewAboutLernidDialog to create
 
35
        NewAboutLernidDialog objects.
 
36
 
 
37
        """
 
38
        gtk.AboutDialog.__init__(self)
 
39
 
 
40
    def finish_initializing(self, builder):
 
41
        """finish_initalizing should be called after parsing the ui definition
 
42
        and creating a AboutLernidDialog object with it in order to finish
 
43
        initializing the start of the new AboutLernidDialog instance.
 
44
 
 
45
        """
 
46
        #get a reference to the builder and set up the signals
 
47
        self.builder = builder
 
48
        self.builder.connect_signals(self)
 
49
 
 
50
        self.set_comments(DESCRIPTION)
 
51
        self.set_version(VERSION)
 
52
        self.set_website(WEBSITE)
 
53
        self.set_authors(CONTRIBUTORS)
 
54
        self.set_artists(ARTISTS)
 
55
        self.set_license(LICENSE)
 
56
 
 
57
        #code for other initialization actions should be added here
 
58
 
 
59
def NewAboutLernidDialog():
 
60
    """NewAboutLernidDialog - returns a fully instantiated
 
61
    AboutLernidDialog object. Use this function rather than
 
62
    creating a AboutLernidDialog instance directly.
 
63
 
 
64
    """
 
65
 
 
66
    #look for the ui file that describes the ui
 
67
    ui_filename = get_data_path('ui', 'AboutLernidDialog.ui')
 
68
    builder = gtk.Builder()
 
69
    builder.add_from_file(ui_filename)
 
70
    dialog = builder.get_object("about_lernid_dialog")
 
71
    dialog.finish_initializing(builder)
 
72
    return dialog
 
73
 
 
74
if __name__ == "__main__":
 
75
    dialog = NewAboutLernidDialog()
 
76
    dialog.show()
 
77
    gtk.main()
 
78