So I have been trying to port a C GNOME applet to MATE, and after running into many different problems, I decided to rewrite it from scratch in python. Eventually, I found some not-horribly-out-of-date documentation, which is here: http://wiki.mate-desktop.org/docs:devel:mate-panel
Apparently the new way of writing applets in python is to use PyGObject introspection, instead of the 'old' PyGtk.
So I have a few questions:
1. Why is it better to use PyGObject instead of PyGtk etc
2. Is the end user who downloads a python applet expected to have pygobject installed? It looks like it.
3. The MATE documentation says 'ensure we are using Gtk 2, not Gtk3', but http://python-gtk-3-tutorial.readthedocs.org/en/latest/install.html says that its exclusively supports Gtk+ 3 and higher.
EDIT: If I run
import gi
gi.require_version("Gtk", "2.0")
in a python session, I get the warning:
RuntimeWarning: You have imported the Gtk 2.0 module. Because Gtk 2.0 was not designed for use with introspection some of the interfaces and API will fail. As such this is not supported by the pygobject development team and we encourage you to port your app to Gtk 3 or greater. PyGTK is the recomended python module to use with Gtk 2.0
Which pretty much answers Question 3, but then brings up Question 1 again. Also, running from gi.repository import MatePanelApplet
gives an ImportError Could not find any typelib for MatePanelApplet
even though I have libmatepanelapplet-dev installed.
EDIT AGAIN: I found a solution to the ImportError here: Can't import Webkit from gi.repository. (Just install gir1.2-mate-panel
instead of webkit)
And more errors:
./xmonad-log-applet.py:66: Warning: g_closure_set_marshal: assertion `closure != NULL' failed
applet = MatePanelApplet.Applet()
(xmonad-log-applet.py:10928): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion `G_IS_DBUS_CONNECTION (connection)' failed
Segmentation fault (core dumped)