Plasma.PushButton complains "QFSFileEngine::open: No file name specified" in PyKDE4

Grissiom chaos.proton at gmail.com
Thu Apr 16 16:18:33 CEST 2009


Hi, all

I'm using PyKDE4 to write a little plasmoid but it complains:

QFSFileEngine::open: No file name specified

constantly. I think the problem lay in the Plasma.PushButton. Here is my
code:
=============================
# Written by Grissiom chaos.proton at gmail.com

from PyQt4.QtCore import SIGNAL, Qt, QString
from PyQt4.QtGui import QGraphicsLinearLayout

from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript

import dbus

class TurnOffScreen(plasmascript.Applet):
        def __init__(self, parent, args = None):
                plasmascript.Applet.__init__(self, parent)

        def init(self):
                self.setHasConfigurationInterface(False)
                self.setAspectRatioMode(Plasma.ConstrainedSquare)

                self.sessionBus = dbus.SessionBus()
                self.powerdevil =
self.sessionBus.get_object('org.freedesktop.PowerManagement',

'/modules/powerdevil')
                self.btn = Plasma.PushButton(self.applet)
                self.btn.setImage(QString('./blank-screen.png'))
                #self.btn.setText('Turn off Screen')
                self.connect(self.btn, SIGNAL('clicked()'),
self.turn_off_screen)

                self.layout = QGraphicsLinearLayout(Qt.Horizontal,
self.applet)
                self.layout.addItem(self.btn)
                self.setLayout(self.layout)
                self.resize(125, 125)

        def turn_off_screen(self):

self.powerdevil.turnOffScreen(dbus_interface='org.kde.PowerDevil')

def CreateApplet(p):
        return TurnOffScreen(p)
=============================
blank-screen.png is in the same folder of this script(main.py).
self.btn.setText works.

Is there any way to fix this problem? Thanks in advance.

-- 
Cheers,
Grissiom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20090416/69e19744/attachment.htm 


More information about the Plasma-devel mailing list