~ubuntu-branches/ubuntu/jaunty/pida/jaunty

« back to all changes in this revision

Viewing changes to pida/services/help.py

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-08-01 13:08:56 UTC
  • mfrom: (0.1.2 etch) (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060801130856-v92ktopgdxc8rv7q
Tags: 0.3.1-2ubuntu1
* Re-sync with Debian
* Remove bashisms from debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*- 
 
2
 
 
3
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
 
4
#Copyright (c) 2006 Ali Afshar aafshar@gmail.com
 
5
 
 
6
#Permission is hereby granted, free of charge, to any person obtaining a copy
 
7
#of this software and associated documentation files (the "Software"), to deal
 
8
#in the Software without restriction, including without limitation the rights
 
9
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
10
#copies of the Software, and to permit persons to whom the Software is
 
11
#furnished to do so, subject to the following conditions:
 
12
 
 
13
#The above copyright notice and this permission notice shall be included in
 
14
#all copies or substantial portions of the Software.
 
15
 
 
16
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
19
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
20
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
21
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
22
#SOFTWARE.
 
23
 
 
24
import pida
 
25
import pida.core.service as service
 
26
 
 
27
import gtk
 
28
 
 
29
class about_dialog(gtk.AboutDialog):
 
30
    def __init__(self):
 
31
        gtk.AboutDialog.__init__(self)
 
32
 
 
33
 
 
34
class help(service.service):
 
35
 
 
36
    def cmd_about(self):
 
37
        dialog = gtk.AboutDialog()
 
38
        dialog.set_transient_for(self.boss.get_main_window())
 
39
        from pkg_resources import Requirement, resource_filename
 
40
        icon_file = resource_filename(Requirement.parse('pida'),
 
41
                                      'pida-icon.png')
 
42
        im = gtk.Image()
 
43
        im.set_from_file(icon_file)
 
44
        dialog.set_logo(im.get_pixbuf())
 
45
        dialog.set_version(self.boss.version)
 
46
        dialog.set_copyright(copyright)
 
47
        dialog.set_license(license)
 
48
        dialog.set_authors(authors)
 
49
        dialog.run()
 
50
 
 
51
    def act_about(self, action):
 
52
        self.call('about')
 
53
 
 
54
    def get_menu_definition(self):
 
55
        return """<menubar>
 
56
                    <menu name="base_help" action="base_help_menu">
 
57
                    <menuitem name="about" action="help+about" />    
 
58
                  </menu>
 
59
                    </menubar>"""
 
60
 
 
61
 
 
62
from pkg_resources import Requirement, resource_filename
 
63
req = Requirement.parse('pida')
 
64
license_file = open(resource_filename(req, 'COPYING'))
 
65
license = license_file.read()
 
66
license_file.close()
 
67
authors_file = open(resource_filename(req, 'AUTHORS'))
 
68
authors = [n.strip() for n in authors_file.read().splitlines()]
 
69
authors_file.close()
 
70
copyright = 'Copyright (c) 2005-6 The PIDA Project aafshar@gmail.com'
 
71
 
 
72
Service = help