1
# Copyright (C) 2003 by Intevation GmbH
3
# Jan-Oliver Wagner <jan@intevation.de>
5
# This program is free software under the GPL (>=v2)
6
# Read the file COPYING coming with Thuban for details.
9
Extend Thuban with a sample Hello World to demonstrate simple
13
__version__ = '$Revision: 1.1 $'
15
# use _() already now for all strings that may later be translated
18
# Thuban has named commands which can be registered in the central
20
from Thuban.UI.command import registry, Command
22
# The instance of the main menu of the Thuban application
23
# See Thuban/UI/menu.py for the API of the Menu class
24
from Thuban.UI.mainwindow import main_menu
26
def hello_world_dialog(context):
27
"""Just raise a simple dialog to greet the world.
29
context -- The Thuban context.
31
context.mainwindow.RunMessageBox(_('Hello World'), _('Hello World!'))
34
# create a new command and register it
35
registry.Add(Command('hello_world', _('Hello World'), hello_world_dialog,
36
helptext = _('Welcome everyone on this planet')))
38
# find the extensions menu (create it anew if not found)
39
extensions_menu = main_menu.find_menu('extensions')
40
if extensions_menu is None:
41
extensions_menu = main_menu.InsertMenu('extensions', _('E&xtensions'))
43
# finally bind the new command with an entry in the extensions menu
44
extensions_menu.InsertItem('hello_world')