mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-15 22:59:57 +00:00
prepare to add support of several custom command
This commit is contained in:
@ -80,8 +80,11 @@ class ConfigDefinition:
|
||||
|
||||
dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf"
|
||||
try:
|
||||
item = QStringList()
|
||||
for i in range(self.configpage.ui.listWidget_customCommand.count()):
|
||||
item.append(self.configpage.ui.listWidget_customCommand.item(i).text())
|
||||
with open(dataengineConfig, 'w') as deConfigFile:
|
||||
deConfigFile.write("CUSTOM=" + str(self.configpage.ui.lineEdit_customCommand.text()) + "\n")
|
||||
deConfigFile.write("CUSTOM=" + str(item.join(QString('@@'))) + "\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("MPDADDRESS=" + str(self.configpage.ui.lineEdit_mpdaddress.text()) + "\n")
|
||||
@ -209,7 +212,8 @@ class ConfigDefinition:
|
||||
deSettings[line.split('=')[0]] = line.split('=')[1][:-1]
|
||||
except:
|
||||
pass
|
||||
self.configpage.ui.lineEdit_customCommand.setText(deSettings['CUSTOM'])
|
||||
for item in deSettings['CUSTOM'].split('@@'):
|
||||
self.configpage.ui.listWidget_customCommand.addItem(item)
|
||||
index = self.configpage.ui.comboBox_gpudev.findText(deSettings['GPUDEV'])
|
||||
self.configpage.ui.comboBox_gpudev.setCurrentIndex(index)
|
||||
self.configpage.ui.comboBox_hdddev.addItem("all")
|
||||
|
@ -67,6 +67,7 @@ class ConfigWindow(QWidget):
|
||||
QObject.connect(self.ui.pushButton_hddSpeedDevice, SIGNAL("clicked()"), self.addHddSpeedDevice)
|
||||
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_customCommand, SIGNAL("clicked()"), self.addCustomCommand)
|
||||
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_mount, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_mount.openPersistentEditor)
|
||||
@ -95,6 +96,9 @@ class ConfigWindow(QWidget):
|
||||
elif (self.ui.listWidget_tempDevice.hasFocus() and
|
||||
(self.ui.listWidget_tempDevice.currentRow() > -1)):
|
||||
self.ui.listWidget_tempDevice.takeItem(self.ui.listWidget_tempDevice.currentRow())
|
||||
elif (self.ui.listWidget_customCommand.hasFocus() and
|
||||
(self.ui.listWidget_customCommand.currentRow() > -1)):
|
||||
self.ui.listWidget_customCommand.takeItem(self.ui.listWidget_customCommand.currentRow())
|
||||
elif (self.ui.listWidget_pkgCommand.hasFocus() and
|
||||
(self.ui.listWidget_pkgCommand.currentRow() > -1)):
|
||||
self.ui.listWidget_pkgCommand.takeItem(self.ui.listWidget_pkgCommand.currentRow())
|
||||
@ -124,6 +128,12 @@ class ConfigWindow(QWidget):
|
||||
self.ui.listWidget_tempDevice.addItem(self.ui.comboBox_tempDevice.currentText())
|
||||
|
||||
|
||||
def addCustomCommand(self):
|
||||
"""function to add custom command"""
|
||||
self.ui.listWidget_customCommand.clearSelection()
|
||||
self.ui.listWidget_customCommand.addItem(self.ui.lineEdit_customCommand.text())
|
||||
|
||||
|
||||
def addPkgCommand(self):
|
||||
"""function to add package manager command"""
|
||||
self.ui.listWidget_pkgCommand.clearSelection()
|
||||
|
@ -1120,7 +1120,7 @@ $ps - list of running processes comma separated</string>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_custom">
|
||||
<property name="toolTip">
|
||||
<string>$custom - get output from custom command</string>
|
||||
<string>$customN - get output from custom command N (from N). Example `$custom0`</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@ -1808,8 +1808,8 @@ del - remove item</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>326</width>
|
||||
<height>227</height>
|
||||
<width>544</width>
|
||||
<height>504</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@ -2142,8 +2142,8 @@ del - remove item</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>326</width>
|
||||
<height>190</height>
|
||||
<width>544</width>
|
||||
<height>540</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
@ -2476,33 +2476,58 @@ del - remove item</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>326</width>
|
||||
<height>302</height>
|
||||
<width>544</width>
|
||||
<height>540</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_customCommand">
|
||||
<layout class="QVBoxLayout" name="layout_customCmd">
|
||||
<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>
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_customCommand">
|
||||
<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="QLineEdit" name="lineEdit_customCommand">
|
||||
<widget class="QListWidget" name="listWidget_customCommand">
|
||||
<property name="toolTip">
|
||||
<string>Custom command to run</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<string>Editable
|
||||
del - remove item</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -2911,6 +2936,8 @@ del - remove item</string>
|
||||
<tabstop>spinBox_weight</tabstop>
|
||||
<tabstop>scrollArea_dattaengine</tabstop>
|
||||
<tabstop>lineEdit_customCommand</tabstop>
|
||||
<tabstop>pushButton_customCommand</tabstop>
|
||||
<tabstop>listWidget_customCommand</tabstop>
|
||||
<tabstop>comboBox_gpudev</tabstop>
|
||||
<tabstop>comboBox_hdddev</tabstop>
|
||||
<tabstop>lineEdit_mpdaddress</tabstop>
|
||||
|
Reference in New Issue
Block a user