Итак, я пытался перенести апплет C GNOME на MATE, и, столкнувшись с множеством различных проблем, решил переписать его с нуля на python. В конце концов, я нашел не очень устаревшую документацию, которая находится здесь: http://wiki.mate-desktop.org/docs:devel:mate-panel
По-видимому, новый способ написания апплетов на python - использовать самоанализ PyGObject вместо «старого» PyGtk.
Итак, у меня есть несколько вопросов:
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.
РЕДАКТИРОВАТЬ: если я бегу
import gi
gi.require_version("Gtk", "2.0")
в сеансе Python я получаю предупреждение:
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
Что в значительной степени отвечает на вопрос 3, но затем снова поднимает вопрос 1. Кроме того, запуск from gi.repository import MatePanelApplet
вызывает ошибку ImportError Could not find any typelib for MatePanelApplet
, хотя у меня установлена libmatepanelapplet-dev.
ИЗМЕНИТЬ СНОВА: Я нашел решение для ImportError здесь: Невозможно импортировать Webkit из gi. репозиторий. (Просто установите gir1.2-mate-panel
вместо webkit)
И еще ошибки:
./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)