diff --git a/sources/ptm/contents/code/configdef.py b/sources/ptm/contents/code/configdef.py
index 9e7b4cd..7a62736 100644
--- a/sources/ptm/contents/code/configdef.py
+++ b/sources/ptm/contents/code/configdef.py
@@ -103,8 +103,9 @@ class ConfigDefinition:
try:
with open(dataengineConfig, 'w') as deConfigFile:
item = QStringList()
- for i in range(self.configpage['dataengine'].ui.listWidget_customCommand.count()):
- item.append(self.configpage['dataengine'].ui.listWidget_customCommand.item(i).text())
+ for i in range(self.configpage['dataengine'].ui.tableWidget_customCommand.count()):
+ if (self.configpage['dataengine'].ui.tableWidget_customCommand.item(i, 0) != None):
+ item.append(self.configpage['dataengine'].ui.tableWidget_customCommand.item(i, 0).text())
deConfigFile.write("CUSTOM=" + str(item.join(QString('@@'))) + "\n")
deConfigFile.write("DESKTOPCMD=" + str(self.configpage['dataengine'].ui.lineEdit_desktopCmd.text()) + "\n")
deConfigFile.write("GPUDEV=" + str(self.configpage['dataengine'].ui.comboBox_gpudev.currentText()) + "\n")
@@ -114,8 +115,10 @@ class ConfigDefinition:
deConfigFile.write("MPDPORT=" + str(self.configpage['dataengine'].ui.spinBox_mpdport.value()) + "\n")
deConfigFile.write("MPRIS=" + str(self.configpage['dataengine'].ui.comboBox_mpris.currentText()) + "\n")
item = QStringList()
- for i in range(self.configpage['dataengine'].ui.listWidget_pkgCommand.count()):
- item.append(self.configpage['dataengine'].ui.listWidget_pkgCommand.item(i).text())
+ for i in range(self.configpage['dataengine'].ui.tableWidget_pkgCommand.rowCount()):
+ if (self.configpage['dataengine'].ui.tableWidget_pkgCommand.item(i, 0) != None):
+ item.append(self.configpage['dataengine'].ui.tableWidget_pkgCommand.item(i, 0).text() + ":" +
+ self.configpage['dataengine'].ui.tableWidget_pkgCommand.item(i, 1).text())
pkgCmd = []
pkgNull = []
for command in item:
@@ -259,11 +262,18 @@ class ConfigDefinition:
deSettings[line.split('=')[0]] = line.split('=')[1][:-1]
except:
pass
- for item in deSettings['CUSTOM'].split('@@'):
- self.configpage['dataengine'].ui.listWidget_customCommand.addItem(item)
- index = self.configpage['dataengine'].ui.comboBox_gpudev.findText(deSettings['GPUDEV'])
+ self.configpage['dataengine'].ui.tableWidget_customCommand.clear()
+ self.configpage['dataengine'].ui.tableWidget_customCommand.setRowCount(len(deSettings['CUSTOM'].split('@@')))
+ headerList = QStringList()
+ headerList.append(i18n("Custom command"))
+ self.configpage['dataengine'].ui.tableWidget_customCommand.setHorizontalHeaderLabels(headerList)
+ self.configpage['dataengine'].ui.tableWidget_customCommand.horizontalHeader().setResizeMode(QHeaderView.Stretch)
+ for i in range(len(deSettings['CUSTOM'].split('@@'))):
+ self.configpage['dataengine'].ui.tableWidget_customCommand.setItem(i, 0, QTableWidgetItem(deSettings['CUSTOM'].split('@@')[i]))
self.configpage['dataengine'].ui.lineEdit_desktopCmd.setText(deSettings['DESKTOPCMD'])
+ index = self.configpage['dataengine'].ui.comboBox_gpudev.findText(deSettings['GPUDEV'])
self.configpage['dataengine'].ui.comboBox_gpudev.setCurrentIndex(index)
+ self.configpage['dataengine'].ui.comboBox_hdddev.clear()
self.configpage['dataengine'].ui.comboBox_hdddev.addItem("all")
self.configpage['dataengine'].ui.comboBox_hdddev.addItem("disable")
commandOut = commands.getoutput("find /dev -name '[hms]d[a-z]'")
@@ -280,13 +290,20 @@ class ConfigDefinition:
self.configpage['dataengine'].ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
self.configpage['dataengine'].ui.comboBox_mpris.addItem(deSettings['MPRIS'])
self.configpage['dataengine'].ui.comboBox_mpris.setCurrentIndex(self.configpage['dataengine'].ui.comboBox_mpris.count()-1)
- self.configpage['dataengine'].ui.listWidget_pkgCommand.clear()
+ self.configpage['dataengine'].ui.tableWidget_pkgCommand.clear()
+ self.configpage['dataengine'].ui.tableWidget_pkgCommand.setRowCount(len(deSettings['PKGCMD'].split(',')))
+ headerList = QStringList()
+ headerList.append(i18n("Package manager"))
+ headerList.append(i18n("Null lines"))
+ self.configpage['dataengine'].ui.tableWidget_pkgCommand.setHorizontalHeaderLabels(headerList)
+ self.configpage['dataengine'].ui.tableWidget_pkgCommand.horizontalHeader().setResizeMode(QHeaderView.Stretch)
for i in range(len(deSettings['PKGCMD'].split(','))):
try:
num = deSettings['PKGNULL'].split(',')[i]
except:
num = "0"
- self.configpage['dataengine'].ui.listWidget_pkgCommand.addItem(deSettings['PKGCMD'].split(',')[i] + ':' + num)
+ self.configpage['dataengine'].ui.tableWidget_pkgCommand.setItem(i, 0, QTableWidgetItem(deSettings['PKGCMD'].split(',')[i]))
+ self.configpage['dataengine'].ui.tableWidget_pkgCommand.setItem(i, 1, QTableWidgetItem(num))
index = self.configpage['dataengine'].ui.comboBox_playerSelect.findText(deSettings['PLAYER'])
self.configpage['dataengine'].ui.comboBox_playerSelect.setCurrentIndex(index)
diff --git a/sources/ptm/contents/code/deconfig.py b/sources/ptm/contents/code/deconfig.py
index 5c6d3d3..0cfc143 100644
--- a/sources/ptm/contents/code/deconfig.py
+++ b/sources/ptm/contents/code/deconfig.py
@@ -39,12 +39,10 @@ class DEConfigWindow(QWidget):
self.ui = uic.loadUi(parent.package().filePath('ui', 'deconfig.ui'), self)
self.parent = parent
- 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_customCommand, SIGNAL("itemActivated(QListWidgetItem*)"), self.ui.listWidget_customCommand.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)
+ QObject.connect(self.ui.tableWidget_customCommand, SIGNAL("itemActivated(QTableWidgetItem*)"), self.ui.tableWidget_customCommand.openPersistentEditor)
+ QObject.connect(self.ui.tableWidget_customCommand, SIGNAL("itemChanged(QTableWidgetItem*)"), self.addCustomCommand)
+ QObject.connect(self.ui.tableWidget_pkgCommand, SIGNAL("itemActivated(QTableWidgetItem*)"), self.ui.tableWidget_pkgCommand.openPersistentEditor)
+ QObject.connect(self.ui.tableWidget_pkgCommand, SIGNAL("itemChanged(QTableWidgetItem*)"), self.addPkgCommand)
def keyPressEvent(self, event):
@@ -52,43 +50,25 @@ class DEConfigWindow(QWidget):
if self.debug: qDebug("[PTM] [deconfig.py] [keyPressEvent]")
if self.debug: qDebug("[PTM] [deconfig.py] [keyPressEvent] : Run function with event '%s'" %(event.key()))
if (event.key() == Qt.Key_Delete):
- if (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())
+ if (self.ui.tableWidget_customCommand.hasFocus() and
+ (self.ui.tableWidget_customCommand.currentRow() > -1)):
+ self.ui.tableWidget_customCommand.removeRow(self.ui.tableWidget_customCommand.currentRow())
+ elif (self.ui.tableWidget_pkgCommand.hasFocus() and
+ (self.ui.tableWidget_pkgCommand.currentRow() > -1)):
+ self.ui.tableWidget_pkgCommand.removeRow(self.ui.tableWidget_pkgCommand.currentRow())
- def addCustomCommand(self):
+ def addCustomCommand(self, item):
"""function to add custom command"""
if self.debug: qDebug("[PTM] [deconfig.py] [addCustomCommand]")
- if self.debug: qDebug("[PTM] [deconfig.py] [addCustomCommand] : Cmd '%s'" %(self.ui.lineEdit_customCommand.text()))
- self.ui.listWidget_customCommand.clearSelection()
- self.ui.listWidget_customCommand.addItem(self.ui.lineEdit_customCommand.text())
+ if (item.row() == (self.ui.tableWidget_customCommand.rowCount() - 1)):
+ self.ui.tableWidget_customCommand.insertRow(self.ui.tableWidget_customCommand.rowCount());
- def addPkgCommand(self):
- """function to add package manager command"""
+ def addPkgCommand(self, item):
+ """function to add new row"""
if self.debug: qDebug("[PTM] [deconfig.py] [addPkgCommand]")
- if self.debug: qDebug("[PTM] [deconfig.py] [addPkgCommand] : Cmd '%s'" %(self.ui.comboBox_pkgCommand.currentText()))
- 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.debug: qDebug("[PTM] [deconfig.py] [updatePkgNullValue]")
- 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)
+ if ((item.row() == (self.ui.tableWidget_pkgCommand.rowCount() - 1)) and
+ (item.column() == 0)):
+ self.ui.tableWidget_pkgCommand.insertRow(self.ui.tableWidget_pkgCommand.rowCount());
+ self.ui.tableWidget_pkgCommand.setItem(self.ui.tableWidget_pkgCommand.rowCount()-1, 1, QTableWidgetItem("0"))
diff --git a/sources/ptm/contents/ui/advanced.ui b/sources/ptm/contents/ui/advanced.ui
index 3ca7142..9fbbed5 100644
--- a/sources/ptm/contents/ui/advanced.ui
+++ b/sources/ptm/contents/ui/advanced.ui
@@ -212,6 +212,21 @@ $m - uptime minutes without zero
Reaumur
+ -
+
+ cm^-1
+
+
+ -
+
+ kJ/mol
+
+
+ -
+
+ kcal/mol
+
+
@@ -258,8 +273,7 @@ $m - uptime minutes without zero
-
- Editable
-del - remove item
+ Editable
@@ -283,8 +297,7 @@ del - remove item
-
- Editable
-del - remove item
+ Editable
@@ -308,8 +321,7 @@ del - remove item
-
- Editable
-del - remove item
+ Editable
diff --git a/sources/ptm/contents/ui/deconfig.ui b/sources/ptm/contents/ui/deconfig.ui
index efd13fa..05a78c0 100644
--- a/sources/ptm/contents/ui/deconfig.ui
+++ b/sources/ptm/contents/ui/deconfig.ui
@@ -47,58 +47,62 @@
- -
-
+
-
+
-
-
-
-
-
-
-
- 200
- 0
-
-
-
- Custom command
-
-
-
- -
-
-
- Custom command to run
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 100
- 0
-
-
-
- Add
-
-
-
-
-
- -
-
-
- Editable
-del - remove item
+
+
+
+ 200
+ 0
+
+
+
+ Music player
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 0
+
+
+
-
+
+ mpris
+
+
+ -
+
+ mpd
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
-
-
@@ -288,177 +292,6 @@ del - remove item
- -
-
-
-
-
-
-
-
-
-
- 200
- 0
-
-
-
- Package manager
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- true
-
-
-
-
- pacman -Qu
-
-
- -
-
- apt-show-versions -u -b
-
-
- -
-
- aptitude search '~U'
-
-
- -
-
- yum list updates
-
-
- -
-
- pkg_version -I -l '<'
-
-
- -
-
- urpmq --auto-select
-
-
-
-
-
-
- -
-
-
-
-
-
-
- 200
- 0
-
-
-
- Number of null lines
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 100
- 0
-
-
-
- Add
-
-
-
-
-
- -
-
-
- Editable
-del - remove item
-
-
-
-
-
- -
-
-
-
-
-
-
- 200
- 0
-
-
-
- Music player
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 0
-
-
-
-
-
- mpris
-
-
- -
-
- mpd
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 657
-
-
-
-
-
-
@@ -573,6 +406,56 @@ del - remove item
+ -
+
+
-
+
+
+ Editable
+del - remove item
+
+
+ QAbstractItemView::SingleSelection
+
+
+ true
+
+
+ false
+
+
+
+ Package manager
+
+
+
+
+ Null lines
+
+
+
+
+
+
+ -
+
+
+ Editable
+del - remove item
+
+
+ true
+
+
+ false
+
+
+
+ Custom command
+
+
+
+
@@ -581,9 +464,7 @@ del - remove item
scrollArea_dattaengine
- lineEdit_customCommand
- pushButton_customCommand
- listWidget_customCommand
+ tableWidget_customCommand
lineEdit_desktopCmd
comboBox_gpudev
comboBox_hdddev
@@ -591,11 +472,8 @@ del - remove item
lineEdit_mpdaddress
spinBox_mpdport
comboBox_mpris
- comboBox_pkgCommand
- spinBox_pkgCommandNum
- pushButton_pkgCommand
- listWidget_pkgCommand
comboBox_playerSelect
+ tableWidget_pkgCommand