This repository has been archived on 2022-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
ztm/ztm.py
Arnas Udovicius a5f2f404b3 active tasks
2018-03-09 22:17:45 +02:00

99 lines
2.4 KiB
Python

import argparse
import sys
from pyfzf.pyfzf import FzfPrompt
from model import Model
from task import Task
from tag import Tag
from config import Config
from bcolors import bcolors
from params import Params
class Main:
def __init__(self):
self.model = Model()
self.task = Task()
self.tag = Tag()
self.config = Config()
self.params = Params()
self.fzf = FzfPrompt()
self.parser = argparse.ArgumentParser('ztm')
self.parser.add_argument('-c', '--current', dest='active', action='store_true')
self.parser.set_defaults(active=False)
def run(self):
n = self.parser.parse_args()
if n.active:
self.params.update('active', True)
print(bcolors.HEADER + '''
GEEEEEEEL .. :
,##############Wf.,;;L#K;;. ,W, .Et
........jW##Wt t#E t##, ,W#t
tW##Kt t#E L###, j###t
tW##E; t#E .E#j##, G#fE#t
tW##E; t#E ;WW; ##,:K#i E#t
.fW##D, t#E j#E. ##f#W, E#t
.f###D, t#E .D#L ###K: E#t
.f####Gfffffffffff; t#E :K#t ##D. E#t
.fLLLLLLLLLLLLLLLLLi fE ... #G ..
: j
Task manager from Zordsdavini (2018) ''' + bcolors.ENDC)
self.menu()
def menu(self):
menu = input(bcolors.OKBLUE + '~: ' + bcolors.OKGREEN + 'What you want to do? (?+/tcq) ' + bcolors.ENDC)
if menu == '?':
self.about()
elif menu == '+':
self.task.add()
self.menu()
elif menu == '/':
self.task.search()
self.menu()
elif menu == 't':
self.tag.manage_tag()
self.menu()
elif menu == 'c':
self.config.manage()
self.menu()
elif menu == 'q':
self.bye()
else:
print(bcolors.FAIL + 'This is not implemented...' + bcolors.ENDC)
self.menu()
def about(self):
print(bcolors.WARNING + '''
Short instruction
-----------------
? - help (this dialog)
+ - add
/ - search
t - tag manager
c - configuration
q - exit
''' + bcolors.ENDC)
self.menu()
def bye(self):
print(bcolors.FAIL + 'bye o/' + bcolors.ENDC)
sys.exit(0)
if __name__ == '__main__':
a = Main()
a.run()