The line "QtCore.QObject.connect(self.action_hello, QtCore.SIGNAL(
"activated()"),
self.hello_world)", didn't do anything on my machine. I did some 
modifications to the script and now it works here.

#
# add_menu_item.py <[email protected]>
#

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from mnemosyne.libmnemosyne.plugin import Plugin


class HelloWorldPlugin(Plugin):

    name = "Hello world"
    description = "Add a menu item to the help menu"

    def __init__(self, component_manager):
        Plugin.__init__(self, component_manager)
        self.action_hello = None

    def activate(self):
        Plugin.activate(self)

        self.action_hello = QAction("&Hello world!", self.main_widget(),
                triggered=self.hello_world)

        self.main_widget().menu_Help.addAction(self.action_hello)

    def deactivate(self):
        Plugin.deactivate(self)
        if self.action_hello:
            self.main_widget().menu_Help.removeAction(self.action_hello)
            self.actionHello = None

    def hello_world(self):
        self.main_widget().show_information("Hi there!")

# Register plugin.

from mnemosyne.libmnemosyne.plugin import register_user_plugin
register_user_plugin(HelloWorldPlugin)

-- 
You received this message because you are subscribed to the Google Groups 
"mnemosyne-proj-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/mnemosyne-proj-users/-/GerIvVm2of4J.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to