diff --git a/Makefile b/Makefile index bb7e9f4..117f1e3 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ LOG_FILE := ./.venv/make_test.log ############# # ALL .PHONY: all -all: doc +all: todo ############### # Detect OS # diff --git a/script/todo/source_todo.sh b/script/todo/source_todo.sh new file mode 100755 index 0000000..6b6ab3b --- /dev/null +++ b/script/todo/source_todo.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +source .venv/bin/activate + +./script/todo/todo.py diff --git a/script/todo/todo.py b/script/todo/todo.py index 242b66d..b3d1513 100755 --- a/script/todo/todo.py +++ b/script/todo/todo.py @@ -4,13 +4,27 @@ import getpass import json import logging import os +import sys +import time import subprocess -import tkinter as tk -from tkinter import filedialog -import click -import openai -from pykeepass import PyKeePass +try: + import tkinter as tk + from tkinter import filedialog + + import click + import openai + from pykeepass import PyKeePass +except ModuleNotFoundError as e: + if os.path.exists(".venv"): + time.sleep(0.5) + subprocess.run( + "gnome-terminal -- bash -c './script/todo/source_todo.sh'", + shell=True, + executable="/bin/bash", + ) + print("You forgot to activate source \nsource ./.venv/bin/activate") + sys.exit(1) # TODO implement urwid to improve text user interface # import urwid