mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
edited update netdevice
This commit is contained in:
parent
e04430e36c
commit
9f392c3a19
@ -116,6 +116,7 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
self.ptm['dataengine']['system'], SLOT("forceImmediateUpdateOfAllVisualizations()"))
|
self.ptm['dataengine']['system'], SLOT("forceImmediateUpdateOfAllVisualizations()"))
|
||||||
QObject.connect(self.ptmActions['update'], SIGNAL("triggered(bool)"),
|
QObject.connect(self.ptmActions['update'], SIGNAL("triggered(bool)"),
|
||||||
self.ptm['dataengine']['time'], SLOT("forceImmediateUpdateOfAllVisualizations()"))
|
self.ptm['dataengine']['time'], SLOT("forceImmediateUpdateOfAllVisualizations()"))
|
||||||
|
QObject.connect(self.ptmActions['update'], SIGNAL("triggered(bool)"), self.updateNetdev)
|
||||||
|
|
||||||
|
|
||||||
def contextualActions(self):
|
def contextualActions(self):
|
||||||
@ -311,6 +312,11 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
self.updateTooltip()
|
self.updateTooltip()
|
||||||
|
|
||||||
|
|
||||||
|
def updateNetdev(self):
|
||||||
|
"""function to update netdev"""
|
||||||
|
self.ptm['names']['net'] = self.setNetdev()
|
||||||
|
|
||||||
|
|
||||||
def updateTooltip(self):
|
def updateTooltip(self):
|
||||||
"""function to update tooltip"""
|
"""function to update tooltip"""
|
||||||
self.tooltipView.resize(100.0*(len(self.ptm['vars']['tooltip']['required']) - self.ptm['vars']['tooltip']['required'].count('up')), 100.0)
|
self.tooltipView.resize(100.0*(len(self.ptm['vars']['tooltip']['required']) - self.ptm['vars']['tooltip']['required'].count('up')), 100.0)
|
||||||
@ -597,8 +603,7 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
def reInit(self):
|
def reInit(self):
|
||||||
"""function to run reinit"""
|
"""function to run reinit"""
|
||||||
self.reinit.reinit()
|
self.reinit.reinit()
|
||||||
if (self.ptm['vars']['adv']['netdevBool'] == 0):
|
self.updateNetdev()
|
||||||
self.ptm['names']['net'] = self.setNetdev()
|
|
||||||
self.resize(10, 10)
|
self.resize(10, 10)
|
||||||
|
|
||||||
# create dataengines
|
# create dataengines
|
||||||
@ -611,18 +616,19 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
|
|
||||||
def setNetdev(self):
|
def setNetdev(self):
|
||||||
"""function to set network device"""
|
"""function to set network device"""
|
||||||
|
if (self.ptm['vars']['adv']['netdevBool'] > 0):
|
||||||
|
return self.ptm['vars']['adv']['netdev']
|
||||||
netdev = "lo"
|
netdev = "lo"
|
||||||
netdir = self.ptm['vars']['adv']['netDir']
|
netdir = self.ptm['vars']['adv']['netDir']
|
||||||
interfaces = QDir.entryList(QDir(netdir), QDir.Dirs | QDir.NoDotAndDotDot)
|
interfaces = QDir.entryList(QDir(netdir), QDir.Dirs | QDir.NoDotAndDotDot)
|
||||||
for device in interfaces:
|
for device in interfaces:
|
||||||
if (str(device) != "lo"):
|
if (str(device) != "lo"):
|
||||||
#try:
|
try:
|
||||||
if True:
|
|
||||||
with open(netdir + '/' + str(device) + '/operstate', 'r') as stateFile:
|
with open(netdir + '/' + str(device) + '/operstate', 'r') as stateFile:
|
||||||
if (stateFile.readline() == "up\n"):
|
if (stateFile.readline() == "up\n"):
|
||||||
netdev = str(device)
|
netdev = str(device)
|
||||||
#except:
|
except:
|
||||||
#pass
|
pass
|
||||||
return netdev
|
return netdev
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ class Reinit():
|
|||||||
ptmVars['adv']['customTime'] = str(settings.get('custom_time', '$hh:$mm'))
|
ptmVars['adv']['customTime'] = str(settings.get('custom_time', '$hh:$mm'))
|
||||||
ptmVars['adv']['customUptime'] = str(settings.get('custom_uptime', '$dd,$hh,$mm'))
|
ptmVars['adv']['customUptime'] = str(settings.get('custom_uptime', '$dd,$hh,$mm'))
|
||||||
ptmVars['adv']['netdevBool'] = settings.get('netdevBool', 0).toInt()[0]
|
ptmVars['adv']['netdevBool'] = settings.get('netdevBool', 0).toInt()[0]
|
||||||
|
ptmVars['adv']['netdev'] = str(settings.get('custom_netdev', 'lo'))
|
||||||
ptmVars['adv']['netDir'] = str(settings.get('netdir', '/sys/class/net'))
|
ptmVars['adv']['netDir'] = str(settings.get('netdir', '/sys/class/net'))
|
||||||
ptmVars['adv']['player'] = str(settings.get('player_name', "amarok"))
|
ptmVars['adv']['player'] = str(settings.get('player_name', "amarok"))
|
||||||
|
|
||||||
@ -74,10 +75,6 @@ class Reinit():
|
|||||||
ptmNames['disk'] = str(settings.get('disk', 'disk/sda_(8:0)')).split('@@')
|
ptmNames['disk'] = str(settings.get('disk', 'disk/sda_(8:0)')).split('@@')
|
||||||
ptmNames['hdd'] = str(settings.get('mount', '/')).split('@@')
|
ptmNames['hdd'] = str(settings.get('mount', '/')).split('@@')
|
||||||
ptmNames['hddtemp'] = str(settings.get('hdd', '/dev/sda')).split('@@')
|
ptmNames['hddtemp'] = str(settings.get('hdd', '/dev/sda')).split('@@')
|
||||||
if (ptmVars['adv']['netdevBool'] > 0):
|
|
||||||
ptmNames['net'] = str(settings.get('custom_netdev', 'lo'))
|
|
||||||
else:
|
|
||||||
ptmNames['net'] = ""
|
|
||||||
ptmNames['temp'] = str(settings.get('temp_device', '')).split('@@')
|
ptmNames['temp'] = str(settings.get('temp_device', '')).split('@@')
|
||||||
self.parent.applySettings('names', ptmNames)
|
self.parent.applySettings('names', ptmNames)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user