/usr/lib/python2.7/dist-packages/PyKDE4/plasmascript.py is in plasma-scriptengine-python 4:4.11.8-0ubuntu6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 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
|