~ubuntu-branches/ubuntu/natty/pida/natty

« back to all changes in this revision

Viewing changes to pida/services/help/help.py

  • Committer: Bazaar Package Importer
  • Author(s): Jan Luebbe
  • Date: 2007-09-05 17:54:09 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070905175409-ty9f6qpuctyjv1sd
Tags: 0.5.1-2
* Depend on librsvg2-common, which is not pulled in by the other depends
  (closes: #394860)
* gvim is no alternative for python-gnome2 and python-gnome2-extras
  (closes: #436431)
* Pida now uses ~/.pida2, so it can no longer be confused by old
  configurations (closes: #421378)
* Culebra is no longer supported by upstream (closes: #349009)
* Update manpage (closes: #440375)
* Update watchfile (pida is now called PIDA)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*- 
 
2
 
 
3
# Copyright (c) 2007 The PIDA Project
 
4
 
 
5
#Permission is hereby granted, free of charge, to any person obtaining a copy
 
6
#of this software and associated documentation files (the "Software"), to deal
 
7
#in the Software without restriction, including without limitation the rights
 
8
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
9
#copies of the Software, and to permit persons to whom the Software is
 
10
#furnished to do so, subject to the following conditions:
 
11
 
 
12
#The above copyright notice and this permission notice shall be included in
 
13
#all copies or substantial portions of the Software.
 
14
 
 
15
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
18
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
19
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
20
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
21
#SOFTWARE.
 
22
 
 
23
 
 
24
import gtk
 
25
from gtk import gdk
 
26
 
 
27
# PIDA Imports
 
28
from pida.core.service import Service
 
29
from pida.core.features import FeaturesConfig
 
30
from pida.core.commands import CommandsConfig
 
31
from pida.core.events import EventsConfig
 
32
from pida.core.actions import ActionsConfig
 
33
from pida.core.actions import TYPE_NORMAL, TYPE_MENUTOOL, TYPE_RADIO, TYPE_TOGGLE
 
34
 
 
35
from pida.core.environment import get_pixmap_path
 
36
 
 
37
from pida import PIDA_NAME, PIDA_VERSION, PIDA_AUTHORS, PIDA_COPYRIGHT, \
 
38
                 PIDA_LICENSE, PIDA_WEBSITE, PIDA_SHORT_DESCRIPTION
 
39
 
 
40
 
 
41
# locale
 
42
from pida.core.locale import Locale
 
43
locale = Locale('help')
 
44
_ = locale.gettext
 
45
 
 
46
class PidaAboutDialog(gtk.AboutDialog):
 
47
 
 
48
    def __init__(self, boss):
 
49
        gtk.AboutDialog.__init__(self)
 
50
        self.set_transient_for(boss.get_window())
 
51
        self.set_name(PIDA_NAME)
 
52
        self.set_version(PIDA_VERSION)
 
53
        self.set_logo(self._create_logo())
 
54
        self.set_copyright(PIDA_COPYRIGHT)
 
55
        self.set_license(PIDA_LICENSE)
 
56
        self.set_wrap_license(True)
 
57
        self.set_authors(PIDA_AUTHORS)
 
58
        self.set_website(PIDA_WEBSITE)
 
59
        self.set_comments(PIDA_SHORT_DESCRIPTION)
 
60
 
 
61
    def _create_logo(self):
 
62
        pb = gdk.pixbuf_new_from_file_at_size(
 
63
            get_pixmap_path('pida-icon.svg'), 128, 128)
 
64
        return pb
 
65
 
 
66
class HelpActionsConfig(ActionsConfig):
 
67
 
 
68
    def create_actions(self):
 
69
        self.create_action(
 
70
            'help_about',
 
71
            TYPE_NORMAL,
 
72
            _('About'),
 
73
            _('About PIDA'),
 
74
            gtk.STOCK_HELP,
 
75
            self.show_about_dialog
 
76
        )
 
77
 
 
78
    def show_about_dialog(self, action):
 
79
        dialog = PidaAboutDialog(self.svc.boss)
 
80
        resp = dialog.run()
 
81
        dialog.destroy()
 
82
 
 
83
# Service class
 
84
class Help(Service):
 
85
    """Describe your Service Here""" 
 
86
 
 
87
    actions_config = HelpActionsConfig
 
88
 
 
89
# Required Service attribute for service loading
 
90
Service = Help
 
91
 
 
92
 
 
93
 
 
94
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: