Strange, the existing script works for me. Perhaps an issue with Qt versions?

Cheers,

Peter

On 11/02/2012 10:02 PM, Gnome wrote:
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.



--
Peter Bienstman
Ghent University, Dept. of Information Technology
Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium
tel: +32 9 264 34 46, fax: +32 9 264 35 93
WWW: http://photonics.intec.UGent.be
email: [email protected]

--
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to