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

102 lines
2.5 KiB
Python
Raw Normal View History

2019-01-06 21:13:15 +00:00
#!/usr/bin/env python
2018-03-09 20:17:45 +00:00
import argparse
2018-02-14 15:16:03 +00:00
import sys
2018-02-14 23:34:54 +00:00
from pyfzf.pyfzf import FzfPrompt
2018-02-13 09:19:09 +00:00
2018-02-14 15:16:03 +00:00
from model import Model
2018-02-16 05:31:30 +00:00
from task import Task
from tag import Tag
from config import Config
2018-02-14 15:16:03 +00:00
from bcolors import bcolors
2018-03-09 20:17:45 +00:00
from params import Params
2018-02-13 09:19:09 +00:00
2018-02-14 15:16:03 +00:00
class Main:
def __init__(self):
self.model = Model()
2018-02-16 05:31:30 +00:00
self.task = Task()
self.tag = Tag()
self.config = Config()
2018-03-09 20:17:45 +00:00
self.params = Params()
2018-02-14 23:34:54 +00:00
self.fzf = FzfPrompt()
2018-02-14 15:16:03 +00:00
2018-03-09 20:17:45 +00:00
self.parser = argparse.ArgumentParser('ztm')
self.parser.add_argument('-c', '--current', dest='active', action='store_true')
self.parser.set_defaults(active=False)
2018-02-14 15:16:03 +00:00
def run(self):
2018-03-09 20:17:45 +00:00
n = self.parser.parse_args()
if n.active:
self.params.update('active', True)
2018-02-14 23:34:54 +00:00
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
2018-02-14 15:16:03 +00:00
Task manager from Zordsdavini (2018) ''' + bcolors.ENDC)
2018-02-14 15:16:03 +00:00
self.menu()
def menu(self):
2018-02-16 09:16:29 +00:00
menu = input(bcolors.OKBLUE + '~: ' + bcolors.OKGREEN + 'What you want to do? (?+/tcq) ' + bcolors.ENDC)
2018-02-14 15:16:03 +00:00
2018-02-16 05:31:30 +00:00
if menu == '?':
2018-02-14 15:16:03 +00:00
self.about()
2018-02-16 05:31:30 +00:00
elif menu == '+':
self.task.add()
self.menu()
2018-02-14 15:16:03 +00:00
elif menu == '/':
2018-02-16 05:31:30 +00:00
self.task.search()
self.menu()
2018-02-14 15:16:03 +00:00
2018-02-16 09:16:29 +00:00
elif menu == 't':
self.tag.manage_tag()
2018-02-16 09:16:29 +00:00
self.menu()
elif menu == 'c':
self.config.manage()
self.menu()
2018-02-16 05:31:30 +00:00
elif menu == 'q':
self.bye()
2018-02-14 15:16:03 +00:00
else:
print(bcolors.FAIL + 'This is not implemented...' + bcolors.ENDC)
self.menu()
2018-02-14 15:16:03 +00:00
def about(self):
2018-02-14 23:34:54 +00:00
print(bcolors.WARNING + '''
2018-02-14 15:16:03 +00:00
Short instruction
-----------------
? - help (this dialog)
+ - add
/ - search
t - tag manager
c - configuration
q - exit
2018-02-14 23:34:54 +00:00
''' + bcolors.ENDC)
2018-02-14 15:16:03 +00:00
self.menu()
2018-02-14 23:34:54 +00:00
def bye(self):
print(bcolors.FAIL + 'bye o/' + bcolors.ENDC)
sys.exit(0)
2018-02-14 15:16:03 +00:00
if __name__ == '__main__':
a = Main()
a.run()