mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
Pre-release 1.3.3b:
+ added select temperature device
This commit is contained in:
parent
cbc475d38b
commit
98458dfcf3
Binary file not shown.
BIN
py-text-monitor-1.3.3b.plasmoid
Normal file
BIN
py-text-monitor-1.3.3b.plasmoid
Normal file
Binary file not shown.
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
BIN
screenshots/config_2.png
Normal file
BIN
screenshots/config_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 422 KiB |
@ -3,6 +3,7 @@
|
||||
from PyQt4.QtGui import *
|
||||
from PyKDE4.kdecore import *
|
||||
from PyKDE4.kdeui import *
|
||||
import commands
|
||||
import config
|
||||
|
||||
|
||||
@ -141,6 +142,9 @@ class ConfigDefinition:
|
||||
self.parent.ac_device = str(self.configpage.ui.lineEdit_acdev.text())
|
||||
settings.set('battery_device', self.parent.battery_device)
|
||||
settings.set('ac_device', self.parent.ac_device)
|
||||
elif (self.parent.dict_orders[label] == 'temp'):
|
||||
self.parent.tempdev = str(self.configpage.ui.comboBox_temp.currentText())
|
||||
settings.set('temp_device', self.parent.tempdev)
|
||||
|
||||
self.parent.label_order = ''.join(self.parent.label_order.split('-'))
|
||||
settings.set('label_order', self.parent.label_order)
|
||||
@ -179,6 +183,17 @@ class ConfigDefinition:
|
||||
if (self.parent.dict_orders[label] == 'bat'):
|
||||
self.configpage.ui.lineEdit_batdev.setText(str(settings.get('battery_device', '/sys/class/power_supply/BAT0/capacity')))
|
||||
self.configpage.ui.lineEdit_acdev.setText(str(settings.get('ac_device', '/sys/class/power_supply/AC/online')))
|
||||
elif (self.parent.dict_orders[label] == 'temp'):
|
||||
self.configpage.ui.comboBox_temp.addItem(str(settings.get('temp_device', '<select device>')))
|
||||
commandOut = commands.getoutput("sensors")
|
||||
for adapter in commandOut.split("\n\n"):
|
||||
for device in adapter.split("\n"):
|
||||
if (device.find('\xc2\xb0C') > -1):
|
||||
try:
|
||||
tempdev = 'lmsensors/' + adapter.split('\n')[0] + '/' + '_'.join(device.split(":")[0].split())
|
||||
self.configpage.ui.comboBox_temp.addItem(tempdev)
|
||||
except:
|
||||
pass
|
||||
|
||||
# add config page
|
||||
page = parent.addPage(self.configpage, i18n(self.parent.name()))
|
||||
|
@ -51,6 +51,8 @@ class ConfigWindow(QWidget):
|
||||
self.ui.lineEdit_batdev.setEnabled(True)
|
||||
elif (label == 'net'):
|
||||
self.ui.comboBox_numNet.setEnabled(True)
|
||||
elif (label == 'temp'):
|
||||
self.ui.comboBox_temp.setEnabled(True)
|
||||
slider_label = 0
|
||||
for slider in self.sliders.values():
|
||||
if (slider.isEnabled() == True):
|
||||
@ -69,6 +71,8 @@ class ConfigWindow(QWidget):
|
||||
self.ui.lineEdit_batdev.setDisabled(True)
|
||||
elif (label == 'net'):
|
||||
self.ui.comboBox_numNet.setDisabled(True)
|
||||
elif (label == 'temp'):
|
||||
self.ui.comboBox_temp.setDisabled(True)
|
||||
for slider in self.sliders.values():
|
||||
if ((slider.value() == slider.maximum()) and (slider != self.sliders[label])):
|
||||
slider.setValue(self.sliders[label].value())
|
||||
|
@ -84,9 +84,6 @@ class pyTextWidget(plasmascript.Applet):
|
||||
# setup number of cores
|
||||
commandOut = commands.getoutput("grep -c '^processor' /proc/cpuinfo")
|
||||
self.numCores = int(commandOut)
|
||||
# setup temperature device
|
||||
commandOut = commands.getoutput("sensors | grep adapter -B1 -A1 | grep °C -B2")
|
||||
self.tempdev = "lmsensors/" + commandOut.split("\n")[0] + "/" + '_'.join(commandOut.split("\n")[2].split(":")[0].split())
|
||||
|
||||
# create dictionaries
|
||||
self.dict_orders = {'6':'bat', '1':'cpu', '7':'cpuclock', '9':'gpu', 'a':'gputemp',
|
||||
|
@ -80,6 +80,7 @@ class Reinit():
|
||||
self.parent.layout.addItem(self.parent.label_cpu)
|
||||
elif (order == "2"):
|
||||
if (self.parent.tempBool == 1):
|
||||
self.parent.tempdev = str(settings.get('temp_device', '<select device>'))
|
||||
self.parent.tempFormat = str(settings.get('tempFormat', '[temp: $temp°C]'))
|
||||
self.parent.label_temp = Plasma.Label(self.parent.applet)
|
||||
if (self.parent.tempFormat.split('$temp')[0] != self.parent.tempFormat):
|
||||
|
@ -463,10 +463,41 @@ $ccpucl - CPU clock for each core, MHz</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_temp">
|
||||
<widget class="QComboBox" name="comboBox_temp">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<width>100</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_temp">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -12,7 +12,7 @@ X-Plasma-RequiredExtensions=FileDialog,LaunchApp,LocalIO
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alexeev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=py-text-monitor
|
||||
X-KDE-PluginInfo-Version=1.3.3
|
||||
X-KDE-PluginInfo-Version=1.3.3b
|
||||
X-KDE-PluginInfo-Website=http://kde-look.org/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
|
Loading…
Reference in New Issue
Block a user