[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    [Panel-devel] Scripted DataEngines
From:       Petri =?iso-8859-1?q?Damst=E9n?= <petri.damsten () dnainternet ! net>
Date:       2007-11-29 9:55:21
Message-ID: 200711291155.21275.petri.damsten () dnainternet ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hi,

I know that this was discussed earlier and Aaron don't like it. I know I'm 
hardheaded and do things my own way but please at least consider this...

This patch adds support for making script dataEngines. I tried to change 
plasma as little as possible and it's plugin based so default plasma does not 
have to include support for script dataengines. Naming might not be 
consistent yet.

I also have kross dataEngine pretty much working that can run following:

#!/usr/bin/env kross
# -*- coding: utf-8 -*-

import PlasmaDataEngine

def init():
    print 'init'
    print 'Default MinimumUpdateInterval: %d' % \
            PlasmaDataEngine.minimumUpdateInterval()
    PlasmaDataEngine.setMinimumUpdateInterval(500)

def sources():
    print 'sources'
    return ['messages']

def updateSource(name):
    print 'updateSource: ' + name

def sourceRequested(name):
    print 'sourceRequested: ' + name
    PlasmaDataEngine.setData(name, "message1", "Hello")
    PlasmaDataEngine.setData(name, "message2", "World")

print 'Loaded Hello python dataEngine'

Petri

-- 
Hate the sin, love the sinner. 
Mahatma Gandhi

["ScriptDataEngine.diff" (text/x-diff)]

Index: workspace/libs/plasma/servicetypes/plasma-dataengine.desktop
===================================================================
--- workspace/libs/plasma/servicetypes/plasma-dataengine.desktop	(revision 742918)
+++ workspace/libs/plasma/servicetypes/plasma-dataengine.desktop	(working copy)
@@ -39,3 +39,5 @@
 [PropertyDef::X-EngineName]
 Type=QString
 
+[PropertyDef::X-ScriptEngineName]
+Type=QString
Index: workspace/libs/plasma/CMakeLists.txt
===================================================================
--- workspace/libs/plasma/CMakeLists.txt	(revision 742918)
+++ workspace/libs/plasma/CMakeLists.txt	(working copy)
@@ -193,6 +193,7 @@
     servicetypes/plasma-animator.desktop
     servicetypes/plasma-applet.desktop
     servicetypes/plasma-dataengine.desktop
+    servicetypes/plasma-scriptdataengine.desktop
     servicetypes/plasma-runner.desktop
     servicetypes/plasma-scriptengine.desktop
     DESTINATION ${SERVICETYPES_INSTALL_DIR})
Index: workspace/libs/plasma/dataenginemanager.cpp
===================================================================
--- workspace/libs/plasma/dataenginemanager.cpp	(revision 742918)
+++ workspace/libs/plasma/dataenginemanager.cpp	(working copy)
@@ -119,11 +119,22 @@
     KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine",
                                                               constraint);
     QString error;
+    QVariantList args;
 
+    if (!offers.isEmpty()) {
+        QString scriptEngine = offers.first()->property("X-ScriptEngineName").toString();
+
+        if (!scriptEngine.isEmpty()) {
+            args << name;
+            constraint = QString("[X-EngineName] == '%1'").arg(scriptEngine);
+            offers = KServiceTypeTrader::self()->query("Plasma/ScriptDataEngine", constraint);
+        }
+    }
+
     if (offers.isEmpty()) {
         kDebug() << "offers are empty for " << name << " with constraint " << constraint;
     } else {
-        engine = offers.first()->createInstance<Plasma::DataEngine>(0, QVariantList(), &error);
+        engine = offers.first()->createInstance<Plasma::DataEngine>(0, args, &error);
     }
 
     if (!engine) {
Index: workspace/plasma/runners/CMakeLists.txt
===================================================================
--- workspace/plasma/runners/CMakeLists.txt	(revision 742918)
+++ workspace/plasma/runners/CMakeLists.txt	(working copy)
@@ -1,4 +1,4 @@
 add_subdirectory(calculator)
 add_subdirectory(search)
 add_subdirectory(webshortcuts)
-add_subdirectory(bookmarks)
\ No newline at end of file
+add_subdirectory(bookmarks)

["signature.asc" (application/pgp-signature)]

_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic