fixed empty todo management

master
Master 2019-10-15 22:43:36 -04:00
parent f93e5b7f70
commit 852a0e05db
1 changed files with 31 additions and 22 deletions

View File

@ -223,7 +223,11 @@ class Journaler():
# open self.config.tracker file # open self.config.tracker file
# iterate through lines # iterate through lines
# find line that begins with hash # find line that begins with hash
with open( self.config.tracker, 'w+' ) as tracker_file: if not os.path.exists( self.config.tracker ):
f = open(self.config.tracker, 'w+')
f.close()
with open( self.config.tracker, 'r' ) as tracker_file:
for line in tracker_file: for line in tracker_file:
m = re.search( "^{0}\t.*$".format( task.hash ), line ) m = re.search( "^{0}\t.*$".format( task.hash ), line )
print(line) print(line)
@ -253,6 +257,8 @@ class Journaler():
( todo.hash, "({0}) {1}".format(todo.topic, todo.text) , False ) ( todo.hash, "({0}) {1}".format(todo.topic, todo.text) , False )
) )
if len(choices) > 0:
code, hashes_marked_complete = self.d.checklist( code, hashes_marked_complete = self.d.checklist(
text="TODO Entries", text="TODO Entries",
choices=choices, choices=choices,
@ -277,6 +283,9 @@ class Journaler():
for selection in tasks_to_complete: for selection in tasks_to_complete:
self._mark_task_complete( selection ) self._mark_task_complete( selection )
else:
# no todo items
self.do_browse_topics()
def create_new_topic_ui(self): def create_new_topic_ui(self):
input_code, input_topic = self.d.inputbox("Creating a new topic for today: {}".format(self._get_current_date()), input_code, input_topic = self.d.inputbox("Creating a new topic for today: {}".format(self._get_current_date()),