From kde-panel-devel Sat Feb 20 15:56:58 2010 From: Richard Dale Date: Sat, 20 Feb 2010 15:56:58 +0000 To: kde-panel-devel Subject: Re: Python PopupApplet and ScriptEngines Message-Id: <491684421002200756x3361a461i38321291e5b572ae () mail ! gmail ! com> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=126668147004065 On Sat, Feb 20, 2010 at 11:18 AM, Luca Beltrame wrote: > Hello, > > AFAIK, there is no PopupApplet for Python scriptengines yet, and I'd like to > hack in this functionality. > Currently the applets in Python use "plasmascript" to work, so I assume this > would be the place to add support in. So, here come the questions: > > 1. Is there documentation on how a "proper" PopupApplet should be? You need to study the popopapplet.h header file and look at examples. > 2. To those familiar with the design of the Python binding, is creating a > "plasmascript.PopupApplet" the way to go? Yes, at minimum the class needs to have setter and getter methods for widget and graphicsWidget. See these methods in popupapplet.h: /** * Implement either this function or graphicsWidget(). * @return the widget that will get shown in either a layout, in the applet or in a Dialog, * depending on the form factor of the applet. */ virtual QWidget *widget(); void setWidget(QWidget * widget); /** * Implement either this function or widget(). * @return the widget that will get shown in either a layout, in the applet or in a Dialog, * depending on the form factor of the applet. */ virtual QGraphicsWidget *graphicsWidget(); void setGraphicsWidget(QGraphicsWidget * widget); Also add methods to the plasmascript PopupApplet class to forward method calls to the underlying wrapped C++ instance of the Plasma::PopupApplet. Popup applets make use of extender items, and you need to make sure that the python applet code connects to the extenderItemRestored(Plasma::ExtenderItem*) signal in Plasma::Applet, and invokes a slot called something like initExtenderItem(Plasma::ExtenderItem*) in the plasmascripting Applet class. Note that this isn't PopupApplet specific, but I believe extender items are used quite frequently in conjunction with popup applets. > 3. Is there any documentation on how "plasmascript" was conceived and > designed? Blogs, reading headers and looking at examples will tell you most things. _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel