Subscription date : 28 October 2009
Messages : 415
|
Heya!
I am trying to make a right click-menu with:
def on_build_menu(self):
"""
Appends items to right-click menu.
"""
self.icon.AddMenuItems(
{"widget-type" : 0,
"label": "Add or change subscription",
"icon" : "gtk-add",
"menu" : 0,
"id" : 1,
"tooltip" : "Use this to add or change your Gmail account details."},
{"widget-type" : 0,
"label": "Restart timer",
"icon" : "gtk-add",
"menu" : 0,
"id" : 2,
"tooltip" : "In case of error the timer stops. Use this to restart timer again."}
)
def on_menu_select(self, iNumEntry):
"""
Launches methods according to menu selection.
"""
if iNumEntry == 1:
self.add_subscription('username')
elif iNumEntry == 2:
self.check_subscription()
else:
pass
But I get an error in return. I can't figure out why, I believe I followed the example from the Wiki.
ERROR:dbus.connection:Unable to set arguments ({'widget-type': 0, 'menu': 0, 'tooltip': 'Use this to add or change your Gmail account details.', 'label': 'Add or change subscription', 'id': 1, 'icon': 'gtk-add'}, {'widget-type': 0, 'menu': 0, 'tooltip': 'In case of error the timer stops. Use this to restart timer again.', 'label': 'Restart timer', 'id': 2, 'icon': 'gtk-add'}) according to signature u'aa{sv}': <type 'exceptions.TypeError'>: string indices must be integers, not str
ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/dbus/connection.py", line 214, in maybe_handle_message
self._handler(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/CDApplet.py", line 107, in _on_build_menu
self.on_build_menu()
File "./Gmail", line 407, in on_build_menu
"tooltip" : "In case of error the timer stops. Use this to restart timer again."}
File "/usr/lib/pymodules/python2.7/dbus/proxies.py", line 140, in __call__
**keywords)
File "/usr/lib/pymodules/python2.7/dbus/connection.py", line 620, in call_blocking
message.append(signature=signature, *args)
TypeError: string indices must be integers, not str
Any idea?
Thanks.
B  |