Hi, all<br><br>I'm using PyKDE4 to write a little plasmoid but it complains:<br><br>QFSFileEngine::open: No file name specified<br clear="all"><br>constantly. I think the problem lay in the Plasma.PushButton. Here is my code:<br>
=============================<br># Written by Grissiom <a href="mailto:chaos.proton@gmail.com">chaos.proton@gmail.com</a> <br><br>from PyQt4.QtCore import SIGNAL, Qt, QString<br>from PyQt4.QtGui import QGraphicsLinearLayout<br>
<br>from PyKDE4.plasma import Plasma<br>from PyKDE4 import plasmascript<br><br>import dbus<br><br>class TurnOffScreen(plasmascript.Applet):<br> def __init__(self, parent, args = None):<br> plasmascript.Applet.__init__(self, parent)<br>
<br> def init(self):<br> self.setHasConfigurationInterface(False)<br> self.setAspectRatioMode(Plasma.ConstrainedSquare)<br><br> self.sessionBus = dbus.SessionBus()<br> self.powerdevil = self.sessionBus.get_object('org.freedesktop.PowerManagement',<br>
'/modules/powerdevil')<br> self.btn = Plasma.PushButton(self.applet)<br> self.btn.setImage(QString('./blank-screen.png'))<br>
#self.btn.setText('Turn off Screen')<br> self.connect(self.btn, SIGNAL('clicked()'), self.turn_off_screen)<br><br> self.layout = QGraphicsLinearLayout(Qt.Horizontal, self.applet)<br>
self.layout.addItem(self.btn)<br> self.setLayout(self.layout)<br> self.resize(125, 125)<br><br> def turn_off_screen(self):<br> self.powerdevil.turnOffScreen(dbus_interface='org.kde.PowerDevil')<br>
<br>def CreateApplet(p):<br> return TurnOffScreen(p)<br>=============================<br>blank-screen.png is in the same folder of this script(main.py). self.btn.setText works.<br><br>Is there any way to fix this problem? Thanks in advance.<br>
<br>-- <br>Cheers,<br>Grissiom<br>