Пример #1
0
# Create database if it does not exist
database_path = "data\pomodoros.db"
if not os.path.exists(database_path):
    print("Creating database ...")
    os.system("database.py")

conn = sqlite3.connect("data\pomodoros.db")
cursor = conn.cursor()

pomodoro = Pomodoro(cursor)

### Main loop
while True:
    # Show the categories available
    category_id = pomodoro.show_categories()
    project_id = pomodoro.show_projects(category_id)
    pomodoro_time = input("Add the length of the pomodoro in minutes: ")

    # call for the timer
    pomodoro.timer(minutes=pomodoro_time)

    # Rest timer
    pomodoro.timer(mode="rest")

    # Ask for satisfaction
    satisfaction = input("Type how well was your pomodoro. 1=Good - 2=Bad: ")

    # Add the pomodoro to the database
    pomodoro.add_pomodoro(pomodoro_time, category_id, project_id, satisfaction)
    conn.commit()