~luismmontielg/+junk/godownloader

« back to all changes in this revision

Viewing changes to godownloader/AboutGodownloaderDialog.py

  • Committer: Luis Montiel
  • Date: 2010-01-21 18:23:41 UTC
  • Revision ID: luis@luis-laptop-20100121182341-5ybbqj3n3liw9zvi
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 godownloader.godownloaderconfig import getdatapath
 
11
 
 
12
class AboutGodownloaderDialog(gtk.AboutDialog):
 
13
    __gtype_name__ = "AboutGodownloaderDialog"
 
14
 
 
15
    def __init__(self):
 
16
        """__init__ - This function is typically not called directly.
 
17
        Creation of a AboutGodownloaderDialog requires redeading the associated ui
 
18
        file and parsing the ui definition extrenally, 
 
19
        and then calling AboutGodownloaderDialog.finish_initializing().
 
20
    
 
21
        Use the convenience function NewAboutGodownloaderDialog to create 
 
22
        NewAboutGodownloaderDialog 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 AboutGodownloaderDialog object with it in order to finish
 
30
        initializing the start of the new AboutGodownloaderDialog 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 NewAboutGodownloaderDialog():
 
40
    """NewAboutGodownloaderDialog - returns a fully instantiated
 
41
    AboutGodownloaderDialog object. Use this function rather than
 
42
    creating a AboutGodownloaderDialog instance directly.
 
43
    
 
44
    """
 
45
 
 
46
    #look for the ui file that describes the ui
 
47
    ui_filename = os.path.join(getdatapath(), 'ui', 'AboutGodownloaderDialog.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_godownloader_dialog")
 
54
    dialog.finish_initializing(builder)
 
55
    return dialog
 
56
 
 
57
if __name__ == "__main__":
 
58
    dialog = NewAboutGodownloaderDialog()
 
59
    dialog.show()
 
60
    gtk.main()
 
61