Skip to content

Commit

Permalink
chg: user: try rounding a Decimal for timer status
Browse files Browse the repository at this point in the history
* also try out app icon in green instead of red

Signed-off-by: Stephen L Arnold <[email protected]>
  • Loading branch information
sarnold committed Aug 14, 2024
1 parent e2b4740 commit 2f8b05c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
15 changes: 10 additions & 5 deletions icons/hicolor/scalable/timew.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion scripts/timew-status-indicator
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import time
import typing
from collections import Counter
from datetime import timedelta
from decimal import Decimal
from threading import Thread
from typing import cast

Expand Down Expand Up @@ -210,7 +211,8 @@ class Indicator:

def reset_counter(self, source):
"""Reset the seat_time counter"""
seat_minutes = COUNT["SeatTick"] / 60
seat_time = COUNT["SeatTick"] / 60
seat_minutes = round(Decimal(seat_time), 1)
COUNT.clear()
msg = f'INFO: seat timer reset from {seat_minutes} to 0 min'
Notify.Notification.new("Timew status", msg, None).show()
Expand All @@ -227,6 +229,8 @@ class Indicator:

def statusd(self, source):
_, svc_msg = run_cmd()
seat_minutes = round(Decimal(COUNT["SeatTick"] / 60), 1)
svc_msg = f'INFO: current seat time is {seat_minutes} mins \n' + svc_msg
Notify.Notification.new("Timew status", svc_msg, None).show()

def stopd(self, source):
Expand Down
2 changes: 1 addition & 1 deletion src/timew_status/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def run_cmd(action='status', tag=None):
print(f'run_cmd {action} return code: {result.returncode}')
print(f'run_cmd {action} result msg: {result.stdout.decode().strip()}')

return result, result.stdout.decode().strip()
return result, result.stdout.decode()

except Exception as exc:
print(f'run_cmd exception: {exc}')
Expand Down

0 comments on commit 2f8b05c

Please sign in to comment.