Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | import Pmw |
2 | ||
3 | class AboutDialog(Pmw.MessageDialog): | |
4 | # Window to display version and contact information. | |
5 | ||
6 | # Class members containing resettable 'default' values: | |
7 | _version = '' | |
8 | _copyright = '' | |
9 | _contact = '' | |
10 | ||
11 | def __init__(self, parent = None, **kw): | |
12 | ||
13 | # Define the megawidget options. | |
14 | INITOPT = Pmw.INITOPT | |
15 | optiondefs = ( | |
16 | ('applicationname', '', INITOPT), | |
17 | ('iconpos', 'w', None), | |
18 | ('icon_bitmap', 'info', None), | |
19 | ('buttons', ('Close',), None), | |
20 | ('defaultbutton', 0, None), | |
21 | ) | |
22 | self.defineoptions(kw, optiondefs) | |
23 | ||
24 | # Initialise the base class (after defining the options). | |
25 | Pmw.MessageDialog.__init__(self, parent) | |
26 | ||
27 | applicationname = self['applicationname'] | |
28 | if not kw.has_key('title'): | |
29 | self.configure(title = 'About ' + applicationname) | |
30 | ||
31 | if not kw.has_key('message_text'): | |
32 | text = applicationname + '\n\n' | |
33 | if AboutDialog._version != '': | |
34 | text = text + 'Version ' + AboutDialog._version + '\n' | |
35 | if AboutDialog._copyright != '': | |
36 | text = text + AboutDialog._copyright + '\n\n' | |
37 | if AboutDialog._contact != '': | |
38 | text = text + AboutDialog._contact | |
39 | ||
40 | self.configure(message_text=text) | |
41 | ||
42 | # Check keywords and initialise options. | |
43 | self.initialiseoptions() | |
44 | ||
45 | def aboutversion(value): | |
46 | AboutDialog._version = value | |
47 | ||
48 | def aboutcopyright(value): | |
49 | AboutDialog._copyright = value | |
50 | ||
51 | def aboutcontact(value): | |
52 | AboutDialog._contact = value |