added support of text update contextual action

This commit is contained in:
arcan1s 2014-05-24 16:06:45 +04:00
parent 7c5e02217b
commit 62164f8229

View File

@ -75,9 +75,6 @@ class pyTextWidget(plasmascript.Applet):
"""function to initializate widget""" """function to initializate widget"""
self._name = str(self.package().metadata().pluginName()) self._name = str(self.package().metadata().pluginName())
self.setupVar() self.setupVar()
# actions
self.createActions()
self.dataengine = dataengine.DataEngine(self) self.dataengine = dataengine.DataEngine(self)
self.reinit = reinit.Reinit(self, self.ptm['defaults']) self.reinit = reinit.Reinit(self, self.ptm['defaults'])
@ -100,6 +97,9 @@ class pyTextWidget(plasmascript.Applet):
(not os.path.exists("/usr" + "/share/apps/plasma_applet_pytextmonitor/plasma_applet_pytextmonitor.notifyrc"))): (not os.path.exists("/usr" + "/share/apps/plasma_applet_pytextmonitor/plasma_applet_pytextmonitor.notifyrc"))):
self.createNotifyrc(kdehome) self.createNotifyrc(kdehome)
# actions
self.createActions()
# context menu # context menu
def createActions(self): def createActions(self):
@ -110,7 +110,12 @@ class pyTextWidget(plasmascript.Applet):
self.ptmActions['readme'] = QAction(i18n("Show README"), self) self.ptmActions['readme'] = QAction(i18n("Show README"), self)
QObject.connect(self.ptmActions['readme'], SIGNAL("triggered(bool)"), self.showReadme) QObject.connect(self.ptmActions['readme'], SIGNAL("triggered(bool)"), self.showReadme)
self.ptmActions['update'] = QAction(i18n("Update text"), self) self.ptmActions['update'] = QAction(i18n("Update text"), self)
QObject.connect(self.ptmActions['update'], SIGNAL("triggered(bool)"), self.updateText) QObject.connect(self.ptmActions['update'], SIGNAL("triggered(bool)"),
self.ptm['dataengine']['ext'], SLOT("forceImmediateUpdateOfAllVisualizations()"))
QObject.connect(self.ptmActions['update'], SIGNAL("triggered(bool)"),
self.ptm['dataengine']['system'], SLOT("forceImmediateUpdateOfAllVisualizations()"))
QObject.connect(self.ptmActions['update'], SIGNAL("triggered(bool)"),
self.ptm['dataengine']['time'], SLOT("forceImmediateUpdateOfAllVisualizations()"))
def contextualActions(self): def contextualActions(self):
@ -150,10 +155,6 @@ class pyTextWidget(plasmascript.Applet):
os.system("kioclient exec " + str(filePath) + " &") os.system("kioclient exec " + str(filePath) + " &")
def updateText(self):
"""function to force update text"""
# internal functions # internal functions
def addDiskDevice(self, sourceName): def addDiskDevice(self, sourceName):
diskRegexp = QRegExp("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)") diskRegexp = QRegExp("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)")