Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

Commit

Permalink
fixed #41
Browse files Browse the repository at this point in the history
  • Loading branch information
maateen committed Apr 25, 2017
1 parent e8733cb commit 44e63a5
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 25 deletions.
42 changes: 30 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ sudo make install
```
That's all. **Battery Monitor Beta** is installed on your system.

### For Developers
Now you can automatically test **Battery Monitor** from Terminal:

```
python3 battery-monitor.py --test
```
Or, if you've already installed:

```
battery-monitor --test
```

## Configuration

Every time, you will start/restart your PC, it will run automatically in background. But as it's your first time, let's start it by yourself. Please, search for **Battery Monitor** launcher in your menu entries. Then simply click on it. You will get notified that **Battery Monitor** has started.
Expand Down Expand Up @@ -117,38 +129,44 @@ Please take a look at our [milestones](https://github.com/maateen/battery-monito

## Changelog

### v0.5.2

- [x] Fixed [issue #41](https://github.com/maateen/battery-monitor/issues/41)
- [x] Fixed [issue #42](https://github.com/maateen/battery-monitor/issues/42)
- Introduced a Test feature for developers.

### v0.5.1

- [x] Fixed [issue #35](https://github.com/maateen/battery-monitor/issues/35)
- [x] Fixed [issue #39](https://github.com/maateen/battery-monitor/issues/39)

### v0.5

- [x] Developing a GUI to manage the custom warning easily.
- [x] Minimizing CPU consumption.
- [x] Adding Makefile for easy installation and upgradation
- [x] Re-structuring the project
- [x] Developed a GUI to manage the custom warning easily.
- [x] Minimized CPU consumption.
- [x] Added Makefile for easy installation and upgradation.
- [x] Re-structured the project.
- [x] Support for Ubuntu 14.04, 16.04, 16.10 and 17.04 has been added.

### v0.4

- [x] Reformatting the code in a new style.
- [x] Optimizing the code in a way so that Battery Monitor consumes a little resource of your PC.
- [x] Reformatted the code in a new style.
- [x] Optimized the code in a way so that Battery Monitor consumes a little resource of your PC.

### v0.3

- [x] Fixed [issue #7](https://github.com/maateen/battery-monitor/issues/7), decreasing CPU consuming from 40% to below 0.7%
- [x] Fixed [issue #4](https://github.com/maateen/battery-monitor/issues/4), Adding warning at 30% battery life (temporary solution, will be replaced by a GUI in near future)
- [x] Fixed [issue #6](https://github.com/maateen/battery-monitor/issues/6), Adding an entry in dash.
- [x] Fixed [issue #7](https://github.com/maateen/battery-monitor/issues/7), decreased CPU consuming from 40% to below 0.7%
- [x] Fixed [issue #4](https://github.com/maateen/battery-monitor/issues/4), Added warning at 30% battery life (temporary solution, will be replaced by a GUI in near future).
- [x] Fixed [issue #6](https://github.com/maateen/battery-monitor/issues/6), Added an entry in dash.

### v0.2.1

- [x] Adding trusty support.
- [x] Added trusty support.

### v0.2

- [x] Adding **Critically Low Battery** warning when battery is below 10%.
- [x] Adding `ctrl+C` pressing support to stop the `battery-monitor` command on terminal.
- [x] Added **Critically Low Battery** warning when battery is below 10%.
- [x] Added `ctrl+C` pressing support to stop the `battery-monitor` command on terminal.

### v0.1

Expand Down
18 changes: 9 additions & 9 deletions battery-monitor-gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def __init__(self):
label1.set_justify(Gtk.Justification.LEFT)
label1.set_halign(Gtk.Align.START)
label1.set_hexpand(True)
label2 = Gtk.Label('First Custom Warning at')
label2 = Gtk.Label('Third Custom Warning at')
label2.set_justify(Gtk.Justification.LEFT)
label2.set_halign(Gtk.Align.START)
label2.set_hexpand(True)
label3 = Gtk.Label('Second Custom Warning at')
label3.set_justify(Gtk.Justification.LEFT)
label3.set_halign(Gtk.Align.START)
label3.set_hexpand(True)
label4 = Gtk.Label('Third Custom Warning at')
label4 = Gtk.Label('First Custom Warning at')
label4.set_justify(Gtk.Justification.LEFT)
label4.set_halign(Gtk.Align.START)
label4.set_hexpand(True)
Expand All @@ -59,14 +59,14 @@ def __init__(self):
self.entry1.set_text(str(self.low_battery))
self.entry1.set_tooltip_text('Set in percentage')
self.entry2 = Gtk.Entry()
self.entry2.set_text(str(self.first_custom_warning))
self.entry2.set_tooltip_text('Set in percentage')
self.entry2.set_text(str(self.third_custom_warning))
self.entry2.set_tooltip_text('Set in percentage, must be smaller than Other Warnings')
self.entry3 = Gtk.Entry()
self.entry3.set_text(str(self.second_custom_warning))
self.entry3.set_tooltip_text('Set in percentage')
self.entry3.set_tooltip_text('Set in percentage, , must be greater than Third Custom Warning')
self.entry4 = Gtk.Entry()
self.entry4.set_text(str(self.third_custom_warning))
self.entry4.set_tooltip_text('Set in percentage')
self.entry4.set_text(str(self.first_custom_warning))
self.entry4.set_tooltip_text('Set in percentage, must be greater than Second Custom Warning')
self.entry5 = Gtk.Entry()
self.entry5.set_text(str(self.notification_stability))
self.entry5.set_tooltip_text('Set in second')
Expand Down Expand Up @@ -122,9 +122,9 @@ def save_config(self, widget):
self.config['settings'] = {
'very_low_battery': self.entry0.get_text(),
'low_battery': self.entry1.get_text(),
'first_custom_warning': self.entry2.get_text(),
'third_custom_warning': self.entry2.get_text(),
'second_custom_warning': self.entry3.get_text(),
'third_custom_warning': self.entry4.get_text(),
'first_custom_warning': self.entry4.get_text(),
'notification_stability': self.entry5.get_text()
}
with open(self.config_file, 'w') as f:
Expand Down
8 changes: 4 additions & 4 deletions battery-monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,31 +149,31 @@ def show_specific_notifications(self, monitor):

return "very_low_battery"

elif percentage == self.low_battery:
elif percentage <= self.low_battery:
self.last_notification = "low_battery"
self.show_notification(type="low_battery",
battery_percentage=percentage,
remaining_time=remaining)

return "low_battery"

elif percentage == self.first_custom_warning:
elif percentage <= self.first_custom_warning:
self.last_notification = "first_custom_warning"
self.show_notification(type="first_custom_warning",
battery_percentage=percentage,
remaining_time=remaining)

return "first_custom_warning"

elif percentage == self.second_custom_warning:
elif percentage <= self.second_custom_warning:
self.last_notification = "second_custom_warning"
self.show_notification(type="second_custom_warning",
battery_percentage=percentage,
remaining_time=remaining)

return "second_custom_warning"

elif percentage == self.third_custom_warning:
elif percentage <= self.third_custom_warning:
self.last_notification = "third_custom_warning"
self.show_notification(type="third_custom_warning",
battery_percentage=percentage,
Expand Down
18 changes: 18 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"unknown": "not-charging.png",
"very_low_battery": "low-battery.png",
"low_battery": "low-battery.png",
"first_custom_warning": "discharging.png",
"second_custom_warning": "discharging.png",
"third_custom_warning": "discharging.png",
}

for key in ICONS:
Expand Down Expand Up @@ -57,5 +60,20 @@
u"Low Battery",
u"Now {battery_percentage} %, {remaining_time}"
),

"first_custom_warning": (
u"First Custom Warning",
u"Now {battery_percentage} %, {remaining_time}"
),

"second_custom_warning": (
u"Second Custom Warning",
u"Now {battery_percentage} %, {remaining_time}"
),

"third_custom_warning": (
u"Third Custom Warning",
u"Now {battery_percentage} %, {remaining_time}"
),
}

0 comments on commit 44e63a5

Please sign in to comment.