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

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)