You are not logged in.

#1 2011-09-09 11:56:39

PSW
Member
From: Brighton
Registered: 2011-06-15
Posts: 32

PyBttry - Battery Monitor With SysTray Icon

Since the LXDE Battery Monitor is buggy and next to useless I wrote a replacement for myself to use. Hopefully someone else can make use of it.

Features:

  • Simple interface to show battery level.

  • SysTray Icon to show charge level.

  • Configurable colors. (~/.config/pybttry/settings)

Planned Features:

  • Warn user when low battery.

  • More configuration options.

Known Bugs:

  • Opening from Application Menu doesn't always show SysTray Icon correctly.

  • Text Color isn't configurable.

Download:
https://github.com/Peter-W/PyBttry

Installation:

pacman -S wxpython acpi
cd PyBttry
./INSTALL

Depending on how your have Python setup, you might need to edit /usr/bin/pybttry to use "python2" rather than "python".

Last edited by PSW (2011-09-09 12:03:07)

Offline

#2 2011-09-09 13:11:11

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: PyBttry - Battery Monitor With SysTray Icon

Could you supply a screenshot please? Also, a PKGBUILD would be better I guess.

Other than that, it sounds interesting and I might replace batti which I currently use!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#3 2011-09-11 11:54:12

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: PyBttry - Battery Monitor With SysTray Icon

I'm getting an error when I try to run PyBttry:

┌─[jente@lappy pybttry][13:52:43] 
└─■ pybttry
  File "/usr/share/pybttry/PyBttry.py", line 98
    print commands.getoutput("acpi -b")
                 ^
SyntaxError: invalid syntax

If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#4 2011-09-12 05:48:00

PSW
Member
From: Brighton
Registered: 2011-06-15
Posts: 32

Re: PyBttry - Battery Monitor With SysTray Icon

Unia wrote:

I'm getting an error when I try to run PyBttry:

┌─[jente@lappy pybttry][13:52:43] 
└─■ pybttry
  File "/usr/share/pybttry/PyBttry.py", line 98
    print commands.getoutput("acpi -b")
                 ^
SyntaxError: invalid syntax

What version of Python are you running?

Offline

#5 2011-09-12 15:06:00

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: PyBttry - Battery Monitor With SysTray Icon

┌─[jente@lappy ~][17:05:01] 
└─■ python --version
Python 3.2.2

Is that the correct one? System is fully up to date


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#6 2011-09-12 16:09:28

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: PyBttry - Battery Monitor With SysTray Icon

print output is python 2.x

In python 3.x, print is a function call. e.g. print( output )

A long shot, but try changing the line to:

print (commands.getoutput("acpi -b"))

Last edited by Earnestly (2011-09-12 16:26:20)

Offline

#7 2011-09-12 16:36:51

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: PyBttry - Battery Monitor With SysTray Icon

When I do that, it says this:

┌─[jente@lappy ~][18:35:57] 
└─■ pybttry
Traceback (most recent call last):
  File "/usr/share/pybttry/PyBttry.py", line 1, in <module>
    import wx, commands, sys
ImportError: No module named wx

I do have wxpython installed:

┌─[jente@lappy ~][18:35:59] 
└─■ pacman -Qs wxpython
local/wxpython 2.8.12.1-1
    A wxWidgets GUI toolkit for Python

If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#8 2011-09-12 16:48:25

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: PyBttry - Battery Monitor With SysTray Icon

Ah, that'd be because wxWidgets isn't supported in python3 yet (afaik) http://stackoverflow.com/questions/7208 … r-python-3

It is entirely possible to install python 2.7 and change the pybttry bash script to

#!/bin/bash
python2.7 /usr/share/pybttry/PyBttry.py

Last edited by Earnestly (2011-09-12 16:50:41)

Offline

#9 2011-09-12 16:50:15

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: PyBttry - Battery Monitor With SysTray Icon

^ I had python2 already installed, dependency of wxpython I guess. Anyway, didn't think of running it like that.
However, it now doesn't open in the tray but in a standalone window...

Last edited by Unia (2011-09-12 16:51:53)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

Board footer

Powered by FluxBB