Hi everyone, I want to write a popup plasma as system-monitor in python, but it seems that I can't do it easily, at first I use like this:
class TimeRemain(plasmascript.Plasma.PopupApplet): def __init__(self,parent,args=[]): plasmascript.Plasma.PopupApplet.__init__(self,parent,args) self.setPopupIcon("myiocn") self.init() def init(self): '''init popup widget''' self.widget = QGraphicsWidget(self) self.layout = QGraphicsLinearLayout(Qt.Horizontal, self.widget) label = Plasma.Label(self.widget) label.setText("Hello world!") self.layout.addItem(label) self.widget.setLayout(self.layout) self.resize(125,125) def graphicsWidget(self): print "graphicsWidget" return self.widget class MyApplet(plasmascript.Applet): def __init__(self,parent): plasmascript.Applet.__init__(self,parent) self.timeWidget = TimeRemain(parent) def setApplet(self,applet): plasmascript.Applet.setApplet(self,self.timeWidget) def CreateApplet(parent): return MyApplet(parent) It show nothing. Just blank. Then I look Petri Damstén's example /pyhello /in kdeexamples , the relavent code section as follow: class Hello(Applet): def __init__(self, parent, args = None): Applet.__init__(self, parent) self.frame = None def init(self): print '~~~ init' self.setPopupIcon('text-x-python') if not self.extender().hasItem('pyhello'): self.extenderItem = Plasma.ExtenderItem(self.extender()) self.initExtenderItem(self.extenderItem) ... def initExtenderItem(self, item): self.layout = QGraphicsLinearLayout(Qt.Vertical) self.frame = Plasma.Frame(item) f = self.frame.font() f.setPointSizeF(36.0) self.frame.setFont(f) self.layout.addItem(self.frame) self.edit = Plasma.LineEdit(item) self.edit.setText('10') self.layout.addItem(self.edit) .... but just give me an error : "Applet has no attribute setPopupIcon" so I want to konw how can I implement a Popup Plasma, and how to use the PopupApplet class , thank you.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<