+ added double click event

* fix yet anoter plasma crash
This commit is contained in:
arcan1s 2013-06-10 01:40:30 +04:00
parent c4312b4d63
commit 96329d3598
5 changed files with 18 additions and 5 deletions

Binary file not shown.

View File

@ -61,7 +61,7 @@ class DataEngine:
self.parent.systemmonitor.connectSource("network/interfaces/"+self.parent.netdev+"/receiver/data", self.parent, self.parent.interval) self.parent.systemmonitor.connectSource("network/interfaces/"+self.parent.netdev+"/receiver/data", self.parent, self.parent.interval)
def dataUpdated(self, sourceName, data): def dataUpdated(self, sourceName, data):
"""function to refresh data""" """function to update data"""
try: try:
if (sourceName == "system/uptime"): if (sourceName == "system/uptime"):
value = int(round(float(data[QString(u'value')]), 1)) value = int(round(float(data[QString(u'value')]), 1))
@ -231,5 +231,7 @@ class DataEngine:
line = self.parent.hddtempFormat line = self.parent.hddtempFormat
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
self.parent.label_hddtemp.setText(text) self.parent.label_hddtemp.setText(text)
self.parent.update()
except: except:
pass pass

View File

@ -51,12 +51,17 @@ class pyTextWidget(plasmascript.Applet):
def initTooltip(self): def initTooltip(self):
"""function to create tooltip""" """function to create tooltip"""
self.tooltip = Plasma.ToolTipContent() self.tooltip = Plasma.ToolTipContent()
self.tooltip.setMainText("PyTetMonitor") self.tooltip.setMainText("PyTextMonitor")
self.tooltip.setSubText('') self.tooltip.setSubText('')
Plasma.ToolTipManager.self().registerWidget(self.applet) Plasma.ToolTipManager.self().registerWidget(self.applet)
# show tooltip # show tooltip
#Plasma.ToolTipManager.self().setContent(self.applet, self.tooltip) #Plasma.ToolTipManager.self().setContent(self.applet, self.tooltip)
def mouseDoubleClickEvent(self, event):
"""function to doubleclick event"""
os.system("ksysguard")
def setupNetdev(self): def setupNetdev(self):
"""function to setup network device""" """function to setup network device"""
@ -102,7 +107,7 @@ class pyTextWidget(plasmascript.Applet):
self.timer.start() self.timer.start()
self.updateLabel() self.updateLabel()
self.tooltip.setSubText('') self.tooltip.setSubText('')
except Exception as (strerror): except Exception as strerror:
self.tooltip.setSubText(str(strerror)) self.tooltip.setSubText(str(strerror))
self.label_error = Plasma.Label(self.applet) self.label_error = Plasma.Label(self.applet)
self.label_error.setText('<font color="red">ERROR</font>') self.label_error.setText('<font color="red">ERROR</font>')

View File

@ -277,7 +277,13 @@ class Reinit():
self.parent.resize(10,10) self.parent.resize(10,10)
# create dataengines # create dataengines
self.parent.dataengine.connectToEngine() label_start = True
while label_start:
try:
self.parent.dataengine.connectToEngine()
label_start = False
except:
pass
self.parent.timer.setInterval(self.parent.interval) self.parent.timer.setInterval(self.parent.interval)
self.parent.startPolling() self.parent.startPolling()

View File

@ -7,7 +7,7 @@ Icon=utilities-system-monitor
X-Plasma-API=python X-Plasma-API=python
X-Plasma-MainScript=code/main.py X-Plasma-MainScript=code/main.py
X-Plasma-RequiredExtensions=FileDialog,LaunchApp,LocalIO X-Plasma-RequiredExtensions=LaunchApp,LocalIO,FileDialog
X-KDE-PluginInfo-Author=Evgeniy Alexeev aka arcanis X-KDE-PluginInfo-Author=Evgeniy Alexeev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Email=esalexeev@gmail.com