mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
added support of package managers and ps
This commit is contained in:
parent
4c442a7e73
commit
1c58b23fa2
@ -1,7 +1,9 @@
|
|||||||
Ver.1.7.5:
|
Ver.1.8.0:
|
||||||
+ added scrollbar to configuration interface
|
+ added scrollbar to configuration interface
|
||||||
+ added AC lines configuration
|
+ added AC lines configuration
|
||||||
+ added $hddmbN, %hddgbN tags
|
+ added $hddmbN, %hddgbN tags
|
||||||
|
+ added support of ps ($ps, $pscount, $pstotal tags)
|
||||||
|
+ added support of package managers ($pkgcountN tags)
|
||||||
|
|
||||||
Ver.1.7.4:
|
Ver.1.7.4:
|
||||||
+ added support more than 10 tags in cpu, cpuclock, hdd, hddtemp, temp labels
|
+ added support more than 10 tags in cpu, cpuclock, hdd, hddtemp, temp labels
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
Вер.1.7.5:
|
Вер.1.8.0:
|
||||||
+ добавлены скроллбары в конфигурационный интерфейс
|
+ добавлены скроллбары в конфигурационный интерфейс
|
||||||
+ добавлена настройка значений AC
|
+ добавлена настройка значений AC
|
||||||
+ добавлены теги $hddmbN, $hddgbN
|
+ добавлены теги $hddmbN, $hddgbN
|
||||||
|
+ добавлена поддержка ps (теги $ps, $pscount, $pstotal)
|
||||||
|
+ добавлена поддержка пакетных менеджеров (теги $pkgcountN)
|
||||||
|
|
||||||
Вер.1.7.4:
|
Вер.1.7.4:
|
||||||
+ добавлена поддержка более чем 10 тэгов в полях cpu, cpuclock, hdd, hddtemp, temp
|
+ добавлена поддержка более чем 10 тэгов в полях cpu, cpuclock, hdd, hddtemp, temp
|
||||||
|
@ -345,6 +345,11 @@ QStringList ExtendedSysMon::getPsStats()
|
|||||||
QStringList psStats;
|
QStringList psStats;
|
||||||
psStats.append(QString::number(psCount));
|
psStats.append(QString::number(psCount));
|
||||||
psStats.append(psList.join(QString(",")));
|
psStats.append(psList.join(QString(",")));
|
||||||
|
command.start(QString("ps -e --no-headers -o command"));
|
||||||
|
command.waitForFinished(-1);
|
||||||
|
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
|
||||||
|
int psTotal = qoutput.split(QString("\n"), QString::SkipEmptyParts).count();
|
||||||
|
psStats.append(QString::number(psTotal));
|
||||||
return psStats;
|
return psStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,6 +453,8 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
setData(source, key, value[0].toInt());
|
setData(source, key, value[0].toInt());
|
||||||
key = QString("ps");
|
key = QString("ps");
|
||||||
setData(source, key, value[1]);
|
setData(source, key, value[1]);
|
||||||
|
key = QString("psTotal");
|
||||||
|
setData(source, key, value[2].toInt());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +76,21 @@ class ConfigDefinition:
|
|||||||
dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf"
|
dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf"
|
||||||
try:
|
try:
|
||||||
with open(dataengineConfig, 'w') as deConfigFile:
|
with open(dataengineConfig, 'w') as deConfigFile:
|
||||||
|
deConfigFile.write("CUSTOM=" + str(self.configpage.ui.lineEdit_customCommand.text()) + "\n")
|
||||||
deConfigFile.write("GPUDEV=" + str(self.configpage.ui.comboBox_gpudev.currentText()) + "\n")
|
deConfigFile.write("GPUDEV=" + str(self.configpage.ui.comboBox_gpudev.currentText()) + "\n")
|
||||||
deConfigFile.write("HDDDEV=" + str(self.configpage.ui.comboBox_hdddev.currentText()) + "\n")
|
deConfigFile.write("HDDDEV=" + str(self.configpage.ui.comboBox_hdddev.currentText()) + "\n")
|
||||||
deConfigFile.write("MPDADDRESS=" + str(self.configpage.ui.lineEdit_mpdaddress.text()) + "\n")
|
deConfigFile.write("MPDADDRESS=" + str(self.configpage.ui.lineEdit_mpdaddress.text()) + "\n")
|
||||||
deConfigFile.write("MPDPORT=" + str(self.configpage.ui.spinBox_mpdport.value()) + "\n")
|
deConfigFile.write("MPDPORT=" + str(self.configpage.ui.spinBox_mpdport.value()) + "\n")
|
||||||
deConfigFile.write("CUSTOM=" + str(self.configpage.ui.lineEdit_customCommand.text()) + "\n")
|
item = QStringList()
|
||||||
deConfigFile.write("PKGCMD=" + str(self.configpage.ui.comboBox_pkgCommand.currentText()) + "\n")
|
for i in range(self.configpage.ui.listWidget_pkgCommand.count()):
|
||||||
|
item.append(self.configpage.ui.listWidget_pkgCommand.item(i).text())
|
||||||
|
pkgCmd = []
|
||||||
|
pkgNull = []
|
||||||
|
for command in item:
|
||||||
|
pkgCmd.append(str(command.split(QString(":"))[0]))
|
||||||
|
pkgNull.append(str(command.split(QString(":"))[1]))
|
||||||
|
deConfigFile.write("PKGCMD=" + ','.join(pkgCmd) + "\n")
|
||||||
|
deConfigFile.write("PKGNULL=" + ','.join(pkgNull) + "\n")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -173,8 +182,8 @@ class ConfigDefinition:
|
|||||||
self.configpage.ui.kcolorcombo_down.setColor(QColor(str(settings.get('down_color', '#00ffff'))))
|
self.configpage.ui.kcolorcombo_down.setColor(QColor(str(settings.get('down_color', '#00ffff'))))
|
||||||
self.configpage.ui.kcolorcombo_up.setColor(QColor(str(settings.get('up_color', '#ff00ff'))))
|
self.configpage.ui.kcolorcombo_up.setColor(QColor(str(settings.get('up_color', '#ff00ff'))))
|
||||||
|
|
||||||
deSettings = {'GPUDEV':'auto', 'HDDDEV':'all', 'MPDADDRESS':'localhost',
|
deSettings = {'CUSTOM':'wget -qO- http://ifconfig.me/ip', 'GPUDEV':'auto', 'HDDDEV':'all',
|
||||||
'MPDPORT':'6600', 'CUSTOM':'wget -qO- http://ifconfig.me/ip', 'PKGCMD':'pacman -Qu'}
|
'MPDADDRESS':'localhost', 'MPDPORT':'6600', 'PKGCMD':'pacman -Qu', 'PKGNULL':'0'}
|
||||||
dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf"
|
dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf"
|
||||||
try:
|
try:
|
||||||
with open(dataengineConfig, 'r') as deConfigFile:
|
with open(dataengineConfig, 'r') as deConfigFile:
|
||||||
@ -183,6 +192,7 @@ class ConfigDefinition:
|
|||||||
deSettings[line.split('=')[0]] = line.split('=')[1][:-1]
|
deSettings[line.split('=')[0]] = line.split('=')[1][:-1]
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
self.configpage.ui.lineEdit_customCommand.setText(deSettings['CUSTOM'])
|
||||||
index = self.configpage.ui.comboBox_gpudev.findText(deSettings['GPUDEV'])
|
index = self.configpage.ui.comboBox_gpudev.findText(deSettings['GPUDEV'])
|
||||||
self.configpage.ui.comboBox_gpudev.setCurrentIndex(index)
|
self.configpage.ui.comboBox_gpudev.setCurrentIndex(index)
|
||||||
self.configpage.ui.comboBox_hdddev.addItem("all")
|
self.configpage.ui.comboBox_hdddev.addItem("all")
|
||||||
@ -197,9 +207,13 @@ class ConfigDefinition:
|
|||||||
self.configpage.ui.lineEdit_mpdaddress.setText(deSettings['MPDADDRESS'])
|
self.configpage.ui.lineEdit_mpdaddress.setText(deSettings['MPDADDRESS'])
|
||||||
self.configpage.ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
|
self.configpage.ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
|
||||||
self.configpage.ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
|
self.configpage.ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
|
||||||
self.configpage.ui.lineEdit_customCommand.setText(deSettings['CUSTOM'])
|
self.configpage.ui.listWidget_pkgCommand.clear()
|
||||||
index = self.configpage.ui.comboBox_pkgCommand.findText(deSettings['PKGCMD'])
|
for i in range(len(deSettings['PKGCMD'].split(','))):
|
||||||
self.configpage.ui.comboBox_pkgCommand.setCurrentIndex(index)
|
try:
|
||||||
|
num = deSettings['PKGNULL'].split(',')[i]
|
||||||
|
except:
|
||||||
|
num = "0"
|
||||||
|
self.configpage.ui.listWidget_pkgCommand.addItem(deSettings['PKGCMD'].split(',')[i] + ':' + num)
|
||||||
|
|
||||||
labelOrder = str(settings.get('label_order', '1345'))
|
labelOrder = str(settings.get('label_order', '1345'))
|
||||||
for label in self.defaults['order'].keys():
|
for label in self.defaults['order'].keys():
|
||||||
|
@ -66,9 +66,13 @@ class ConfigWindow(QWidget):
|
|||||||
QObject.connect(self.ui.pushButton_hddDevice, SIGNAL("clicked()"), self.addHddDevice)
|
QObject.connect(self.ui.pushButton_hddDevice, SIGNAL("clicked()"), self.addHddDevice)
|
||||||
QObject.connect(self.ui.pushButton_mount, SIGNAL("clicked()"), self.addMount)
|
QObject.connect(self.ui.pushButton_mount, SIGNAL("clicked()"), self.addMount)
|
||||||
QObject.connect(self.ui.pushButton_tempDevice, SIGNAL("clicked()"), self.addTempDevice)
|
QObject.connect(self.ui.pushButton_tempDevice, SIGNAL("clicked()"), self.addTempDevice)
|
||||||
|
QObject.connect(self.ui.pushButton_pkgCommand, SIGNAL("clicked()"), self.addPkgCommand)
|
||||||
QObject.connect(self.ui.listWidget_hddDevice, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_hddDevice.openPersistentEditor)
|
QObject.connect(self.ui.listWidget_hddDevice, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_hddDevice.openPersistentEditor)
|
||||||
QObject.connect(self.ui.listWidget_mount, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_mount.openPersistentEditor)
|
QObject.connect(self.ui.listWidget_mount, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_mount.openPersistentEditor)
|
||||||
QObject.connect(self.ui.listWidget_tempDevice, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_tempDevice.openPersistentEditor)
|
QObject.connect(self.ui.listWidget_tempDevice, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_tempDevice.openPersistentEditor)
|
||||||
|
QObject.connect(self.ui.listWidget_pkgCommand, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_pkgCommand.openPersistentEditor)
|
||||||
|
QObject.connect(self.ui.comboBox_pkgCommand, SIGNAL("currentIndexChanged(int)"), self.updatePkgNullValue)
|
||||||
|
QObject.connect(self.ui.comboBox_pkgCommand, SIGNAL("editTextChanged(QString)"), self.updatePkgNullValue)
|
||||||
for item in self.sliders.values():
|
for item in self.sliders.values():
|
||||||
QObject.connect(item, SIGNAL("valueChanged(int)"), self.setSlider)
|
QObject.connect(item, SIGNAL("valueChanged(int)"), self.setSlider)
|
||||||
for item in self.checkboxes.values():
|
for item in self.checkboxes.values():
|
||||||
@ -87,6 +91,9 @@ class ConfigWindow(QWidget):
|
|||||||
elif (self.ui.listWidget_tempDevice.hasFocus() and
|
elif (self.ui.listWidget_tempDevice.hasFocus() and
|
||||||
(self.ui.listWidget_tempDevice.currentRow() > -1)):
|
(self.ui.listWidget_tempDevice.currentRow() > -1)):
|
||||||
self.ui.listWidget_tempDevice.takeItem(self.ui.listWidget_tempDevice.currentRow())
|
self.ui.listWidget_tempDevice.takeItem(self.ui.listWidget_tempDevice.currentRow())
|
||||||
|
elif (self.ui.listWidget_pkgCommand.hasFocus() and
|
||||||
|
(self.ui.listWidget_pkgCommand.currentRow() > -1)):
|
||||||
|
self.ui.listWidget_pkgCommand.takeItem(self.ui.listWidget_pkgCommand.currentRow())
|
||||||
|
|
||||||
|
|
||||||
def addHddDevice(self):
|
def addHddDevice(self):
|
||||||
@ -107,6 +114,29 @@ class ConfigWindow(QWidget):
|
|||||||
self.ui.listWidget_tempDevice.addItem(self.ui.comboBox_tempDevice.currentText())
|
self.ui.listWidget_tempDevice.addItem(self.ui.comboBox_tempDevice.currentText())
|
||||||
|
|
||||||
|
|
||||||
|
def addPkgCommand(self):
|
||||||
|
"""function to add package manager command"""
|
||||||
|
self.ui.listWidget_pkgCommand.clearSelection()
|
||||||
|
self.ui.listWidget_pkgCommand.addItem(self.ui.comboBox_pkgCommand.currentText() +\
|
||||||
|
QString(":") + QString.number(self.ui.spinBox_pkgCommandNum.value()))
|
||||||
|
|
||||||
|
|
||||||
|
def updatePkgNullValue(self):
|
||||||
|
"""function to set default values to PKGNULL spinbox"""
|
||||||
|
if (self.ui.comboBox_pkgCommand.currentText().contains(QString("pacman -Qu"))):
|
||||||
|
self.ui.spinBox_pkgCommandNum.setValue(0)
|
||||||
|
elif (self.ui.comboBox_pkgCommand.currentText().contains(QString("apt-show-versions -u -b"))):
|
||||||
|
self.ui.spinBox_pkgCommandNum.setValue(0)
|
||||||
|
elif (self.ui.comboBox_pkgCommand.currentText().contains(QString("aptitude search '~U'"))):
|
||||||
|
self.ui.spinBox_pkgCommandNum.setValue(0)
|
||||||
|
elif (self.ui.comboBox_pkgCommand.currentText().contains(QString("yum list updates"))):
|
||||||
|
self.ui.spinBox_pkgCommandNum.setValue(3)
|
||||||
|
elif (self.ui.comboBox_pkgCommand.currentText().contains(QString("pkg_version -I -l '<'"))):
|
||||||
|
self.ui.spinBox_pkgCommandNum.setValue(0)
|
||||||
|
elif (self.ui.comboBox_pkgCommand.currentText().contains(QString("urpmq --auto-select"))):
|
||||||
|
self.ui.spinBox_pkgCommandNum.setValue(0)
|
||||||
|
|
||||||
|
|
||||||
def setNetdevEnabled(self):
|
def setNetdevEnabled(self):
|
||||||
"""function to set enabled netdev"""
|
"""function to set enabled netdev"""
|
||||||
if (self.ui.checkBox_netdev.checkState() == 0):
|
if (self.ui.checkBox_netdev.checkState() == 0):
|
||||||
|
@ -64,11 +64,12 @@ class DataEngine:
|
|||||||
self.updateNetdev = 0
|
self.updateNetdev = 0
|
||||||
dataEngines['system'].connectSource("network/interfaces/" + names['net'] + "/transmitter/data", self.parent, interval)
|
dataEngines['system'].connectSource("network/interfaces/" + names['net'] + "/transmitter/data", self.parent, interval)
|
||||||
dataEngines['system'].connectSource("network/interfaces/" + names['net'] + "/receiver/data", self.parent, interval)
|
dataEngines['system'].connectSource("network/interfaces/" + names['net'] + "/receiver/data", self.parent, interval)
|
||||||
|
if (bools['pkg'] > 0):
|
||||||
|
dataEngines['ext'].connectSource("pkg", self.parent, interval)
|
||||||
if (bools['player'] > 0):
|
if (bools['player'] > 0):
|
||||||
dataEngines['ext'].connectSource("player", self.parent, interval)
|
dataEngines['ext'].connectSource("player", self.parent, interval)
|
||||||
if (bools['ps'] > 0):
|
if (bools['ps'] > 0):
|
||||||
dataEngines['system'].connectSource("ps", self.parent, interval)
|
dataEngines['ext'].connectSource("ps", self.parent, interval)
|
||||||
dataEngines['system'].connectSource("pscount", self.parent, interval)
|
|
||||||
if (bools['swap'] > 0):
|
if (bools['swap'] > 0):
|
||||||
dataEngines['system'].connectSource("mem/swap/free", self.parent, interval)
|
dataEngines['system'].connectSource("mem/swap/free", self.parent, interval)
|
||||||
dataEngines['system'].connectSource("mem/swap/used", self.parent, interval)
|
dataEngines['system'].connectSource("mem/swap/used", self.parent, interval)
|
||||||
@ -116,11 +117,11 @@ class DataEngine:
|
|||||||
updatedData['value'] = value
|
updatedData['value'] = value
|
||||||
elif (sourceName == "gpu"):
|
elif (sourceName == "gpu"):
|
||||||
updatedData['name'] = "gpu"
|
updatedData['name'] = "gpu"
|
||||||
value = round(data[QString(u'GPU')].toFloat()[0], 1)
|
value = round(data[QString(u'GPU')], 1)
|
||||||
updatedData['value'] = "%4.1f" % (value)
|
updatedData['value'] = "%4.1f" % (value)
|
||||||
elif (sourceName == "gputemp"):
|
elif (sourceName == "gputemp"):
|
||||||
updatedData['name'] = "gputemp"
|
updatedData['name'] = "gputemp"
|
||||||
value = round(data[QString(u'GPUTemp')].toFloat()[0], 1)
|
value = round(data[QString(u'GPUTemp')], 1)
|
||||||
updatedData['value'] = "%4.1f" % (value)
|
updatedData['value'] = "%4.1f" % (value)
|
||||||
elif (sourceName.split('/')[0] == "partitions") and (sourceName.split('/')[-1] == "filllevel"):
|
elif (sourceName.split('/')[0] == "partitions") and (sourceName.split('/')[-1] == "filllevel"):
|
||||||
updatedData['name'] = "hdd"
|
updatedData['name'] = "hdd"
|
||||||
@ -136,7 +137,7 @@ class DataEngine:
|
|||||||
updatedData['name'] = "hddtemp"
|
updatedData['name'] = "hddtemp"
|
||||||
updatedData['value'] = {}
|
updatedData['value'] = {}
|
||||||
for item in names['hddtemp']:
|
for item in names['hddtemp']:
|
||||||
value = round(data[QString(item)].toFloat()[0], 1)
|
value = round(data[QString(item)], 1)
|
||||||
updatedData['value'][item] = "%4.1f" % (value)
|
updatedData['value'][item] = "%4.1f" % (value)
|
||||||
elif (sourceName == "mem/physical/application"):
|
elif (sourceName == "mem/physical/application"):
|
||||||
updatedData['name'] = "mem"
|
updatedData['name'] = "mem"
|
||||||
@ -173,6 +174,11 @@ class DataEngine:
|
|||||||
updatedData['type'] = "up"
|
updatedData['type'] = "up"
|
||||||
value = round(data[QString(u'value')].toFloat()[0], 0)
|
value = round(data[QString(u'value')].toFloat()[0], 0)
|
||||||
updatedData['value'] = value
|
updatedData['value'] = value
|
||||||
|
elif (sourceName == "pkg"):
|
||||||
|
updatedData['name'] = "pkg"
|
||||||
|
updatedData['value'] = {}
|
||||||
|
for singleData in data.keys():
|
||||||
|
updatedData['value'][str(singleData.toLower())] = "%i" % (data[singleData])
|
||||||
elif (sourceName == "player"):
|
elif (sourceName == "player"):
|
||||||
updatedData['name'] = "player"
|
updatedData['name'] = "player"
|
||||||
updatedData['value'] = {}
|
updatedData['value'] = {}
|
||||||
@ -195,16 +201,11 @@ class DataEngine:
|
|||||||
updatedData['value']['time'] = str(data[QString(u'qmmp_duration')].toUtf8()).decode("utf-8")
|
updatedData['value']['time'] = str(data[QString(u'qmmp_duration')].toUtf8()).decode("utf-8")
|
||||||
updatedData['value']['title'] = str(data[QString(u'qmmp_title')].toUtf8()).decode("utf-8")
|
updatedData['value']['title'] = str(data[QString(u'qmmp_title')].toUtf8()).decode("utf-8")
|
||||||
elif (sourceName == "ps"):
|
elif (sourceName == "ps"):
|
||||||
print data[QString(u'value')]
|
|
||||||
# updatedData['name'] = "ps"
|
|
||||||
# updatedData['type'] = "num"
|
|
||||||
# value = data[QString(u'value')].toInt()[0]
|
|
||||||
# updatedData['value'] = value
|
|
||||||
elif (sourceName == "pscount"):
|
|
||||||
updatedData['name'] = "ps"
|
updatedData['name'] = "ps"
|
||||||
updatedData['type'] = "num"
|
updatedData['value'] = {}
|
||||||
value = data[QString(u'value')].toInt()[0]
|
updatedData['value']['num'] = data[QString(u'psCount')]
|
||||||
updatedData['value'] = value
|
updatedData['value']['total'] = data[QString(u'psTotal')]
|
||||||
|
updatedData['value']['list'] = data[QString(u'ps')]
|
||||||
elif (sourceName == "mem/swap/free"):
|
elif (sourceName == "mem/swap/free"):
|
||||||
updatedData['name'] = "swap"
|
updatedData['name'] = "swap"
|
||||||
updatedData['type'] = "free"
|
updatedData['type'] = "free"
|
||||||
@ -297,11 +298,12 @@ class DataEngine:
|
|||||||
elif (name == "net"):
|
elif (name == "net"):
|
||||||
dataEngines['system'].disconnectSource("network/interfaces/" + keys['net'] + "/transmitter/data", self.parent)
|
dataEngines['system'].disconnectSource("network/interfaces/" + keys['net'] + "/transmitter/data", self.parent)
|
||||||
dataEngines['system'].disconnectSource("network/interfaces/" + keys['net'] + "/receiver/data", self.parent)
|
dataEngines['system'].disconnectSource("network/interfaces/" + keys['net'] + "/receiver/data", self.parent)
|
||||||
|
elif (name == "pkg"):
|
||||||
|
dataEngines['ext'].disconnectSource("pkg", self.parent)
|
||||||
elif (name == "player"):
|
elif (name == "player"):
|
||||||
dataEngines['ext'].disconnectSource("player", self.parent)
|
dataEngines['ext'].disconnectSource("player", self.parent)
|
||||||
elif (name == "ps"):
|
elif (name == "ps"):
|
||||||
dataEngines['system'].disconnectSource("ps", self.parent)
|
dataEngines['ext'].disconnectSource("ps", self.parent)
|
||||||
dataEngines['system'].disconnectSource("pscount", self.parent)
|
|
||||||
elif (name == "swap"):
|
elif (name == "swap"):
|
||||||
dataEngines['system'].disconnectSource("mem/swap/used", self.parent)
|
dataEngines['system'].disconnectSource("mem/swap/used", self.parent)
|
||||||
dataEngines['system'].disconnectSource("mem/swap/free", self.parent)
|
dataEngines['system'].disconnectSource("mem/swap/free", self.parent)
|
||||||
|
@ -150,7 +150,7 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
'cpuclock':'[mhz: $cpucl]', 'custom':'[$custom]', 'gpu':'[gpu: $gpu%]',
|
'cpuclock':'[mhz: $cpucl]', 'custom':'[$custom]', 'gpu':'[gpu: $gpu%]',
|
||||||
'gputemp':'[gpu temp: $gputemp°C]', 'hdd':'[hdd: $hdd0%]',
|
'gputemp':'[gpu temp: $gputemp°C]', 'hdd':'[hdd: $hdd0%]',
|
||||||
'hddtemp':'[hdd temp: $hddtemp0°C]', 'mem':'[mem: $mem%]',
|
'hddtemp':'[hdd temp: $hddtemp0°C]', 'mem':'[mem: $mem%]',
|
||||||
'net':'[$netdev: $down/$upKB/s]', 'pkg':'[upgrade: $pkgcount]',
|
'net':'[$netdev: $down/$upKB/s]', 'pkg':'[upgrade: $pkgcount0]',
|
||||||
'player':'[$artist - $title]', 'ps':'[proc: $pscount]', 'swap':'[swap: $swap%]',
|
'player':'[$artist - $title]', 'ps':'[proc: $pscount]', 'swap':'[swap: $swap%]',
|
||||||
'temp':'[temp: $temp0°C]', 'time':'[$time]', 'uptime':'[uptime: $uptime]'}
|
'temp':'[temp: $temp0°C]', 'time':'[$time]', 'uptime':'[uptime: $uptime]'}
|
||||||
self.ptm['defaults']['order'] = {'1':'cpu', '2':'temp', '3':'mem', '4':'swap', '5':'net',
|
self.ptm['defaults']['order'] = {'1':'cpu', '2':'temp', '3':'mem', '4':'swap', '5':'net',
|
||||||
@ -185,8 +185,6 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
self.ptm['values']['hddtemp'] = {}
|
self.ptm['values']['hddtemp'] = {}
|
||||||
self.ptm['values']['mem'] = {'app':0.0, 'used':0.0, 'free':1.0}
|
self.ptm['values']['mem'] = {'app':0.0, 'used':0.0, 'free':1.0}
|
||||||
self.ptm['values']['net'] = {"up":0.0, "down":0.0}
|
self.ptm['values']['net'] = {"up":0.0, "down":0.0}
|
||||||
self.ptm['values']['player'] = {}
|
|
||||||
self.ptm['values']['ps'] = {'list':[], 'num':0}
|
|
||||||
self.ptm['values']['swap'] = {'used':0.0, 'free':1.0}
|
self.ptm['values']['swap'] = {'used':0.0, 'free':1.0}
|
||||||
self.ptm['values']['temp'] = {}
|
self.ptm['values']['temp'] = {}
|
||||||
# variables
|
# variables
|
||||||
@ -229,8 +227,6 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
self.memText()
|
self.memText()
|
||||||
if (self.ptm['vars']['bools']['net'] > 0):
|
if (self.ptm['vars']['bools']['net'] > 0):
|
||||||
self.netText()
|
self.netText()
|
||||||
if (self.ptm['vars']['bools']['ps'] > 0):
|
|
||||||
self.psText()
|
|
||||||
if (self.ptm['vars']['bools']['swap'] > 0):
|
if (self.ptm['vars']['bools']['swap'] > 0):
|
||||||
self.swapText()
|
self.swapText()
|
||||||
if (self.ptm['vars']['bools']['temp'] > 0):
|
if (self.ptm['vars']['bools']['temp'] > 0):
|
||||||
@ -254,15 +250,14 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
updatedData = self.dataengine.dataUpdated(str(sourceName), data, self.ptm)
|
updatedData = self.dataengine.dataUpdated(str(sourceName), data, self.ptm)
|
||||||
if (updatedData['value'] == None):
|
if (updatedData['value'] == None):
|
||||||
return
|
return
|
||||||
# update falues where is needed
|
# update values where is needed
|
||||||
if (updatedData['type'] != None):
|
if (updatedData['type'] != None):
|
||||||
self.ptm['values'][updatedData['name']][updatedData['type']] = updatedData['value']
|
self.ptm['values'][updatedData['name']][updatedData['type']] = updatedData['value']
|
||||||
else:
|
elif (updatedData['name'] in ['custom', 'gpu', 'gputemp', 'pkg', 'player', 'ps', 'time', 'uptime']):
|
||||||
self.ptm['values'][updatedData['name']] = updatedData['value']
|
|
||||||
# update labels where is needed
|
|
||||||
if (updatedData['name'] in ['custom', 'gpu', 'gputemp', 'player', 'time', 'uptime']):
|
|
||||||
text = self.textPrepare(updatedData['name'], updatedData['value'])
|
text = self.textPrepare(updatedData['name'], updatedData['value'])
|
||||||
self.setText(updatedData['name'], text)
|
self.setText(updatedData['name'], text)
|
||||||
|
else:
|
||||||
|
self.ptm['values'][updatedData['name']] = updatedData['value']
|
||||||
# update tooltips
|
# update tooltips
|
||||||
if ((updatedData['name'] in ['cpu', 'cpuclock', 'mem', 'swap', 'net']) and (self.ptm['vars']['bools'][updatedData['name']] == 2)):
|
if ((updatedData['name'] in ['cpu', 'cpuclock', 'mem', 'swap', 'net']) and (self.ptm['vars']['bools'][updatedData['name']] == 2)):
|
||||||
if (updatedData['name'] == "net"):
|
if (updatedData['name'] == "net"):
|
||||||
@ -420,16 +415,6 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
self.setText("net", text)
|
self.setText("net", text)
|
||||||
|
|
||||||
|
|
||||||
def psText(self):
|
|
||||||
"""function to set ps text"""
|
|
||||||
line = self.ptm['vars']['formats']['ps']
|
|
||||||
if (line.split('$pscount')[0] != 0):
|
|
||||||
ps = "%i" % (self.ptm['values']['ps']['num'])
|
|
||||||
line = line.split('$pscount')[0] + ps + line.split('$pscount')[1]
|
|
||||||
text = self.ptm['vars']['app']['format'][0] + line + self.ptm['vars']['app']['format'][1]
|
|
||||||
self.setText("ps", text)
|
|
||||||
|
|
||||||
|
|
||||||
def swapText(self):
|
def swapText(self):
|
||||||
"""function to set swap text"""
|
"""function to set swap text"""
|
||||||
line = self.ptm['vars']['formats']['swap']
|
line = self.ptm['vars']['formats']['swap']
|
||||||
@ -556,17 +541,30 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
elif (name == "gputemp"):
|
elif (name == "gputemp"):
|
||||||
if (line.split('$gputemp')[0] != line):
|
if (line.split('$gputemp')[0] != line):
|
||||||
line = line.split('$gputemp')[0] + text + line.split('$gputemp')[1]
|
line = line.split('$gputemp')[0] + text + line.split('$gputemp')[1]
|
||||||
|
elif (name == "pkg"):
|
||||||
|
for item in text.keys():
|
||||||
|
if (line.split('$' + item)[0] != line):
|
||||||
|
line = line.split('$' + item)[0] + text[item] + line.split('$' + item)[1]
|
||||||
elif (name == "player"):
|
elif (name == "player"):
|
||||||
if (line.split('$album')[0] != line):
|
if (line.split('$album')[0] != line):
|
||||||
line = line.split('$album')[0] + self.ptm['values']['player']['album'] + line.split('$album')[1]
|
line = line.split('$album')[0] + text['album'] + line.split('$album')[1]
|
||||||
if (line.split('$artist')[0] != line):
|
if (line.split('$artist')[0] != line):
|
||||||
line = line.split('$artist')[0] + self.ptm['values']['player']['artist'] + line.split('$artist')[1]
|
line = line.split('$artist')[0] + text['artist'] + line.split('$artist')[1]
|
||||||
if (line.split('$progress')[0] != line):
|
if (line.split('$progress')[0] != line):
|
||||||
line = line.split('$progress')[0] + self.ptm['values']['player']['progress'] + line.split('$progress')[1]
|
line = line.split('$progress')[0] + text['progress'] + line.split('$progress')[1]
|
||||||
if (line.split('$time')[0] != line):
|
if (line.split('$time')[0] != line):
|
||||||
line = line.split('$time')[0] + self.ptm['values']['player']['time'] + line.split('$time')[1]
|
line = line.split('$time')[0] + text['time'] + line.split('$time')[1]
|
||||||
if (line.split('$title')[0] != line):
|
if (line.split('$title')[0] != line):
|
||||||
line = line.split('$title')[0] + self.ptm['values']['player']['title'] + line.split('$title')[1]
|
line = line.split('$title')[0] + text['title'] + line.split('$title')[1]
|
||||||
|
elif (name == "ps"):
|
||||||
|
if (line.split('$pscount')[0] != line):
|
||||||
|
ps = "%i" % (text['num'])
|
||||||
|
line = line.split('$pscount')[0] + ps + line.split('$pscount')[1]
|
||||||
|
if (line.split('$pstotal')[0] != line):
|
||||||
|
ps = "%i" % (text['total'])
|
||||||
|
line = line.split('$pstotal')[0] + ps + line.split('$pstotal')[1]
|
||||||
|
if (line.split('$ps')[0] != line):
|
||||||
|
line = line.split('$ps')[0] + text['list'] + line.split('$ps')[1]
|
||||||
elif (name == "time"):
|
elif (name == "time"):
|
||||||
if (line.split('$time')[0] != line):
|
if (line.split('$time')[0] != line):
|
||||||
line = line.split('$time')[0] + text + line.split('$time')[1]
|
line = line.split('$time')[0] + text + line.split('$time')[1]
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-105</y>
|
||||||
<width>526</width>
|
<width>526</width>
|
||||||
<height>624</height>
|
<height>624</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -933,25 +933,19 @@ $title - song title</string>
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>PS</string>
|
<string>Processes</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="tristate">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_ps">
|
<widget class="QLineEdit" name="lineEdit_ps">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>$cpu - total load CPU, %
|
<string>$pscount - number of running processes
|
||||||
$cpu0 - load CPU for core 0, %
|
$pstotal - total number of running processes
|
||||||
...
|
$ps - list of running processes comma separated</string>
|
||||||
$cpu9 - load CPU for core 9, %
|
|
||||||
...
|
|
||||||
$cpuN - load CPU for core N, %</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
@ -1004,20 +998,12 @@ $cpuN - load CPU for core N, %</string>
|
|||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="tristate">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_pkg">
|
<widget class="QLineEdit" name="lineEdit_pkg">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>$cpu - total load CPU, %
|
<string>$pkgcountN - number of packages which are available for updates, command N. For example $pkgcount0</string>
|
||||||
$cpu0 - load CPU for core 0, %
|
|
||||||
...
|
|
||||||
$cpu9 - load CPU for core 9, %
|
|
||||||
...
|
|
||||||
$cpuN - load CPU for core N, %</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
@ -2329,6 +2315,33 @@ del - remove item</string>
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_customCommand">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_customCommand">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>120</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Custom command</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_customCommand">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Custom command to run</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_gpudev">
|
<layout class="QHBoxLayout" name="layout_gpudev">
|
||||||
<item>
|
<item>
|
||||||
@ -2490,78 +2503,116 @@ del - remove item</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_customCommand">
|
<layout class="QVBoxLayout" name="layout_pkgCommand">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_customCommand">
|
<layout class="QHBoxLayout" name="layout_pkgCommandSelect">
|
||||||
<property name="minimumSize">
|
<item>
|
||||||
<size>
|
<widget class="QLabel" name="label_pkgCommand">
|
||||||
<width>120</width>
|
<property name="minimumSize">
|
||||||
<height>0</height>
|
<size>
|
||||||
</size>
|
<width>120</width>
|
||||||
</property>
|
<height>0</height>
|
||||||
<property name="text">
|
</size>
|
||||||
<string>Custom command</string>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Package manager</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_pkgCommand">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>pacman -Qu</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>apt-show-versions -u -b</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>aptitude search '~U'</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>yum list updates</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>pkg_version -I -l '<'</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>urpmq --auto-select</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_customCommand">
|
<layout class="QHBoxLayout" name="layout_pkgCommandNum">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_pkgCommandNum">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>120</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Number of null lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_pkgCommandNum">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_pkgCommand">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Add</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget_pkgCommand">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Custom command to run</string>
|
<string>Editable
|
||||||
|
del - remove item</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_pkgCommand">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_pkgCommand">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>120</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Package manager</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_pkgCommand">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>pacman -Qu</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>apt-show-versions -u -b</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>aptitude search '~U'</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>yum list updates</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -2686,11 +2737,11 @@ del - remove item</string>
|
|||||||
<tabstop>comboBox_style</tabstop>
|
<tabstop>comboBox_style</tabstop>
|
||||||
<tabstop>spinBox_weight</tabstop>
|
<tabstop>spinBox_weight</tabstop>
|
||||||
<tabstop>scrollArea_dattaengine</tabstop>
|
<tabstop>scrollArea_dattaengine</tabstop>
|
||||||
|
<tabstop>lineEdit_customCommand</tabstop>
|
||||||
<tabstop>comboBox_gpudev</tabstop>
|
<tabstop>comboBox_gpudev</tabstop>
|
||||||
<tabstop>comboBox_hdddev</tabstop>
|
<tabstop>comboBox_hdddev</tabstop>
|
||||||
<tabstop>lineEdit_mpdaddress</tabstop>
|
<tabstop>lineEdit_mpdaddress</tabstop>
|
||||||
<tabstop>spinBox_mpdport</tabstop>
|
<tabstop>spinBox_mpdport</tabstop>
|
||||||
<tabstop>lineEdit_customCommand</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Loading…
Reference in New Issue
Block a user