Move python and ruby dataengine bindings from kde-workspace
This commit is contained in:
parent
2f4867bf0c
commit
3abddd8d99
@ -1,2 +1,7 @@
|
||||
add_subdirectory(qml)
|
||||
#add_subdirectory(javascript)
|
||||
|
||||
add_subdirectory(ruby)
|
||||
|
||||
if (PYTHONLIBRARY_FOUND AND NOT WIN32)
|
||||
add_subdirectory(python)
|
||||
endif ()
|
||||
|
23
src/scriptengines/python/CMakeLists.txt
Normal file
23
src/scriptengines/python/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
project(plasma-python)
|
||||
|
||||
include(PythonMacros)
|
||||
|
||||
# install the library, .desktop, and plasma.py
|
||||
python_install(plasma_importer.py ${DATA_INSTALL_DIR}/plasma_scriptengine_python)
|
||||
python_install(pydataengine.py ${DATA_INSTALL_DIR}/plasma_scriptengine_python)
|
||||
python_install(pyrunner.py ${DATA_INSTALL_DIR}/plasma_scriptengine_python)
|
||||
|
||||
# remove the following three lines once we branch 4.5, they are only necessary as long
|
||||
# as people update kdebase but not yet kdelibs (PYTHON_SITE_PACKAGES_INSTALL_DIR has just
|
||||
# recently been added to FindPYthonLib.cmake and should be used as install destination). Alex
|
||||
if(NOT PYTHON_SITE_PACKAGES_INSTALL_DIR)
|
||||
set(PYTHON_SITE_PACKAGES_INSTALL_DIR ${PYTHON_SITE_PACKAGES_DIR} )
|
||||
endif()
|
||||
|
||||
python_install(plasmascript.py ${PYTHON_SITE_PACKAGES_INSTALL_DIR}/PyKDE4)
|
||||
|
||||
install(FILES plasma-scriptengine-dataengine-python.desktop
|
||||
DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install(FILES plasma-scriptengine-runner-python.desktop
|
||||
DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
|
@ -0,0 +1,153 @@
|
||||
[Desktop Entry]
|
||||
Name=Python data engine
|
||||
Name[ar]=محرك بيانات بايثون
|
||||
Name[ast]=Motor de datos de Python
|
||||
Name[be@latin]=Systema źviestak u movie „Python”
|
||||
Name[bg]=Ядро за данни с Python
|
||||
Name[bn_IN]=Python ডাটা ইঞ্জিন
|
||||
Name[bs]=Python pogon podataka
|
||||
Name[ca]=Motor de dades en Python
|
||||
Name[ca@valencia]=Motor de dades en Python
|
||||
Name[cs]=Rozhraní v Pythonu
|
||||
Name[csb]=Czérownik Phythona
|
||||
Name[da]=Datamotor til Python
|
||||
Name[de]=Python-Datentreiber
|
||||
Name[el]=Μηχανή δεδομένων Python
|
||||
Name[en_GB]=Python data engine
|
||||
Name[eo]=Pitona datuma motoro
|
||||
Name[es]=Motor de datos de Python
|
||||
Name[et]=Pythoni andmete mootor
|
||||
Name[eu]=Python-en datu-motorra
|
||||
Name[fi]=Python-tietomoottori
|
||||
Name[fr]=Moteur de données Python
|
||||
Name[fy]=Python gegevens motor
|
||||
Name[ga]=Inneall sonraí Python
|
||||
Name[gl]=Motor de datos de Python
|
||||
Name[gu]=પાયથોન માહિતી એન્જિન
|
||||
Name[he]=מנוע תוכן של Python
|
||||
Name[hi]=पायथन डाटा इंजिन
|
||||
Name[hne]=पायथन डाटा इंजिन
|
||||
Name[hr]=Pythonov podatkovni mehanizam
|
||||
Name[hu]=Adatkezelő modul Python nyelven
|
||||
Name[ia]=Motor de datos de Python
|
||||
Name[id]=Mesin data Python
|
||||
Name[is]=Python gagnavél
|
||||
Name[it]=Motore di dati di Python
|
||||
Name[ja]=Python データエンジン
|
||||
Name[kk]=Python деректер тетігі
|
||||
Name[km]=ម៉ាស៊ីនទិន្នន័យ Python
|
||||
Name[kn]=ಪೈಥಾನ್ ದತ್ತಾಂಶ ಎಂಜಿನ್
|
||||
Name[ko]=파이썬 데이터 엔진
|
||||
Name[lt]=Python duomenų variklis
|
||||
Name[lv]=Python datu dzinējs
|
||||
Name[ml]=പൈത്തണ് ഡേറ്റാ എഞ്ചിന്
|
||||
Name[mr]=Python माहिती इन्जीन
|
||||
Name[nb]=Python datamotor
|
||||
Name[nds]=Python-Datenkarn
|
||||
Name[nl]=Python (gegevensengine)
|
||||
Name[nn]=Python-datamotor
|
||||
Name[or]=ପାଇଥନ ତଥ୍ୟ ମେସିନ
|
||||
Name[pa]=ਪਾਈਥਨ ਡਾਟਾ ਇੰਜਣ
|
||||
Name[pl]=Silnik danych w Pythonie
|
||||
Name[pt]=Motor de dados Python
|
||||
Name[pt_BR]=Mecanismo de dados Python
|
||||
Name[ro]=Motor de date Python
|
||||
Name[ru]=Источник данных на языке Python
|
||||
Name[si]=Python data engine
|
||||
Name[sk]=Python dátový nástroj
|
||||
Name[sl]=Podatkovni vir v Pythonu
|
||||
Name[sr]=питонски датомотор
|
||||
Name[sr@ijekavian]=питонски датомотор
|
||||
Name[sr@ijekavianlatin]=Python datomotor
|
||||
Name[sr@latin]=Python datomotor
|
||||
Name[sv]=Python datagränssnitt
|
||||
Name[ta]=Python data engine
|
||||
Name[tg]=Системаи санаи Python
|
||||
Name[th]=กลไกข้อมูลภาษาไพธอน
|
||||
Name[tr]=Python veri motoru
|
||||
Name[ug]=Python سانلىق-مەلۇمات ماتورى
|
||||
Name[uk]=Рушій даних Python
|
||||
Name[wa]=Moteur di dnêyes Python
|
||||
Name[x-test]=xxPython data enginexx
|
||||
Name[zh_CN]=Python 数据引擎
|
||||
Name[zh_TW]=Python 資料引擎
|
||||
Comment=Plasma data engine support for Python
|
||||
Comment[ar]=دعم محرك بيانات بلازما للبايثون
|
||||
Comment[ast]=Sofitu del motor de datos de plasma pa Python
|
||||
Comment[be@latin]=Absłuhoŭvańnie systemy źviestak „Plasma” u movie „Python”
|
||||
Comment[bg]=Поддръжка за създаване на ядра за данни на Plasma с Python
|
||||
Comment[bs]=Podrška plazma pogona podataka za Python
|
||||
Comment[ca]=Implementació de motor de dades del Plasma per al Python
|
||||
Comment[ca@valencia]=Implementació de motor de dades del Plasma per al Python
|
||||
Comment[cs]=Podpora datového rozhraní Plasmy v Pythonu
|
||||
Comment[da]=Plasma datamotor-understøttelse af Python
|
||||
Comment[de]=Unterstützung für Plasma-Datentreiber in Python
|
||||
Comment[el]=Υποστήριξη μηχανής δεδομένων Plasma για την Python
|
||||
Comment[en_GB]=Plasma data engine support for Python
|
||||
Comment[eo]=Plasma datummotora apogo por Pitono
|
||||
Comment[es]=Soporte del motor de datos de plasma para Python
|
||||
Comment[et]=Plasma andmemootori toetus Pythonile
|
||||
Comment[eu]=Python-erako Plasmaren datu-motorraren euskarria
|
||||
Comment[fi]=Plasma-tietomoottorituki Python-kielelle
|
||||
Comment[fr]=Prise en charge du moteur de données Python pour Plasma
|
||||
Comment[fy]=Plasma-gegevensmotor-stipe foar Python
|
||||
Comment[ga]=Tacaíocht innill sonraí Plasma le haghaidh Python
|
||||
Comment[gl]=Motor de datos de Plasma para dar soporte a Python
|
||||
Comment[gu]=પાયથોન માટે પ્લાઝમા માહિતી એન્જિન આધાર
|
||||
Comment[he]=תמיכה במנועי תוכן של Plasma עבור Python
|
||||
Comment[hi]=पायथन के लिए प्लाज्मा डाटा इंजिन समर्थन
|
||||
Comment[hne]=पायथन बर प्लाज्मा डाटा इंजिन सपोर्ट
|
||||
Comment[hr]=Plasmin podatkovni mehanizam koji podržava Python
|
||||
Comment[hu]=Plazma adatkezelő modul Pythonhoz
|
||||
Comment[ia]=Supporto de motor de datos de Plasma pro Python
|
||||
Comment[id]=Mesin data Plasma didukung oleh Python
|
||||
Comment[is]=Plasma gagnavélarstuðningur fyrir Python
|
||||
Comment[it]=Supporto al motore di dati di Plasma per Python
|
||||
Comment[ja]=Python のための Plasma データエンジンのサポート
|
||||
Comment[kk]=Python деректер тетігінің Plasma қолдауы
|
||||
Comment[km]=ការគាំទ្រម៉ាស៊ីនទិន្នន័យប្លាស្មាសម្រាប់ Python
|
||||
Comment[kn]=ಪೈಥಾನ್ಗಾಗಿ ಪ್ಲಾಸ್ಮಾ ದತ್ತ ಸಾಧನದ ಬೆಂಬಲ
|
||||
Comment[ko]=파이썬을 위한 Plasma 데이터 엔진 지원
|
||||
Comment[lt]=Plasma duomenų variklio palaikymas Python kalbai
|
||||
Comment[lv]=Plasma datu dzinēju atbalsts Python
|
||||
Comment[ml]=പൈത്തിണിനുള്ള പ്ലാസ്മ ഡാറ്റാഎഞ്ചിന് പിന്തുണ
|
||||
Comment[mr]=Python करिता Plasma माहिती इन्जीन समर्थन
|
||||
Comment[nb]=Plasma datamotor-støtte for Python
|
||||
Comment[nds]=Plasma-Datenkarnünnerstütten för Python
|
||||
Comment[nl]=Plasma-gegevensengine-ondersteuning voor Python
|
||||
Comment[nn]=Plasma-datamotorstøtte for Python
|
||||
Comment[or]=ପାଇଥନ ପାଇଁ ପ୍ଲାଜମା ତଥ୍ୟ ମେସିନ ସମର୍ଥନ
|
||||
Comment[pa]=ਪਾਈਥਨ ਲਈ ਪਲਾਜ਼ਮਾ ਡਾਟਾ ਇੰਜਣ ਸਹਿਯੋਗ
|
||||
Comment[pl]=Obsługa silnika danych Plazmy w Pythonie
|
||||
Comment[pt]=Suporte para os motores de dados do Plasma em Python
|
||||
Comment[pt_BR]=Suporte aos mecanismos de dados em Python
|
||||
Comment[ro]=Suport motor de date Plasma pentru Python
|
||||
Comment[ru]=Поддержка источников данных для Python
|
||||
Comment[si]=Plasma data engine support for Python
|
||||
Comment[sk]=Podpora dátového nástroja plasmy pre Python
|
||||
Comment[sl]=Podpora za podatkovne vire napisane v Pythonu
|
||||
Comment[sr]=Подршка плазма датомотора за питон
|
||||
Comment[sr@ijekavian]=Подршка плазма датомотора за питон
|
||||
Comment[sr@ijekavianlatin]=Podrška plasma datomotora za Python
|
||||
Comment[sr@latin]=Podrška plasma datomotora za Python
|
||||
Comment[sv]=Plasma datagränssnittstöd för Python
|
||||
Comment[ta]=Plasma data engine support for Python
|
||||
Comment[te]=ఫైథాన్ మద్దతుకొరకు ప్లాస్మా డాటా యింజన్
|
||||
Comment[tg]=Пуштибонии Python дар асоси маълумоти Plasma
|
||||
Comment[th]=กลไกข้อมูลของพลาสมาที่เป็นภาษาไพธอน
|
||||
Comment[tr]=Python için Plasma veri motoru desteği
|
||||
Comment[ug]=Python نىڭ Plasma سانلىق-مەلۇمات ماتورىنى قوللىشى
|
||||
Comment[uk]=Підтримка у рушіях даних для Python
|
||||
Comment[wa]=Sopoirt po Python do moteur di dnêyes di Plasma
|
||||
Comment[x-test]=xxPlasma data engine support for Pythonxx
|
||||
Comment[zh_CN]=Python 的 Plasma 数据引擎支持
|
||||
Comment[zh_TW]=支援 Python 的 Plasma 資料引擎
|
||||
|
||||
X-KDE-ServiceTypes=Plasma/ScriptEngine
|
||||
Type=Service
|
||||
Icon=text-x-script
|
||||
X-KDE-Library=kpythonpluginfactory
|
||||
X-KDE-PluginKeyword=plasma_scriptengine_python/pydataengine.py
|
||||
X-EngineName=pythondataengine
|
||||
X-Plasma-API=python
|
||||
X-Plasma-ComponentTypes=DataEngine
|
@ -0,0 +1,135 @@
|
||||
[Desktop Entry]
|
||||
Name=Python Runner
|
||||
Name[ar]=مشغل بايثون
|
||||
Name[ast]=Llanzador Python
|
||||
Name[bg]=Стартер с Python
|
||||
Name[bs]=Python izvođač
|
||||
Name[ca]=Executor en Python
|
||||
Name[ca@valencia]=Executor en Python
|
||||
Name[cs]=Python spouštěč
|
||||
Name[da]=Python Runner
|
||||
Name[de]=Python-Starter
|
||||
Name[el]=Εκτελεστής Python
|
||||
Name[en_GB]=Python Runner
|
||||
Name[eo]=Pitona motoro
|
||||
Name[es]=Lanzador Python
|
||||
Name[et]=Pythoni käivitaja
|
||||
Name[eu]=Python abiarazlea
|
||||
Name[fi]=Python-suoritusohjelma
|
||||
Name[fr]=Lanceur Python
|
||||
Name[ga]=Feidhmitheoir Python
|
||||
Name[gl]=Executor en Python
|
||||
Name[gu]=Python રનર
|
||||
Name[he]=Python Runner
|
||||
Name[hi]=पायथन रनर
|
||||
Name[hr]=Python Runner
|
||||
Name[hu]=Python-indító
|
||||
Name[ia]=Executor de Python
|
||||
Name[id]=Pelari Python
|
||||
Name[is]=Python keyrari
|
||||
Name[it]=Esecutore per Python
|
||||
Name[ja]=Python ラナー
|
||||
Name[kk]=Python-ды жегу
|
||||
Name[km]=កម្មវិធីរត់ Python
|
||||
Name[kn]=ಪೈಥಾನ್ ರನ್ನರ್
|
||||
Name[ko]=파이썬 실행기
|
||||
Name[lt]=Python leistukas
|
||||
Name[lv]=Python darbinātājs
|
||||
Name[mr]=पायथोन रनर
|
||||
Name[nb]=Python-kjører
|
||||
Name[nds]=Python-Dreger
|
||||
Name[nl]=Python-starter
|
||||
Name[nn]=Python-køyrar
|
||||
Name[pa]=ਪਾਈਥਨ ਰਨਰ
|
||||
Name[pl]=Uruchamianie w Pythonie
|
||||
Name[pt]=Módulo de Execução em Python
|
||||
Name[pt_BR]=Execução em Python
|
||||
Name[ro]=Executor Python
|
||||
Name[ru]=Модули запуска команд на языке Python
|
||||
Name[si]=Python ධාවකය
|
||||
Name[sk]=Python spúšťač
|
||||
Name[sl]=Zaganjalnik v Pythonu
|
||||
Name[sr]=питонски извођач
|
||||
Name[sr@ijekavian]=питонски извођач
|
||||
Name[sr@ijekavianlatin]=Python izvođač
|
||||
Name[sr@latin]=Python izvođač
|
||||
Name[sv]=Python körningsprogram
|
||||
Name[tg]=Системаи санаи Python
|
||||
Name[th]=ตัวเรียกใช้โปรแกรมภาษาไพธอน
|
||||
Name[tr]=Python Çalıştırıcı
|
||||
Name[ug]=Python ئىجراچىسى
|
||||
Name[uk]=Запуск для Python
|
||||
Name[wa]=Enondeu Python
|
||||
Name[x-test]=xxPython Runnerxx
|
||||
Name[zh_CN]=Python 运行器
|
||||
Name[zh_TW]=Python 執行器
|
||||
Comment=Plasma Runner support for Python
|
||||
Comment[ar]=دعم مشغل بلازما لبايثون
|
||||
Comment[ast]=Implementación de llanzador Plasma pa Python
|
||||
Comment[bg]=Поддръжка за създаване на стартери на Plasma с Python
|
||||
Comment[bs]=Podrška plazma izvođača za Python
|
||||
Comment[ca]=Implementació de l'executor del Plasma per al Python
|
||||
Comment[ca@valencia]=Implementació de l'executor del Plasma per al Python
|
||||
Comment[cs]=Podpora Plasma spouštěče pro Python
|
||||
Comment[da]=Understøttelse af Plasma Runner til Python
|
||||
Comment[de]=Plasma-Starter-Unterstützung für Python
|
||||
Comment[el]=Υποστήριξη εκτελεστή Plasma για την Python
|
||||
Comment[en_GB]=Plasma Runner support for Python
|
||||
Comment[es]=Implementación de lanzador Plasma para Python
|
||||
Comment[et]=Plasma käivitaja toetus Pythonile
|
||||
Comment[eu]=Python-erako Plasmaren abiarazlearen euskarria
|
||||
Comment[fi]=Plasma-suoritusohjelmatuki Python-kielelle
|
||||
Comment[fr]=Prise en charge du lanceur Plasma pour Python
|
||||
Comment[gl]=Executor de Plasma que permite usar Python
|
||||
Comment[he]=תמיכה ב־Runner של Plasma עבור Python
|
||||
Comment[hi]=पायथन के लिए प्लाज्मा रनर समर्थन
|
||||
Comment[hr]=Plasma Runner podrška za Python
|
||||
Comment[hu]=Plazma-indító támogatás Pythonhoz
|
||||
Comment[ia]=Supporto de executor de Plasma pro Python
|
||||
Comment[id]=Dukungan Pelari Plasma terhadap Python
|
||||
Comment[is]=Plasma gagnavélarstuðningur fyrir Python
|
||||
Comment[it]=Supporto per l'esecutore Plasma per Python
|
||||
Comment[ja]=Python のための Plasma ラナーサポート
|
||||
Comment[kk]=Plasma-дағы Python-ды жегуін қолдауы
|
||||
Comment[km]=ការគាំទ្រកម្មវិធីរត់ប្លាស្មាសម្រាប់ Python
|
||||
Comment[kn]=ಪೈಥಾನ್ಗಾಗಿ ಪ್ಲಾಸ್ಮಾ ರನ್ನರ್ ಬೆಂಬಲ
|
||||
Comment[ko]=Plasma 파이썬 실행기
|
||||
Comment[lt]=Plasma paleidiklio palaikymas Python kalbai
|
||||
Comment[lv]=Plasma darbinātāja atbalsts Python
|
||||
Comment[mr]=पायथोन करिता प्लाज्मा रनर समर्थन
|
||||
Comment[nb]=Plasma kjørerstøtte for Python
|
||||
Comment[nds]=Plasma-Dregerünnerstütten för Python
|
||||
Comment[nl]=Plasma-starter-ondersteuning voor Python
|
||||
Comment[nn]=Plasma-køyrarstøtte for Python
|
||||
Comment[pa]=ਪਾਈਥਨ ਲਈ ਪਲਾਜ਼ਮਾ ਰਨਰ ਸਹਿਯੋਗ
|
||||
Comment[pl]=Obsługa programów uruchamiających dla Pythona
|
||||
Comment[pt]=Suporte para os motores de execução do Plasma em Python
|
||||
Comment[pt_BR]=Suporte aos mecanismos de execução do Plasma para Python
|
||||
Comment[ro]=Suport executori Plasma pentru Python
|
||||
Comment[ru]=Поддержка модулей запуска KRunner на языке Python
|
||||
Comment[si]=Python සඳහා ප්ලාස්මා ධාවක සහාය
|
||||
Comment[sk]=Podpora spúšťača plasmy pre Python
|
||||
Comment[sl]=Podpora za zaganjalnike napisane v Pythonu
|
||||
Comment[sr]=Подршка плазма извођача за питон
|
||||
Comment[sr@ijekavian]=Подршка плазма извођача за питон
|
||||
Comment[sr@ijekavianlatin]=Podrška plasma izvođača za Python
|
||||
Comment[sr@latin]=Podrška plasma izvođača za Python
|
||||
Comment[sv]=Plasma körningsstöd för Python
|
||||
Comment[tg]=Пуштибонии Python дар асоси маълумоти Plasma
|
||||
Comment[th]=ตัวเรียกใช้งานของพลาสมาที่รองรับสำหรับโปรแกรมภาษาไพธอน
|
||||
Comment[tr]=Python için Plasma Çalıştırıcı desteği
|
||||
Comment[ug]=Python نى قوللايدىغان Plasma ئىجراچىسى
|
||||
Comment[uk]=Підтримка Python у інструментах запуску
|
||||
Comment[wa]=Sopoirt po Python di l' enondeu di Plasma
|
||||
Comment[x-test]=xxPlasma Runner support for Pythonxx
|
||||
Comment[zh_CN]=支持 Python 的 Plasma 运行器
|
||||
Comment[zh_TW]=支援 Python 的執行器
|
||||
|
||||
X-KDE-ServiceTypes=Plasma/ScriptEngine
|
||||
Type=Service
|
||||
Icon=text-x-script
|
||||
X-KDE-Library=kpythonpluginfactory
|
||||
X-KDE-PluginKeyword=plasma_scriptengine_python/pyrunner.py
|
||||
X-EngineName=pythonrunner
|
||||
X-Plasma-API=python
|
||||
X-Plasma-ComponentTypes=Runner
|
120
src/scriptengines/python/plasma_importer.py
Normal file
120
src/scriptengines/python/plasma_importer.py
Normal file
@ -0,0 +1,120 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2008 Simon Edwards <simon@simonzone.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the
|
||||
# Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
import sys
|
||||
import os
|
||||
import imp
|
||||
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
|
||||
class PlasmaImporter(object):
|
||||
def __init__(self):
|
||||
self.toplevel = {}
|
||||
self.toplevelcount = {}
|
||||
self.marker = '<plasma>' + str(id(self))
|
||||
sys.path.append(self.marker)
|
||||
sys.path_hooks.append(self.hook)
|
||||
|
||||
def hook(self,path):
|
||||
if path==self.marker:
|
||||
return self
|
||||
else:
|
||||
raise ImportError()
|
||||
|
||||
def register_top_level(self,name,path):
|
||||
if name not in self.toplevel:
|
||||
self.toplevelcount[name] = 1
|
||||
self.toplevel[name] = path
|
||||
else:
|
||||
self.toplevelcount[name] += 1
|
||||
|
||||
def unregister_top_level(self,name):
|
||||
value = self.toplevelcount[name]-1
|
||||
self.toplevelcount[name] = value
|
||||
if value==0:
|
||||
del self.toplevelcount[name]
|
||||
del self.toplevel[name]
|
||||
for key in list(sys.modules.keys()):
|
||||
if key==name or key.startswith(name+"."):
|
||||
del sys.modules[key]
|
||||
|
||||
def find_module(self,fullname, path=None):
|
||||
location = self.find_pymod(fullname)
|
||||
if location is not None:
|
||||
return self
|
||||
else:
|
||||
return None
|
||||
|
||||
# Find the given module in the plasma directory.
|
||||
# Result a tuple on success otherwise None. The tuple contains the location
|
||||
# of the module/package in disk and a boolean indicating if it is a package
|
||||
# or module
|
||||
def find_pymod(self,modulename):
|
||||
parts = modulename.split('.')
|
||||
toppackage = parts[0]
|
||||
rest = parts[1:]
|
||||
|
||||
if toppackage in self.toplevel:
|
||||
path = self.toplevel[toppackage]
|
||||
if len(rest)==0:
|
||||
# Simple top level Plasma package
|
||||
return (path,True)
|
||||
else:
|
||||
restpath = apply(os.path.join,rest)
|
||||
fullpath = os.path.join(path,'contents','code',restpath)
|
||||
if os.path.isdir(fullpath):
|
||||
return (fullpath,True)
|
||||
elif os.path.exists(fullpath+'.py'):
|
||||
return (fullpath+'.py',False)
|
||||
else:
|
||||
return None
|
||||
|
||||
def _get_code(self,location):
|
||||
return open(location).read()
|
||||
|
||||
def load_module(self, fullname):
|
||||
location,ispkg = self.find_pymod(fullname)
|
||||
if ispkg: # Package dir.
|
||||
initlocation = os.path.join(location,'__init__.py')
|
||||
code = None
|
||||
if os.path.isfile(initlocation):
|
||||
code = open(initlocation)
|
||||
else:
|
||||
code = open(location)
|
||||
|
||||
mod = sys.modules.setdefault(fullname, imp.new_module(fullname))
|
||||
mod.__file__ = location #"<%s>" % self.__class__.__name__
|
||||
mod.__loader__ = self
|
||||
if ispkg:
|
||||
mod.__path__ = [self.marker]
|
||||
if code is not None:
|
||||
try:
|
||||
if PY3:
|
||||
exec(code in mod.__dict__)
|
||||
else:
|
||||
exec code in mod.__dict__
|
||||
finally:
|
||||
code.close()
|
||||
return mod
|
||||
|
||||
#plasma_importer = PlasmaImporter()
|
||||
#plasma_importer.register_top_level('plasma_pyclock','/home/sbe/devel/python_plasma_2/test/plasma-pyclock')
|
||||
#from plasma_pyclock import main
|
225
src/scriptengines/python/plasmascript.py
Normal file
225
src/scriptengines/python/plasmascript.py
Normal file
@ -0,0 +1,225 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2008 Simon Edwards <simon@simonzone.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the
|
||||
# Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
# Plasma applet API for Python
|
||||
|
||||
from PyQt4.QtCore import QObject
|
||||
from PyQt4.QtGui import QGraphicsWidget
|
||||
from PyKDE4.plasma import Plasma # Plasma C++ namespace
|
||||
|
||||
#import sip
|
||||
#import gc
|
||||
|
||||
class Applet(QObject):
|
||||
''' Subclass Applet in your module and return an instance of it in a global function named
|
||||
applet(). Implement the following functions to breathe life into your applet:
|
||||
* paint - Draw the applet given a QPainter and some options
|
||||
It provides the same API as Plasma.Applet; it just has slightly less irritating event names. '''
|
||||
def __init__(self, parent=None):
|
||||
# this should be set when the applet is created
|
||||
QObject.__init__(self, parent)
|
||||
#sip.settracemask(0x3f)
|
||||
self.applet = None
|
||||
self.applet_script = None
|
||||
self._forward_to_applet = True
|
||||
|
||||
def __getattr__(self, key):
|
||||
# provide transparent access to the real applet instance
|
||||
if self._forward_to_applet:
|
||||
try:
|
||||
return getattr(self.applet_script, key)
|
||||
except:
|
||||
return getattr(self.applet, key)
|
||||
else:
|
||||
raise AttributeError(key)
|
||||
|
||||
def _enableForwardToApplet(self):
|
||||
self._forward_to_applet = True
|
||||
def _disableForwardToApplet(self):
|
||||
self._forward_to_applet = False
|
||||
|
||||
# Events
|
||||
def setApplet(self,applet):
|
||||
self.applet = applet
|
||||
|
||||
def setAppletScript(self,appletScript):
|
||||
self.applet_script = appletScript
|
||||
|
||||
def init(self):
|
||||
pass
|
||||
|
||||
def configChanged(self):
|
||||
pass
|
||||
|
||||
def paintInterface(self, painter, options, rect):
|
||||
pass
|
||||
|
||||
def constraintsEvent(self, flags):
|
||||
pass
|
||||
|
||||
def showConfigurationInterface(self):
|
||||
self.dlg = self.standardConfigurationDialog()
|
||||
self.createConfigurationInterface(self.dlg)
|
||||
self.addStandardConfigurationPages(self.dlg)
|
||||
self.dlg.show()
|
||||
|
||||
def createConfigurationInterface(self, dlg):
|
||||
pass
|
||||
|
||||
def contextualActions(self):
|
||||
return []
|
||||
|
||||
def shape(self):
|
||||
return QGraphicsWidget.shape(self.applet)
|
||||
|
||||
def initExtenderItem(self, item):
|
||||
print ("Missing implementation of initExtenderItem in the applet " + \
|
||||
item.config().readEntry('SourceAppletPluginName', '').toString() + \
|
||||
"!\nAny applet that uses extenders should implement initExtenderItem to " + \
|
||||
"instantiate a widget.")
|
||||
|
||||
def saveState(self, config):
|
||||
pass
|
||||
|
||||
###########################################################################
|
||||
class DataEngine(QObject):
|
||||
def __init__(self, parent=None):
|
||||
QObject.__init__(self, parent)
|
||||
self.dataengine = None
|
||||
self.dataengine_script = None
|
||||
|
||||
def setDataEngine(self,dataEngine):
|
||||
self.dataEngine = dataEngine
|
||||
|
||||
def setDataEngineScript(self,dataEngineScript):
|
||||
self.data_engine_script = dataEngineScript
|
||||
|
||||
def __getattr__(self, key):
|
||||
# provide transparent access to the real dataengine script instance
|
||||
try:
|
||||
return getattr(self.data_engine_script, key)
|
||||
except:
|
||||
return getattr(self.dataEngine, key)
|
||||
|
||||
def init(self):
|
||||
pass
|
||||
|
||||
def sources(self):
|
||||
return []
|
||||
|
||||
def sourceRequestEvent(self,name):
|
||||
return False
|
||||
|
||||
def updateSourceEvent(self,source):
|
||||
return False
|
||||
|
||||
def serviceForSource(self,source):
|
||||
return Plasma.DataEngineScript.serviceForSource(self.data_engine_script,source)
|
||||
|
||||
###########################################################################
|
||||
class Wallpaper(QObject):
|
||||
def __init__(self, parent=None):
|
||||
QObject.__init__(self, parent)
|
||||
self.wallpaper = None
|
||||
self.wallpaper_script = None
|
||||
|
||||
def setWallpaper(self,wallpaper):
|
||||
self.wallpaper = wallpaper
|
||||
|
||||
def setWallpaperScript(self,wallpaperScript):
|
||||
self.wallpaper_script = wallpaperScript
|
||||
|
||||
def __getattr__(self, key):
|
||||
# provide transparent access to the real wallpaper script instance
|
||||
try:
|
||||
return getattr(self.wallpaper_script, key)
|
||||
except:
|
||||
return getattr(self.wallpaper, key)
|
||||
|
||||
def init(self, config):
|
||||
pass
|
||||
|
||||
def paint(self,painter, exposedRect):
|
||||
pass
|
||||
|
||||
def save(self,config):
|
||||
pass
|
||||
|
||||
def createConfigurationInterface(self,parent):
|
||||
return None
|
||||
|
||||
def mouseMoveEvent(self,event):
|
||||
pass
|
||||
|
||||
def mousePressEvent(self,event):
|
||||
pass
|
||||
|
||||
def mouseReleaseEvent(self,event):
|
||||
pass
|
||||
|
||||
def wheelEvent(self,event):
|
||||
pass
|
||||
|
||||
def renderCompleted(self, image):
|
||||
pass
|
||||
|
||||
def urlDropped(self, url):
|
||||
pass
|
||||
|
||||
###########################################################################
|
||||
class Runner(QObject):
|
||||
def __init__(self, parent=None):
|
||||
QObject.__init__(self, parent)
|
||||
self.runner = None
|
||||
self.runner_script = None
|
||||
|
||||
def setRunner(self,runner):
|
||||
self.runner = runner
|
||||
|
||||
def setRunnerScript(self,runnerScript):
|
||||
self.runner_script = runnerScript
|
||||
|
||||
def __getattr__(self, key):
|
||||
# provide transparent access to the real runner script instance
|
||||
try:
|
||||
return getattr(self.runner_script, key)
|
||||
except:
|
||||
return getattr(self.runner, key)
|
||||
|
||||
def init(self):
|
||||
pass
|
||||
|
||||
def match(self, search):
|
||||
pass
|
||||
|
||||
def run(self, search, action):
|
||||
pass
|
||||
|
||||
def prepare(self):
|
||||
pass
|
||||
|
||||
def teardown(self):
|
||||
pass
|
||||
|
||||
def createRunOptions(self, widget):
|
||||
pass
|
||||
|
||||
def reloadConfiguration(self):
|
||||
pass
|
79
src/scriptengines/python/pydataengine.py
Normal file
79
src/scriptengines/python/pydataengine.py
Normal file
@ -0,0 +1,79 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2008 Simon Edwards <simon@simonzone.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the
|
||||
# Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from PyKDE4.plasma import Plasma
|
||||
import plasma_importer
|
||||
import os.path
|
||||
|
||||
class PythonDataEngineScript(Plasma.DataEngineScript):
|
||||
importer = None
|
||||
|
||||
def __init__(self, parent):
|
||||
Plasma.DataEngineScript.__init__(self,parent)
|
||||
if PythonDataEngineScript.importer is None:
|
||||
PythonDataEngineScript.importer = plasma_importer.PlasmaImporter()
|
||||
self.initialized = False
|
||||
|
||||
def init(self):
|
||||
self.moduleName = str(self.dataEngine().pluginName())
|
||||
self.pluginName = 'dataengine_' + self.moduleName.replace('-','_')
|
||||
|
||||
PythonDataEngineScript.importer.register_top_level(self.pluginName, str(self.dataEngine().package().path()))
|
||||
|
||||
# import the code at the file name reported by mainScript()
|
||||
relpath = os.path.relpath(str(self.mainScript()),str(self.dataEngine().package().path()))
|
||||
if relpath.startswith("contents/code/"):
|
||||
relpath = relpath[14:]
|
||||
if relpath.endswith(".py"):
|
||||
relpath = relpath[:-3]
|
||||
relpath = relpath.replace("/",".")
|
||||
self.module = __import__(self.pluginName+'.'+relpath)
|
||||
# The script may not necessarily be called "main"
|
||||
# So we use __dict__ to look up the right name
|
||||
basename = os.path.basename(str(self.mainScript()))
|
||||
basename = os.path.splitext(basename)[0]
|
||||
|
||||
self.pydataengine = self.module.__dict__[basename].CreateDataEngine(None)
|
||||
self.pydataengine.setDataEngine(self.dataEngine())
|
||||
self.pydataengine.setDataEngineScript(self)
|
||||
self.pydataengine.init()
|
||||
|
||||
self.initialized = True
|
||||
return True
|
||||
|
||||
def __dtor__(self):
|
||||
PythonDataEngineScript.importer.unregister_top_level(self.pluginName)
|
||||
self.pydataengine = None
|
||||
|
||||
def sources(self):
|
||||
return self.pydataengine.sources()
|
||||
|
||||
def serviceForSource(self,source):
|
||||
return self.pydataengine.serviceForSource(source)
|
||||
|
||||
def sourceRequestEvent(self,name):
|
||||
return self.pydataengine.sourceRequestEvent(name)
|
||||
|
||||
def updateSourceEvent(self,source):
|
||||
return self.pydataengine.updateSourceEvent(source)
|
||||
|
||||
def CreatePlugin(widget_parent, parent, component_data):
|
||||
return PythonDataEngineScript(parent)
|
93
src/scriptengines/python/pyrunner.py
Normal file
93
src/scriptengines/python/pyrunner.py
Normal file
@ -0,0 +1,93 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2008 Simon Edwards <simon@simonzone.com>
|
||||
# Copyright 2009 Petri Damstén <damu@iki.fi>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the
|
||||
# Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from PyKDE4.plasma import Plasma
|
||||
import plasma_importer
|
||||
import os.path
|
||||
|
||||
class PythonRunnerScript(Plasma.RunnerScript):
|
||||
importer = None
|
||||
|
||||
def __init__(self, parent):
|
||||
Plasma.RunnerScript.__init__(self,parent)
|
||||
if PythonRunnerScript.importer is None:
|
||||
PythonRunnerScript.importer = plasma_importer.PlasmaImporter()
|
||||
self.initialized = False
|
||||
|
||||
def init(self):
|
||||
self.moduleName = str(self.runner().package().metadata().pluginName())
|
||||
self.pluginName = 'runner_' + self.moduleName.replace('-','_')
|
||||
|
||||
PythonRunnerScript.importer.register_top_level(self.pluginName, str(self.runner().package().path()))
|
||||
|
||||
# import the code at the file name reported by mainScript()
|
||||
relpath = os.path.relpath(str(self.mainScript()),str(self.runner().package().path()))
|
||||
if relpath.startswith("contents/code/"):
|
||||
relpath = relpath[14:]
|
||||
if relpath.endswith(".py"):
|
||||
relpath = relpath[:-3]
|
||||
relpath = relpath.replace("/",".")
|
||||
self.module = __import__(self.pluginName+'.'+relpath)
|
||||
basename = os.path.basename(str(self.mainScript()))
|
||||
basename = os.path.splitext(basename)[0]
|
||||
self.pyrunner = self.module.__dict__[basename].CreateRunner(None)
|
||||
self.pyrunner.setRunner(self.runner())
|
||||
self.pyrunner.setRunnerScript(self)
|
||||
self.connect(self, SIGNAL('prepare()'), self, SLOT('prepare()'))
|
||||
self.connect(self, SIGNAL('teardown()'), self, SLOT('teardown()'))
|
||||
self.connect(self, SIGNAL('createRunOptions(QWidget*)'),
|
||||
self, SLOT('createRunOptions(QWidget*)'))
|
||||
self.connect(self, SIGNAL('reloadConfiguration()'),
|
||||
self, SLOT('reloadConfiguration()'))
|
||||
self.pyrunner.init()
|
||||
|
||||
self.initialized = True
|
||||
return True
|
||||
|
||||
def __dtor__(self):
|
||||
PythonRunnerScript.importer.unregister_top_level(self.pluginName)
|
||||
self.pyrunner = None
|
||||
|
||||
def match(self, search):
|
||||
self.pyrunner.match(search)
|
||||
|
||||
def run(self, search, action):
|
||||
self.pyrunner.run(search, action)
|
||||
|
||||
@pyqtSignature("prepare()")
|
||||
def prepare(self):
|
||||
self.pyrunner.prepare()
|
||||
|
||||
@pyqtSignature("teardown()")
|
||||
def teardown(self):
|
||||
self.pyrunner.teardown()
|
||||
|
||||
@pyqtSignature("createRunOptions(QWidget*)")
|
||||
def createRunOptions(self, widget):
|
||||
self.pyrunner.createRunOptions(widget)
|
||||
|
||||
@pyqtSignature("reloadConfiguration()")
|
||||
def reloadConfiguration(self):
|
||||
self.pyrunner.reloadConfiguration()
|
||||
|
||||
def CreatePlugin(widget_parent, parent, component_data):
|
||||
return PythonRunnerScript(parent)
|
4
src/scriptengines/ruby/CMakeLists.txt
Normal file
4
src/scriptengines/ruby/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
install(FILES data_engine.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_scriptengine_ruby)
|
||||
|
||||
install(FILES plasma-scriptengine-ruby-dataengine.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
|
140
src/scriptengines/ruby/ChangeLog
Normal file
140
src/scriptengines/ruby/ChangeLog
Normal file
@ -0,0 +1,140 @@
|
||||
2010-02-14 Richard Dale <richard.j.dale@gmail.com>
|
||||
|
||||
* Special case the constructors of the new Plasma widgets so that they can be
|
||||
passed a PlasmaScripting::Applet as parent
|
||||
* Fixed the dialog handling so that it uses the standardConfigurationDialog()
|
||||
and addStandardConfigurationPages() methods
|
||||
|
||||
2009-08-07 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Fixed typo in the type signature of the initExtenderItem() slot. Thanks to
|
||||
David Palacio for reporting the bug
|
||||
|
||||
2009-07-19 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Use the new name 'extenderItemRestored()' for the signal to connect to
|
||||
initExtenderItem()
|
||||
|
||||
2009-07-18 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Add a Ruby version of the C++ extender tutorial example on Techbase
|
||||
|
||||
2009-07-17 Richard Dale <richard.j.dale@gmail.com>
|
||||
* If an applet has implemented an initExtenderItem() method, then connect the
|
||||
new initScriptingExtenderItem() signal to it.
|
||||
|
||||
2009-06-16 Richard Dale <richard.j.dale@gmail.com>
|
||||
* The resize() method doesn't work with scripting plasmoids, so if it is used
|
||||
output a warning message, and suggest adding a X-Plasma-DefautSize entry in
|
||||
the metadata.desktop file.
|
||||
|
||||
2009-05-26 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Add a callback for the configChanged() method in scripting applets
|
||||
|
||||
2009-04-27 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Added some special casing for the new KDE 4.3 widgets, so they work with
|
||||
PLasmaScripting::Applet arguments
|
||||
|
||||
2009-04-22 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Added PlasmaScripting::Containment and PlasmaScripting::PopupApplet classes,
|
||||
now that scripting containments and popups can be created
|
||||
|
||||
2009-02-10 Richard Dale <richard.j.dale@gmail.com>
|
||||
* For the methods that need to be special cased to work with
|
||||
PlasmaScripting::Applet type arguments, add lower case/underscore versions
|
||||
of the methods
|
||||
|
||||
2009-02-05 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Added various special casing to the Plasma::ToolTipManager class so you can
|
||||
pass a PlasmaScripting::Applet to the methods. Thanks to Mathieu Jobin for
|
||||
reporting the bug.
|
||||
|
||||
2008-12-22 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Changed the tiger applet example to find its tiger.svg resource from within
|
||||
the plasmoid package. Thanks to Rany Keddo for helping to get it working.
|
||||
|
||||
2008-12-01 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Added updateAllSources() and removeSource() slots to the
|
||||
PlasmScripting::DataEngine
|
||||
* Add DBus notification to the time data engine example for when the config
|
||||
changes
|
||||
|
||||
2008-11-18 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Fix problem with the ruby 'type()' method clashing with the one in
|
||||
Qt::GraphicsItem subclasses reported by David Palacio
|
||||
* Added a 'dbpedia-queries' data engine for making SPARQL queries to DBpedia
|
||||
about music albums
|
||||
* The sources() and init() methods needn't be implemented by a scripting
|
||||
data engine
|
||||
|
||||
2008-11-17 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Fixed missing constructor bug in Qt::GraphicsProxyWidget reported by David
|
||||
Palacio. Thanks to David for reporting the bug.
|
||||
* Improved the names of the Ruby applet and dataengine examples
|
||||
* Allow a PlasmaScripting::Applet to be a parent of all the Qt::GraphicsItem
|
||||
sub classes in their constructors
|
||||
|
||||
2008-11-05 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Fixed some bugs in the DataEngineScript class. The expected path was
|
||||
'plasma/engines' whereas the plasmapkg tool installs them in
|
||||
'plasma/dataengines'. The mainScript() and package() methods hadn't been
|
||||
implemented and were added.
|
||||
* Added a 'ruby_time' example scripting data engine
|
||||
|
||||
2008-10-30 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Separated the script engine plugins from the plasma ruby extension and moved
|
||||
the script engine code to kdebase with the other script engines
|
||||
|
||||
2008-10-23 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Converted the webapplet to use the script engine api, and renamed it
|
||||
plasma_applet_ruby_webapplet
|
||||
|
||||
2008-08-15 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Re-added the ruby version of the plasmoidviewer app
|
||||
|
||||
2008-08-12 Arno Rehn <arno@arnorehn.de>
|
||||
* Fix restoring of applet sizes.
|
||||
|
||||
2008-08-07 Richard Dale <richard.j.dale@gmail.com>
|
||||
* The marshaller for Plasma::DataEngine::Data was creating Qt::Variants with
|
||||
the wrong smoke pointer in the smokeruby_object struct, and this was causing
|
||||
a crash in the GC marking function.
|
||||
* In PlasmaScripting::Applet, if a constant such as NoBackground is referenced
|
||||
and found to be missing, then look for it in Plasma::Applet.
|
||||
* Fix bugs in the PlasmaScripting::Applet#showConfigurationInterface method
|
||||
* Special case Plasma::Applet#id so it doesn't get a Ruby warning.
|
||||
* In PlasmaScriptengineRuby::Applet the module name wasn't being derived
|
||||
correctly from the Package path
|
||||
* Add two versions of the clock applet
|
||||
* plasma_applet_ruby_clock uses the ScriptEngine api and is packaged as a
|
||||
plasmoid. It can be installed by typing the following command in the
|
||||
examples/applets directory:
|
||||
|
||||
$ plasmapkg --install plasma_applet_ruby_clock --type plasmoid
|
||||
|
||||
* analog-clock uses the C++ plugin api. Normally Ruby applets should be
|
||||
written using the script engine api, and this example is only included
|
||||
to show how the two apis differ. The clocks are functionally identical.
|
||||
|
||||
2008-08-06 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Add some fixes for the new Plasma::Frame and Plasma::Slider widgets
|
||||
|
||||
2008-07-03 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Add slots and signals for scripting applets and data engines corresponding
|
||||
to the ones in Plasma::Applet and Plasma::DataEngine
|
||||
* Change the install destination to plasma_scriptengine_ruby and the modules
|
||||
of the plugin classes to match
|
||||
|
||||
2008-06-30 Richard Dale <richard.j.dale@gmail.com>
|
||||
* For script engine based applets, add the directory where the mainScript was
|
||||
found to the ruby load path.
|
||||
|
||||
2008-06-29 Richard Dale <richard.j.dale@gmail.com>
|
||||
* If a method call is invoked on a PlasmaScripting::Applet, then relay it to
|
||||
the underlying Plasma::Applet in the script engine.
|
||||
* Add an event filter to the RubyAppletScript::Applet class so that scripting
|
||||
applets can implement event method handling overrides.
|
||||
* Change various methods in the QGraphicsView and Plasma api so that they can
|
||||
accept instances of PlasmaScripting::Applet, and the instance is substituted
|
||||
for the underlying Plasma::Applet in the ScriptEngine.
|
||||
|
||||
2008-06-28 Richard Dale <richard.j.dale@gmail.com>
|
||||
* Make the Ruby ScriptEngine based plugins work
|
||||
* Add a Ruby version of the Javascript Tiger applet
|
147
src/scriptengines/ruby/data_engine.rb
Normal file
147
src/scriptengines/ruby/data_engine.rb
Normal file
@ -0,0 +1,147 @@
|
||||
=begin
|
||||
* Copyright 2008 by Richard Dale <richard.j.dale@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
=end
|
||||
|
||||
require 'plasma_applet'
|
||||
|
||||
module PlasmaScripting
|
||||
class DataEngine < Qt::Object
|
||||
slots :updateAllSources, "removeSource(QString)"
|
||||
signals "sourceAdded(QString)", "sourceRemoved(QString)"
|
||||
|
||||
attr_accessor :data_engine_script
|
||||
|
||||
def initialize(parent, args = nil)
|
||||
super(parent)
|
||||
@data_engine_script = parent
|
||||
connect(@data_engine_script.dataEngine, SIGNAL("sourceAdded(QString)"), self, SIGNAL("sourceAdded(QString)"))
|
||||
connect(@data_engine_script.dataEngine, SIGNAL("sourceRemoved(QString)"), self, SIGNAL("sourceRemoved(QString)"))
|
||||
end
|
||||
|
||||
def init
|
||||
end
|
||||
|
||||
def sourceRequestEvent(name)
|
||||
end
|
||||
|
||||
def updateSourceEvent(source)
|
||||
end
|
||||
|
||||
def setData(*args)
|
||||
if args.length == 2 && !args[1].kind_of?(Qt::Variant)
|
||||
args[1] = Qt::Variant.fromValue(args[1])
|
||||
elsif args.length == 3 && !args[2].kind_of?(Qt::Variant)
|
||||
args[2] = Qt::Variant.fromValue(args[2])
|
||||
end
|
||||
@data_engine_script.setData(*args)
|
||||
end
|
||||
|
||||
def removeAllData(source)
|
||||
@data_engine_script.removeAllData(source)
|
||||
end
|
||||
|
||||
def removeData(source, key)
|
||||
@data_engine_script.removeData(source, key)
|
||||
end
|
||||
|
||||
def setMaxSourceCount(limit)
|
||||
@data_engine_script.setMaxSourceCount(limit)
|
||||
end
|
||||
|
||||
def maxSourceCount=(limit)
|
||||
setMaxSourceCount(limit)
|
||||
end
|
||||
|
||||
def setMinimumPollingInterval(minimumMs)
|
||||
@data_engine_script.setMinimumPollingInterval(minimumMs)
|
||||
end
|
||||
|
||||
def minimumPollingInterval=(minimumMs)
|
||||
setMinimumPollingInterval(minimumMs)
|
||||
end
|
||||
|
||||
def minimumPollingInterval
|
||||
@data_engine_script.minimumPollingInterval
|
||||
end
|
||||
|
||||
def setPollingInterval(frequency)
|
||||
@data_engine_script.setPollingInterval(frequency)
|
||||
end
|
||||
|
||||
def pollingInterval=(frequency)
|
||||
setPollingInterval(frequency)
|
||||
end
|
||||
|
||||
def removeAllSources
|
||||
@data_engine_script.removeAllSources
|
||||
end
|
||||
|
||||
def sources
|
||||
return []
|
||||
end
|
||||
|
||||
def removeSource(source)
|
||||
@data_engine_script.dataEngine.removeSource(source)
|
||||
end
|
||||
|
||||
def updateAllSources
|
||||
@data_engine_script.dataEngine.updateAllSources
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module PlasmaScriptengineRuby
|
||||
class DataEngine < Plasma::DataEngineScript
|
||||
def initialize(parent, args)
|
||||
super(parent)
|
||||
end
|
||||
|
||||
def camelize(str)
|
||||
str.gsub(/(^|[._-])(.)/) { $2.upcase }
|
||||
end
|
||||
|
||||
def init
|
||||
puts "RubyAppletScript::DataEngine#init mainScript: #{mainScript}"
|
||||
program = Qt::FileInfo.new(mainScript)
|
||||
$: << program.path
|
||||
load Qt::File.encodeName(program.filePath).to_s
|
||||
moduleName = camelize(Qt::Dir.new(package.path).dirName)
|
||||
className = camelize(program.baseName)
|
||||
puts "RubyAppletScript::DataEngine#init instantiating: #{moduleName}::#{className}"
|
||||
klass = Object.const_get(moduleName.to_sym).const_get(className.to_sym)
|
||||
@data_engine_script = klass.new(self)
|
||||
@data_engine_script.init
|
||||
return true
|
||||
end
|
||||
|
||||
def sources
|
||||
@data_engine_script.sources
|
||||
end
|
||||
|
||||
def sourceRequestEvent(name)
|
||||
@data_engine_script.sourceRequestEvent(name)
|
||||
end
|
||||
|
||||
def updateSourceEvent(source)
|
||||
@data_engine_script.updateSourceEvent(source)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;
|
||||
|
@ -0,0 +1,152 @@
|
||||
[Desktop Entry]
|
||||
Name=Ruby Widget
|
||||
Name[ar]=ودجة روبي
|
||||
Name[ast]=Elementu gráficu en Ruby
|
||||
Name[be@latin]=Widžet u movie „Ruby”
|
||||
Name[bg]=Джаджа на Ruby
|
||||
Name[bn]=রুবি উইজেট
|
||||
Name[bn_IN]=Ruby উইজেট
|
||||
Name[bs]=Ruby grafička kontrola
|
||||
Name[ca]=Estri Ruby
|
||||
Name[ca@valencia]=Estri Ruby
|
||||
Name[cs]=Ruby widget
|
||||
Name[csb]=Interfejs Ruby
|
||||
Name[da]=Ruby-widget
|
||||
Name[de]=Ruby-Miniprogramm
|
||||
Name[el]=Συστατικό Ruby
|
||||
Name[en_GB]=Ruby Widget
|
||||
Name[eo]=Ruby-fenestraĵo
|
||||
Name[es]=Elemento gráfico en Ruby
|
||||
Name[et]=Ruby vidin
|
||||
Name[eu]=Ruby trepeta
|
||||
Name[fi]=Ruby-sovelma
|
||||
Name[fr]=Composant graphique Ruby
|
||||
Name[fy]=Ruby widget
|
||||
Name[ga]=Giuirléid Ruby
|
||||
Name[gl]=Widget escrito en Ruby
|
||||
Name[gu]=રૂબી વિજેટ
|
||||
Name[he]=ווידג׳ט של Ruby
|
||||
Name[hi]=रूबी विज़ेट
|
||||
Name[hne]=रूबी विजेट
|
||||
Name[hr]=Ruby widget
|
||||
Name[hu]=Ruby-elem
|
||||
Name[ia]=Elemento graphic (Widget) de Ruby
|
||||
Name[id]=Widget Ruby
|
||||
Name[is]=Ruby græja
|
||||
Name[it]=Oggetto Ruby
|
||||
Name[ja]=Ruby ウィジェット
|
||||
Name[kk]=Ruby бөлшегі
|
||||
Name[km]=ធាតុក្រាហ្វិក
|
||||
Name[kn]=ರೂಬಿ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
|
||||
Name[ko]=루비 위젯
|
||||
Name[ku]=Alava Ruby
|
||||
Name[lt]=Ruby valdiklis
|
||||
Name[lv]=Ruby sīkrīks
|
||||
Name[ml]=റൂബി ഉരുപ്പടി
|
||||
Name[mr]=Ruby विजेट
|
||||
Name[nb]=Ruby-element
|
||||
Name[nds]=Ruby-Lüttprogramm
|
||||
Name[nl]=Ruby-widget
|
||||
Name[nn]=Ruby-element
|
||||
Name[or]=ରୁବି ୱିଜେଟ
|
||||
Name[pa]=ਰੂਬੀ ਵਿਦਜੈੱਟ
|
||||
Name[pl]=Element interfejsu w języku Ruby
|
||||
Name[pt]=Elemento Ruby
|
||||
Name[pt_BR]=Widget Ruby
|
||||
Name[ro]=Control Ruby
|
||||
Name[ru]=Виджет на языке Ruby
|
||||
Name[si]=Ruby මෙවලම්
|
||||
Name[sk]=Ruby widget
|
||||
Name[sl]=Gradnik v Ruby
|
||||
Name[sr]=рубијевски виџет
|
||||
Name[sr@ijekavian]=рубијевски виџет
|
||||
Name[sr@ijekavianlatin]=ruby vidžet
|
||||
Name[sr@latin]=ruby vidžet
|
||||
Name[sv]=Grafisk Ruby-komponent
|
||||
Name[ta]=Ruby Widget
|
||||
Name[tg]=Илова ба Ruby
|
||||
Name[th]=วิดเจ็ตภาษารูบี้
|
||||
Name[tr]=Ruby Gereci
|
||||
Name[ug]=Ruby ۋىجېتى
|
||||
Name[uk]=Віджет Ruby
|
||||
Name[wa]=Ahesse Ruby
|
||||
Name[x-test]=xxRuby Widgetxx
|
||||
Name[zh_CN]=Ruby 部件
|
||||
Name[zh_TW]=Ruby 元件
|
||||
Comment=Native Plasma widget written in Ruby
|
||||
Comment[ar]=وجة بلازما أصلية مكتوبة بروبي
|
||||
Comment[ast]=Elementu gráficu nativu de Plasma escrito en Ruby
|
||||
Comment[be@latin]=Rodny widžet systemy „Plasma”, napisany ŭ movie „Ruby”
|
||||
Comment[bg]=Оригинална джаджа за Plasma, написана на Ruby
|
||||
Comment[bs]=Samosvojni plazma grafička kontrola napisana u Ruby-ju
|
||||
Comment[ca]=Estri nadiu del Plasma escrit en Ruby
|
||||
Comment[ca@valencia]=Estri nadiu del Plasma escrit en Ruby
|
||||
Comment[cs]=Nativní plasmoid napsaný v Ruby
|
||||
Comment[da]=Ægte Plasma-widget skrevet i Ruby
|
||||
Comment[de]=Echtes Plasma-Programm, geschrieben in Ruby
|
||||
Comment[el]=Εγγενές συστατικό Plasma γραμμένο σε Ruby
|
||||
Comment[en_GB]=Native Plasma widget written in Ruby
|
||||
Comment[es]=Elemento gráfico nativo de Plasma escrito en Ruby
|
||||
Comment[et]=Rubys kirjutatud Plasma vidin
|
||||
Comment[eu]=Jatorrizko Plasma trepeta, Ruby lengoaian idatzia
|
||||
Comment[fi]=Natiivi, Ruby-pohjainen Plasma-sovelma
|
||||
Comment[fr]=Composant graphique natif de Plasma écrit en Ruby
|
||||
Comment[fy]=Plasma widget skreaun yn Ruby
|
||||
Comment[ga]=Giuirléid dhúchasach Plasma scríofa i Ruby
|
||||
Comment[gl]=Widget nativo de Plasma escrito en Ruby
|
||||
Comment[gu]=રૂબીમાં લખાયેલ મૂળભૂત પ્લાઝમા વિજેટ
|
||||
Comment[he]=ווידג׳ט Plasma הנכתב ב־Ruby
|
||||
Comment[hi]=रूबी में लिखा गया नेटिव प्लाज्मा विजेट
|
||||
Comment[hne]=रुबी मं लिखे नेटिव प्लाज्मा विजेट
|
||||
Comment[hr]=Izvorna Plasma widget napisana u Rubyu
|
||||
Comment[hu]=Plasma-elem Ruby nyelven
|
||||
Comment[ia]=Elemento graphic (widget) native de Plasma scribite in Ruby
|
||||
Comment[id]=Widget Plasma asli yang ditulis dalam Ruby
|
||||
Comment[is]=Upprunabundin Plasma græja skrifuð í Ruby
|
||||
Comment[it]=Oggetto nativo di Plasma scritto in Ruby
|
||||
Comment[ja]=Ruby で書かれた Plasma のネイティブウィジェット
|
||||
Comment[kk]=Ruby-дег жазылған Plasma интерфейс бөлшегі
|
||||
Comment[km]=ធាតុក្រាហ្វិកប្លាស្មាដើមបានសរសេរនៅក្នុង Ruby
|
||||
Comment[kn]=ರೂಬಿಯಲ್ಲಿ ಬರೆಯಲಾದ ಸ್ಥಳೀಯ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
|
||||
Comment[ko]=루비로 작성된 Plasma 위젯
|
||||
Comment[lt]=Nuosavas Plasma valdiklis parašytas Ruby kalba
|
||||
Comment[lv]=Plasma sīkrīks, rakstīts Ruby
|
||||
Comment[ml]=റൂബിയില് തയ്യാറാക്കിയിരിക്കുന്ന നേറ്റീവ് പ്ലാസ്മാ ഉരുപ്പടി
|
||||
Comment[mr]=Ruby अंतर्गत लिहीले गेलेले मूळ Plasma विजेट
|
||||
Comment[nb]=Plasmaelement for dette systemet, skrevet i Ruby
|
||||
Comment[nds]=En orginaal Plasmaelement, schreven in Ruby
|
||||
Comment[nl]=Plasma-widget geschreven in Ruby
|
||||
Comment[nn]=Lokalt Plasma-element skrive i Ruby
|
||||
Comment[or]=Ruby ରେ ଲେଖା ହୋଇଥିବା ସ୍ଥାନୀୟ ପ୍ଲାଜମା ୱିଜେଟ
|
||||
Comment[pa]=ਰੂਬੀ ਵਿੱਚ ਲਿਖੇ ਨੇਟਿਵ ਪਲਾਜ਼ਮਾ ਵਿਦਜੈੱਟ
|
||||
Comment[pl]=Element interfejsu Plazmy napisany w języku Ruby
|
||||
Comment[pt]=Elemento nativo do Plasma feito em Ruby
|
||||
Comment[pt_BR]=Widget nativo do Plasma, escrito em Ruby
|
||||
Comment[ro]=Miniaplicație Plasma scrisă în Ruby
|
||||
Comment[ru]=Виджет Plasma, написанный на языке Ruby
|
||||
Comment[si]=Native Plasma widget written in Ruby
|
||||
Comment[sk]=Natívny plasma widget napísaný v Ruby
|
||||
Comment[sl]=Lastni gradnik za Plasmo, ki je napisan v Rubyu
|
||||
Comment[sr]=Самосвојни плазма виџет написан у рубију
|
||||
Comment[sr@ijekavian]=Самосвојни плазма виџет написан у рубију
|
||||
Comment[sr@ijekavianlatin]=Samosvojni plasma vidžet napisan u Rubyju
|
||||
Comment[sr@latin]=Samosvojni plasma vidžet napisan u Rubyju
|
||||
Comment[sv]=Inbyggd grafisk Plasma-komponent skriven i Ruby
|
||||
Comment[ta]=Native Plasma widget written in Ruby
|
||||
Comment[tg]=Модуль Plasma, написанный на языке JavaScript
|
||||
Comment[th]=วิดเจ็ตพลาสมาแท้ที่ถูกเขียนด้วยภาษารูบี้
|
||||
Comment[tr]=Ruby ile yazılmış gerçek Plasma gereci
|
||||
Comment[ug]=Ruby بىلەن يېزىلغان ئەسلى Plasma كىچىك ئەپ
|
||||
Comment[uk]=Віджет Плазми, написаний на Ruby
|
||||
Comment[wa]=Ahesse askepieye po Plasma eyet scrîte e Ruby
|
||||
Comment[x-test]=xxNative Plasma widget written in Rubyxx
|
||||
Comment[zh_CN]=使用 Ruby 编写的原生 Plasma 部件
|
||||
Comment[zh_TW]=用 Ruby 寫的原始 Plasma 元件
|
||||
X-KDE-ServiceTypes=Plasma/ScriptEngine
|
||||
Type=Service
|
||||
Icon=text-x-script
|
||||
X-KDE-Library=krubypluginfactory
|
||||
X-KDE-PluginKeyword=plasma_scriptengine_ruby/data_engine.rb
|
||||
X-EngineName=ruby-dataengine-script
|
||||
X-Plasma-API=ruby-script
|
||||
X-Plasma-ComponentTypes=DataEngine
|
Loading…
Reference in New Issue
Block a user