diff --git a/PKGBUILD b/PKGBUILD index 468ef20..5422953 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,7 +3,7 @@ pkgname=kdeplasma-applets-pytextmonitor _pkgname=py-text-monitor -pkgver=1.5.0 +pkgver=1.5.1 pkgrel=1 _dtengine=ext-sysmon _dtver=1.3 @@ -22,7 +22,7 @@ makedepends=('automoc4' 'cmake') source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}.plasmoid https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_dtengine}-${_dtver}.zip) install=${pkgname}.install -md5sums=('df8e9f6df8e7b3caee3a502315756d81' +md5sums=('3ef9536493e48cd460ee3f37faa8cf58' 'f7fce53d5f616891b30beac1afd99728') build () diff --git a/py-text-monitor-1.5.0.plasmoid b/py-text-monitor-1.5.0.plasmoid deleted file mode 100644 index b30895e..0000000 Binary files a/py-text-monitor-1.5.0.plasmoid and /dev/null differ diff --git a/py-text-monitor-1.5.1.plasmoid b/py-text-monitor-1.5.1.plasmoid new file mode 100644 index 0000000..79b1ece Binary files /dev/null and b/py-text-monitor-1.5.1.plasmoid differ diff --git a/screenshots/config.png b/screenshots/config.png index d157685..869b9e1 100644 Binary files a/screenshots/config.png and b/screenshots/config.png differ diff --git a/sources/contents/code/configdef.py b/sources/contents/code/configdef.py index e8d8caa..04bc560 100644 --- a/sources/contents/code/configdef.py +++ b/sources/contents/code/configdef.py @@ -134,10 +134,15 @@ class ConfigDefinition: self.parent.label_bat.setText('') self.parent.layout.removeItem(self.parent.label_bat) if (self.parent.playerBool > 0): + self.parent.extsysmon.disconnectSource("player", self.parent) self.parent.label_player.setText('') self.parent.layout.removeItem(self.parent.label_player) + if (self.parent.timeBool > 0): + self.parent.timemon.disconnectSource("Local", self.parent) + self.parent.label_time.setText('') + self.parent.layout.removeItem(self.parent.label_time) - self.parent.label_order = "-------------" + self.parent.label_order = "--------------" for label in self.parent.dict_orders.keys(): exec ('self.parent.' + self.parent.dict_orders[label] + 'Bool = ' + str(self.configpage.checkboxes[self.parent.dict_orders[label]].checkState())) diff --git a/sources/contents/code/configwindow.py b/sources/contents/code/configwindow.py index 15e36d6..9d62a2c 100644 --- a/sources/contents/code/configwindow.py +++ b/sources/contents/code/configwindow.py @@ -36,21 +36,21 @@ class ConfigWindow(QWidget): 'hddtemp':self.ui.checkBox_hddTemp, 'mem':self.ui.checkBox_mem, 'net':self.ui.checkBox_net, 'swap':self.ui.checkBox_swap, 'temp':self.ui.checkBox_temp, 'uptime':self.ui.checkBox_uptime, - 'player':self.ui.checkBox_player} + 'player':self.ui.checkBox_player, 'time':self.ui.checkBox_time} self.sliders = {'bat':self.ui.slider_bat, 'cpu':self.ui.slider_cpu, 'cpuclock':self.ui.slider_cpuclock, 'gpu':self.ui.slider_gpu, 'gputemp':self.ui.slider_gpuTemp, 'hdd':self.ui.slider_hdd, 'hddtemp':self.ui.slider_hddTemp, 'mem':self.ui.slider_mem, 'net':self.ui.slider_net, 'swap':self.ui.slider_swap, 'temp':self.ui.slider_temp, 'uptime':self.ui.slider_uptime, - 'player':self.ui.slider_player} + 'player':self.ui.slider_player, 'time':self.ui.slider_time} self.lineedits = {'bat':self.ui.lineEdit_bat, 'cpu':self.ui.lineEdit_cpu, 'cpuclock':self.ui.lineEdit_cpuclock, 'gpu':self.ui.lineEdit_gpu, 'gputemp':self.ui.lineEdit_gpuTemp, 'hdd':self.ui.lineEdit_hdd, 'hddtemp':self.ui.lineEdit_hddTemp, 'mem':self.ui.lineEdit_mem, 'net':self.ui.lineEdit_net, 'swap':self.ui.lineEdit_swap, 'temp':self.ui.lineEdit_temp, 'uptime':self.ui.lineEdit_uptime, - 'player':self.ui.lineEdit_player} + 'player':self.ui.lineEdit_player, 'time':self.ui.lineEdit_time} for item in self.checkboxes.values(): QObject.connect(item, SIGNAL("stateChanged(int)"), self.setStatus) diff --git a/sources/contents/code/dataengine.py b/sources/contents/code/dataengine.py index 8f5e924..ff18acc 100644 --- a/sources/contents/code/dataengine.py +++ b/sources/contents/code/dataengine.py @@ -35,6 +35,10 @@ class DataEngine: if ((self.parent.gputempBool > 0) or (self.parent.gpuBool > 0) or (self.parent.hddtempBool > 0) or (self.parent.playerBool > 0)): self.parent.extsysmon = self.parent.dataEngine("ext-sysmon") + if (self.parent.timeBool > 0): + self.parent.timemon = self.parent.dataEngine("time") + self.parent.timemon.connectSource("Local", self.parent, 1000) + if (self.parent.uptimeBool > 0): self.parent.systemmonitor.connectSource("system/uptime", self.parent, self.parent.interval) if (self.parent.cpuBool > 0): @@ -270,8 +274,15 @@ class DataEngine: line = line.split('$title')[0] + title + line.split('$title')[1] text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] self.parent.label_player.setText(text) - - + elif (sourceName == "Local"): + value = str(data[QString(u'DateTime')].toString().toUtf8()) + if (self.parent.timeFormat.split('$time')[0] != self.parent.timeFormat): + line = self.parent.timeFormat.split('$time')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$time')[1] + else: + line = self.parent.timeFormat + text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] + self.parent.label_time.setText(text) + self.parent.update() except: pass diff --git a/sources/contents/code/main.py b/sources/contents/code/main.py index f5a2b8e..74309cb 100644 --- a/sources/contents/code/main.py +++ b/sources/contents/code/main.py @@ -120,14 +120,14 @@ class pyTextWidget(plasmascript.Applet): # create dictionaries self.dict_orders = {'6':'bat', '1':'cpu', '7':'cpuclock', '9':'gpu', 'a':'gputemp', 'b':'hdd', 'c':'hddtemp', '3':'mem', '5':'net', '4':'swap', '2':'temp', '8':'uptime', - 'd':'player'} + 'd':'player', 'e':'time'} self.dict_defFormat = {'bat':'[bat: $bat%$ac]', 'cpu':'[cpu: $cpu%]', 'cpuclock':'[mhz: $cpucl]', 'gpu':'[gpu: $gpu%]', 'gputemp':'[gpu temp: $gputemp°C]', 'hdd':'[hdd: @@/@@%]', 'hddtemp':'[hdd temp: @@/dev/sda@@°C]', 'mem':'[mem: $mem%]', 'net':'[$netdev: $netKB/s]', 'swap':'[swap: $swap%]', 'temp':'[temp: $temp°C]', 'uptime':'[uptime: $uptime]', - 'player':'[$artist - $title]'} + 'player':'[$artist - $title]', 'time':'[$time]'} def showConfigurationInterface(self): """function to show configuration window""" diff --git a/sources/contents/code/ptmnotify.py b/sources/contents/code/ptmnotify.py index ba980c7..b7f854f 100644 --- a/sources/contents/code/ptmnotify.py +++ b/sources/contents/code/ptmnotify.py @@ -180,6 +180,12 @@ class PTMNotify: def initText(self, sender): """function to send text""" + try: + if (sender == self.parent.parent.label_time): + content = self.createText("system") + return content + except: + pass try: if (sender == self.parent.parent.label_uptime): content = self.createText("system") diff --git a/sources/contents/code/reinit.py b/sources/contents/code/reinit.py index 83aee8c..3030cbe 100644 --- a/sources/contents/code/reinit.py +++ b/sources/contents/code/reinit.py @@ -307,6 +307,17 @@ class Reinit(): text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] self.parent.label_player.setText(text) self.parent.layout.addItem(self.parent.label_player) + elif (order == "e"): + if (self.parent.timeBool > 0): + self.parent.timeFormat = str(settings.get('timeFormat', '[$time]')) + self.parent.label_time = NewPlasmaLabel(self.parent.applet, self.parent) + if (self.parent.timeFormat.split('$time')[0] != self.parent.timeFormat): + line = self.parent.timeFormat.split('$time')[0] + '----------------------' + self.parent.timeFormat.split('$time')[1] + else: + line = self.parent.timeFormat + text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] + self.parent.label_time.setText(text) + self.parent.layout.addItem(self.parent.label_time) if not confAccept: self.parent.applet.setLayout(self.parent.layout) self.parent.theme = Plasma.Svg(self.parent) diff --git a/sources/contents/ui/configwindow.ui b/sources/contents/ui/configwindow.ui index 62c6973..f30b213 100644 --- a/sources/contents/ui/configwindow.ui +++ b/sources/contents/ui/configwindow.ui @@ -7,7 +7,7 @@ 0 0 575 - 530 + 561 @@ -42,6 +42,61 @@ Widget settings + + + + + + + 120 + 0 + + + + Time + + + true + + + + + + + $time - time + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 120 + 16777215 + + + + 1 + + + 14 + + + 1 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + @@ -82,11 +137,14 @@ 1 - 13 + 14 1 + + 2 + Qt::Horizontal @@ -138,13 +196,13 @@ $ccpu - load CPU for each core, % 1 - 13 + 14 1 - 2 + 3 Qt::Horizontal @@ -197,13 +255,13 @@ $ccpucl - CPU clock for each core, MHz 1 - 13 + 14 1 - 3 + 4 Qt::Horizontal @@ -268,13 +326,13 @@ $ccpucl - CPU clock for each core, MHz 1 - 13 + 14 1 - 4 + 5 Qt::Horizontal @@ -326,13 +384,13 @@ $ccpucl - CPU clock for each core, MHz 1 - 13 + 14 1 - 5 + 6 Qt::Horizontal @@ -384,13 +442,13 @@ $ccpucl - CPU clock for each core, MHz 1 - 13 + 14 1 - 6 + 7 Qt::Horizontal @@ -443,13 +501,13 @@ $memmb - RAM usage, MB 1 - 13 + 14 1 - 7 + 8 Qt::Horizontal @@ -502,13 +560,13 @@ $swapmb - swap usage, MB 1 - 13 + 14 1 - 8 + 9 Qt::Horizontal @@ -560,13 +618,13 @@ $swapmb - swap usage, MB 1 - 13 + 14 1 - 9 + 10 Qt::Horizontal @@ -618,13 +676,13 @@ $swapmb - swap usage, MB 1 - 13 + 14 1 - 10 + 11 Qt::Horizontal @@ -678,13 +736,13 @@ $netdev - current network device 1 - 13 + 14 1 - 11 + 12 Qt::Horizontal @@ -737,13 +795,13 @@ $ac - AC status 1 - 13 + 14 1 - 12 + 13 Qt::Horizontal @@ -907,13 +965,13 @@ $artist - song artist 1 - 13 + 14 1 - 13 + 14 Qt::Horizontal @@ -1268,6 +1326,9 @@ $artist - song artist tabWidget + checkBox_time + lineEdit_time + slider_time checkBox_uptime lineEdit_uptime slider_uptime diff --git a/sources/metadata.desktop b/sources/metadata.desktop index 6af43e4..27ed95a 100644 --- a/sources/metadata.desktop +++ b/sources/metadata.desktop @@ -12,7 +12,7 @@ X-Plasma-RequiredExtensions=LaunchApp,LocalIO,FileDialog X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Name=py-text-monitor -X-KDE-PluginInfo-Version=1.5.0 +X-KDE-PluginInfo-Version=1.5.1 X-KDE-PluginInfo-Website=http://kde-look.org/ X-KDE-PluginInfo-Category=System Information X-KDE-PluginInfo-Depends=