Skip to content

Commit

Permalink
v0.2.0 - split out functionality of 'sup' command into 'sup' and 'did…
Browse files Browse the repository at this point in the history
…', UI cleanup, 'nvm' and 'info' not implemented yet.
  • Loading branch information
tensorturtle committed Nov 24, 2024
1 parent 6ab66f0 commit a8dbe96
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
15 changes: 4 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
[project]
name = "fob"
version = "0.1.0"
version = "0.2.0"
description = "Focus Blocks: Simple and elegant daily time management tool."
readme = "README.md"
authors = [
{ name = "tensorturtle", email = "[email protected]" }
]
authors = [{ name = "tensorturtle", email = "[email protected]" }]
requires-python = ">=3.12"
dependencies = [
"rich>=13.9.4",
"tinydb>=4.8.2",
]
dependencies = ["rich>=13.9.4", "tinydb>=4.8.2"]

[project.scripts]
fob = "fob:main"

[tool.uv]
dev-dependencies = [
"nuitka>=2.4.11",
]
dev-dependencies = ["nuitka>=2.4.11"]
2 changes: 1 addition & 1 deletion src/fob/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def run_app():
type=str,
help="ID of the block to check off (int)",
)
subparsers.add_parser("nvm", help="Revise block assignment for today and change a non-Buffer block into a Buffer block, and mark that new Buffer block as complete."
subparsers.add_parser("nvm", help="Revise block assignment for today and change a non-Buffer block into a Buffer block, and mark that new Buffer block as complete.")
args = parser.parse_args()

command_func = None
Expand Down
1 change: 1 addition & 0 deletions src/fob/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from fob.commands.new_month import new_month
from fob.commands.reset import reset
from fob.commands.did import did
from fob.commands.nvm import nvm
18 changes: 6 additions & 12 deletions src/fob/commands/gm.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
from argparse import Namespace
from datetime import date
from calendar import monthrange

from rich.pretty import pprint, Pretty
from rich.pretty import Pretty
from rich import print
from rich.layout import Layout
from rich.panel import Panel
from rich.progress import Progress, TextColumn, BarColumn, TaskProgressColumn, ProgressColumn
from rich.console import Console, Group
from rich.rule import Rule
from rich.prompt import Prompt
from rich.text import Text
from tinydb import where, Query

from fob.db import MonthBlockData, TinyDBWrapper, checklist_complete
from fob.db import TinyDBWrapper, checklist_complete
from fob.commands.overviews import month_overview, display_checklist

class InvalidUserInput(Exception):
Expand All @@ -36,7 +30,7 @@ def gm(args: Namespace, db: TinyDBWrapper) -> None:
print("In the meantime, consider running [bold][cyan]fob reset[/cyan][/bold].")
return

print(f"Good morning! \N{SUNRISE}")
print("Good morning! \N{SUNRISE}")
month_overview(args, db)
try:
new_day(args, db, data[0]) # can raise InvalidUserInput
Expand Down Expand Up @@ -94,11 +88,11 @@ def new_day(args: Namespace, db: TinyDBWrapper, data) -> None:
blocks_assigned = int(Prompt.ask(f"({blocks_per_day - blocks_remaining_to_assign + 1}/{blocks_per_day}) How many blocks for [bold]{area_name}[/bold]? (max: [bold][cyan]{max_blocks}[/bold][/cyan])", default=0))

if blocks_assigned > blocks_remaining_to_assign:
print(f"[red][bold]Error![/red] You have assigned more blocks than you have available today. Please try again.")
print("[red][bold]Error![/red] You have assigned more blocks than you have available today. Please try again.")
raise InvalidUserInput

if blocks_assigned > blocks['allocated'] - blocks['completed']:
print(f"[red][bold]Error![/red][/bold] You have assigned more blocks than are remaining in this area. Please try again.")
print("[red][bold]Error![/red][/bold] You have assigned more blocks than are remaining in this area. Please try again.")
raise InvalidUserInput

blocks_remaining_to_assign -= blocks_assigned
Expand All @@ -110,7 +104,7 @@ def new_day(args: Namespace, db: TinyDBWrapper, data) -> None:
today_areas[area_name] = blocks_assigned

if blocks_remaining_to_assign > 0:
print(f"[red][bold]Error![/red][/bold] You have not assigned all your blocks. Please try again.")
print("[red][bold]Error![/red][/bold] You have not assigned all your blocks. Please try again.")
raise InvalidUserInput

if args.debug:
Expand Down
14 changes: 14 additions & 0 deletions src/fob/commands/info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from argparse import Namespace

from fob.db.wrapper import TinyDBWrapper


def info(args: Namespace, db: TinyDBWrapper):
'''
'info' command displays basic metadata about this program.
+ Version
+ Author
+ License
'''
raise NotImplementedError("This command has not been implemented yet.")
3 changes: 1 addition & 2 deletions src/fob/commands/new_month.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import date, time
from datetime import date
from calendar import monthrange
from argparse import Namespace
from dataclasses import dataclass

from rich.prompt import Prompt
from rich import print
Expand Down
2 changes: 1 addition & 1 deletion src/fob/commands/overviews/day_checklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def display_checklist(args: Namespace, db: TinyDBWrapper) -> None:
try:
checklist = db.all()[0]['checklist']
except KeyError:
except (IndexError, KeyError):
print("[red][bold]No day data found.[/red][/bold]")
print("Run [cyan][bold]fob gm[/cyan][/bold] to start a new day.")
return
Expand Down
5 changes: 2 additions & 3 deletions src/fob/commands/overviews/month_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from calendar import monthrange

from tinydb import where
from rich.pretty import pprint
from rich.console import Console, Group
from rich.panel import Panel
from rich.progress import Progress, BarColumn, TaskProgressColumn, TextColumn, ProgressColumn
Expand Down Expand Up @@ -49,10 +48,10 @@ def month_overview(args: Namespace, db: TinyDBWrapper) -> None:
days_in_month = monthrange(today.year, today.month)[1]

with m_progress:
task = m_progress.add_task(f"Month", total=days_in_month)
task = m_progress.add_task("Month", total=days_in_month)
m_progress.update(task, completed=today.day)

task = m_progress.add_task(f"Work Days", total=data['work_days_allocated'])
task = m_progress.add_task("Work Days", total=data['work_days_allocated'])
m_progress.update(task, completed=data['work_days_completed'])

with progress:
Expand Down
2 changes: 1 addition & 1 deletion src/fob/commands/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def reset(args: Namespace, db: TinyDBWrapper) -> None:
print(f"[red bold]Warning![/red bold] This will delete the database at the default path.")
print("[red bold]Warning![/red bold] This will delete the database at the default path.")
if Prompt.ask("Are you sure?", choices=["yes", "no"], default="no") == "no":
print("Reset cancelled.")
return
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a8dbe96

Please sign in to comment.