Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Improved the help service - adding logging and i18n support in a coup…

…le places.
  • Loading branch information...
commit 3e74b545b158a44aac3fe98752a6f6ce71de5631 1 parent eebef3b
Adam Boduch adamboduch authored

Showing 1 changed file with 11 additions and 12 deletions. Show diff stats Hide diff stats

  1. +11 12 gaphor/services/helpservice.py
23 gaphor/services/helpservice.py
... ... @@ -1,12 +1,11 @@
1   -"""
2   -About and help services. (help browser anyone?)
3   -"""
4   -
  1 +"""About and help services. (help browser anyone?)"""
5 2
  3 +from logging import getLogger
6 4 import os
7 5 import pkg_resources
8 6 import gtk
9 7 from zope import interface
  8 +
10 9 from gaphor.application import Application
11 10 from gaphor.interfaces import IService, IActionProvider
12 11 from gaphor.core import _, inject, action, build_action_group
@@ -28,22 +27,24 @@ class HelpService(object):
28 27 """
29 28
30 29 main_window = inject('main_window')
  30 + logger = getLogger('HelpService')
31 31
32 32 def __init__(self):
33 33 pass
34 34
35 35 def init(self, app):
  36 + self.logger.info('Starting')
36 37 self.action_group = build_action_group(self)
37 38
38 39 def shutdown(self):
39   - pass
  40 + self.logger.info('Shutting down')
40 41
41 42 @action(name='help-about', stock_id='gtk-about')
42 43 def about(self):
43 44 logo_file = os.path.join(pkg_resources.get_distribution('gaphor').location, 'gaphor', 'ui', 'pixmaps', 'logo.png')
44 45 logo = gtk.gdk.pixbuf_new_from_file(logo_file)
45 46 version = Application.distribution.version
46   - about = gtk.Dialog("About Gaphor", self.main_window.window, gtk.DIALOG_MODAL, (gtk.STOCK_OK, gtk.RESPONSE_OK))
  47 + about = gtk.Dialog(_('About Gaphor'), self.main_window.window, gtk.DIALOG_MODAL, (gtk.STOCK_OK, gtk.RESPONSE_OK))
47 48 about.set_default_response(gtk.RESPONSE_OK)
48 49 vbox = about.vbox
49 50
@@ -53,7 +54,6 @@ def about(self):
53 54
54 55 notebook = gtk.Notebook()
55 56 notebook.set_scrollable(True)
56   - #notebook.set_show_border(False)
57 57 notebook.set_border_width(4)
58 58 notebook.set_tab_pos(gtk.POS_BOTTOM)
59 59 vbox.pack_start(notebook)
@@ -67,12 +67,11 @@ def add_label(text, padding_x=0, padding_y=0):
67 67 label.set_justify(gtk.JUSTIFY_CENTER)
68 68 tab_vbox.pack_start(label)
69 69
70   - #add_label('<span size="xx-large" weight="bold">Gaphor</span>')
71 70 add_label('<span weight="bold">version %s</span>' % version)
72 71 add_label('<span variant="smallcaps">UML Modeling tool for GNOME</span>', 8, 8)
73 72 add_label('<span size="small">Copyright (c) 2001-2007 Arjan J. Molenaar</span>', 8, 8)
74   - #vbox.pack_start(gtk.HSeparator())
75   - notebook.append_page(tab_vbox, gtk.Label('About'))
  73 +
  74 + notebook.append_page(tab_vbox, gtk.Label(_('About')))
76 75
77 76 tab_vbox = gtk.VBox()
78 77
@@ -80,7 +79,7 @@ def add_label(text, padding_x=0, padding_y=0):
80 79 'under the terms of the\n'
81 80 '<span weight="bold">GNU General Public License v2</span>.\n'
82 81 'See the COPYING file for details.', 0, 8)
83   - notebook.append_page(tab_vbox, gtk.Label('License'))
  82 + notebook.append_page(tab_vbox, gtk.Label(_('License')))
84 83
85 84 tab_vbox = gtk.VBox()
86 85
@@ -89,7 +88,7 @@ def add_label(text, padding_x=0, padding_y=0):
89 88 'Artur Wroblewski\n'
90 89 'Jeroen Vloothuis')
91 90 add_label('')
92   - notebook.append_page(tab_vbox, gtk.Label('Authors'))
  91 + notebook.append_page(tab_vbox, gtk.Label(_('Authors')))
93 92
94 93 vbox.show_all()
95 94 about.run()

0 comments on commit 3e74b54

Please sign in to comment.
Something went wrong with that request. Please try again.