~jonobacon/acire/trunk

« back to all changes in this revision

Viewing changes to acire/AboutAcireDialog.py

  • Committer: Jono Bacon
  • Date: 2009-12-29 12:07:58 UTC
  • Revision ID: jono@ubuntu.com-20091229120758-ezp270vgx2i3fkny
Initial project creation with Quickly!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
### BEGIN LICENSE
 
3
# This file is in the public domain
 
4
### END LICENSE
 
5
 
 
6
import sys
 
7
import os
 
8
import gtk
 
9
 
 
10
from acire.acireconfig import getdatapath
 
11
 
 
12
class AboutAcireDialog(gtk.AboutDialog):
 
13
    __gtype_name__ = "AboutAcireDialog"
 
14
 
 
15
    def __init__(self):
 
16
        """__init__ - This function is typically not called directly.
 
17
        Creation of a AboutAcireDialog requires redeading the associated ui
 
18
        file and parsing the ui definition extrenally, 
 
19
        and then calling AboutAcireDialog.finish_initializing().
 
20
    
 
21
        Use the convenience function NewAboutAcireDialog to create 
 
22
        NewAboutAcireDialog objects.
 
23
    
 
24
        """
 
25
        pass
 
26
 
 
27
    def finish_initializing(self, builder):
 
28
        """finish_initalizing should be called after parsing the ui definition
 
29
        and creating a AboutAcireDialog object with it in order to finish
 
30
        initializing the start of the new AboutAcireDialog instance.
 
31
    
 
32
        """
 
33
        #get a reference to the builder and set up the signals
 
34
        self.builder = builder
 
35
        self.builder.connect_signals(self)
 
36
 
 
37
        #code for other initialization actions should be added here
 
38
 
 
39
def NewAboutAcireDialog():
 
40
    """NewAboutAcireDialog - returns a fully instantiated
 
41
    AboutAcireDialog object. Use this function rather than
 
42
    creating a AboutAcireDialog instance directly.
 
43
    
 
44
    """
 
45
 
 
46
    #look for the ui file that describes the ui
 
47
    ui_filename = os.path.join(getdatapath(), 'ui', 'AboutAcireDialog.ui')
 
48
    if not os.path.exists(ui_filename):
 
49
        ui_filename = None
 
50
 
 
51
    builder = gtk.Builder()
 
52
    builder.add_from_file(ui_filename)    
 
53
    dialog = builder.get_object("about_acire_dialog")
 
54
    dialog.finish_initializing(builder)
 
55
    return dialog
 
56
 
 
57
if __name__ == "__main__":
 
58
    dialog = NewAboutAcireDialog()
 
59
    dialog.show()
 
60
    gtk.main()
 
61