From 62164f8229e4119e5e28e98a935eae31c85ff57d Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sat, 24 May 2014 16:06:45 +0400 Subject: [PATCH] added support of text update contextual action --- sources/ptm/contents/code/main.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sources/ptm/contents/code/main.py b/sources/ptm/contents/code/main.py index 5600558..3d70c5a 100644 --- a/sources/ptm/contents/code/main.py +++ b/sources/ptm/contents/code/main.py @@ -75,9 +75,6 @@ class pyTextWidget(plasmascript.Applet): """function to initializate widget""" self._name = str(self.package().metadata().pluginName()) self.setupVar() - # actions - self.createActions() - self.dataengine = dataengine.DataEngine(self) 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"))): self.createNotifyrc(kdehome) + # actions + self.createActions() + # context menu def createActions(self): @@ -110,7 +110,12 @@ class pyTextWidget(plasmascript.Applet): self.ptmActions['readme'] = QAction(i18n("Show README"), self) QObject.connect(self.ptmActions['readme'], SIGNAL("triggered(bool)"), self.showReadme) 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): @@ -150,10 +155,6 @@ class pyTextWidget(plasmascript.Applet): os.system("kioclient exec " + str(filePath) + " &") - def updateText(self): - """function to force update text""" - - # internal functions def addDiskDevice(self, sourceName): diskRegexp = QRegExp("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)")