New release 1.2.1

widget:
  * added checking verification of existences battery and ac
This commit is contained in:
arcan1s 2013-03-01 01:13:14 +04:00
parent e37a5b40f8
commit 7ae496155c
8 changed files with 14 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -511,17 +511,23 @@ class pyTextWidget(plasmascript.Applet):
"""function to set battery text"""
line = self.batFormat
if (line.split('$bat')[0] != line):
with open (self.battery_device, 'r') as bat_file:
bat = bat_file.readline().split('\n')[0]
if os.path.exists(self.battery_device):
with open (self.battery_device, 'r') as bat_file:
bat = bat_file.readline().split('\n')[0]
else:
bat = 'off'
bat = "%3s" % (bat)
line = line.split('$bat')[0] + bat + line.split('$bat')[1]
if (line.split('$ac')[0] != line):
with open (self.ac_device, 'r') as bat_file:
bat = bat_file.readline().split('\n')[0]
if (bat == '1'):
bat = '(*)'
if os.path.exists(self.ac_device):
with open (self.ac_device, 'r') as bat_file:
bat = bat_file.readline().split('\n')[0]
if (bat == '1'):
bat = '(*)'
else:
bat = '( )'
else:
bat = '( )'
bat = '(?)'
line = line.split('$ac')[0] + bat + line.split('$ac')[1]
text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1]
self.label_bat.setText(text)

View File

@ -9,7 +9,7 @@ X-Plasma-MainScript=code/main.py
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.2.0
X-KDE-PluginInfo-Version=1.2.1
X-KDE-PluginInfo-Website=http://kde-look.org/
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends=