Menu navigation optimized (Issue#1)
This commit is contained in:
64
timeTrack.py
64
timeTrack.py
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# timeTrack.py
|
# timeTrack.py
|
||||||
# by 4nima
|
# by 4nima
|
||||||
# v.2.0.0
|
# v.2.0.1
|
||||||
#
|
#
|
||||||
#########################
|
#########################
|
||||||
# simple time tracking with database
|
# simple time tracking with database
|
||||||
@@ -348,24 +348,24 @@ class TimeTrack:
|
|||||||
logging.debug('Event younger than 1 day')
|
logging.debug('Event younger than 1 day')
|
||||||
print('Vergangene Zeit: >{} Stunden'.format(int(elapsed.seconds/3600)))
|
print('Vergangene Zeit: >{} Stunden'.format(int(elapsed.seconds/3600)))
|
||||||
|
|
||||||
userinput = ''
|
userinput = 0
|
||||||
while True:
|
while not 0 < int(userinput) < 4:
|
||||||
if userinput == "F" or userinput == "f" or userinput == "1" \
|
|
||||||
or userinput == "L" or userinput == "l" or userinput == "2" \
|
|
||||||
or userinput == "A" or userinput == "a" or userinput == "3":
|
|
||||||
break
|
|
||||||
print('Soll das Event fortgesetzt oder gelöscht werden?')
|
print('Soll das Event fortgesetzt oder gelöscht werden?')
|
||||||
print('[1/F/f] für fortsetzen')
|
print('[1] für fortsetzen')
|
||||||
print('[2/L/l] für löschen')
|
print('[2] für löschen')
|
||||||
print('[3/A/a] für abbrechen')
|
print('[3] für abbrechen')
|
||||||
userinput = input('Aktion: ')
|
userinput = input('Aktion: ')
|
||||||
logging.debug('User input: {}'.format(userinput))
|
logging.debug('User input: {}'.format(userinput))
|
||||||
|
try:
|
||||||
|
int(userinput)
|
||||||
|
except ValueError:
|
||||||
|
userinput = 0
|
||||||
self.clear_screen()
|
self.clear_screen()
|
||||||
|
|
||||||
if userinput == "F" or userinput == "f" or userinput == "1":
|
if userinput == "1":
|
||||||
logging.debug('Event should be continued')
|
logging.debug('Event should be continued')
|
||||||
self.time_stop()
|
self.time_stop()
|
||||||
elif userinput == "L" or userinput == "l" or userinput == "2":
|
elif userinput == "2":
|
||||||
logging.info('Event should be deleted (eventid: {})'.format(data[0]))
|
logging.info('Event should be deleted (eventid: {})'.format(data[0]))
|
||||||
self.delete_event(data[0])
|
self.delete_event(data[0])
|
||||||
self.time_start()
|
self.time_start()
|
||||||
@@ -383,21 +383,21 @@ class TimeTrack:
|
|||||||
logging.debug('Event stop progess is started')
|
logging.debug('Event stop progess is started')
|
||||||
if data:
|
if data:
|
||||||
self.clear_screen()
|
self.clear_screen()
|
||||||
userinput = ''
|
userinput = 0
|
||||||
while True:
|
while not 0 < int(userinput) < 4:
|
||||||
if userinput == "B" or userinput == "b" or userinput == "1" \
|
|
||||||
or userinput == "L" or userinput == "l" or userinput == "2" \
|
|
||||||
or userinput == "A" or userinput == "a" or userinput == "3":
|
|
||||||
break
|
|
||||||
print('Event von {} Uhr beenden?'.format(data[1].strftime("%H:%M")))
|
print('Event von {} Uhr beenden?'.format(data[1].strftime("%H:%M")))
|
||||||
print('[1/B/b] für beenden')
|
print('[1] für beenden')
|
||||||
print('[2/L/l] für löschen')
|
print('[2] für löschen')
|
||||||
print('[3/A/a] für abbrechen')
|
print('[3] für abbrechen')
|
||||||
userinput = input('Aktion: ')
|
userinput = input('Aktion: ')
|
||||||
logging.debug('User input: {}'.format(userinput))
|
logging.debug('User input: {}'.format(userinput))
|
||||||
|
try:
|
||||||
|
int(userinput)
|
||||||
|
except ValueError:
|
||||||
|
userinput = 0
|
||||||
self.clear_screen()
|
self.clear_screen()
|
||||||
|
|
||||||
if userinput == "B" or userinput == "b" or userinput == "1":
|
if userinput == "1":
|
||||||
logging.debug('Event is ended')
|
logging.debug('Event is ended')
|
||||||
print('Eingabe beenden mittels doppelter Leerzeile.')
|
print('Eingabe beenden mittels doppelter Leerzeile.')
|
||||||
print('Durchgeführte Tätigkeiten:')
|
print('Durchgeführte Tätigkeiten:')
|
||||||
@@ -438,18 +438,20 @@ class TimeTrack:
|
|||||||
self.delete_event(data[0])
|
self.delete_event(data[0])
|
||||||
self.print_time_entry(STARTTIME=data[1], ENDTIME=endtime, ACTIVITY=action)
|
self.print_time_entry(STARTTIME=data[1], ENDTIME=endtime, ACTIVITY=action)
|
||||||
print('Zeiteintrag wurde gespeichert.')
|
print('Zeiteintrag wurde gespeichert.')
|
||||||
while True:
|
userinput = 0
|
||||||
if userinput == "J" or userinput == "j" or userinput == "1" \
|
while not 0 < int(userinput) < 3:
|
||||||
or userinput == "N" or userinput == "n" or userinput == "2":
|
print('Nächsten Zeiteintrag beginnen ?')
|
||||||
break
|
print('[1] Ja')
|
||||||
print('Nächsten Zeiteintrag begrinnen ?')
|
print('[2] Nein')
|
||||||
print('[1/J/j] Ja')
|
|
||||||
print('[2/N/n] Nein')
|
|
||||||
userinput = input('Aktion: ')
|
userinput = input('Aktion: ')
|
||||||
logging.debug('User input: {}'.format(userinput))
|
logging.debug('User input: {}'.format(userinput))
|
||||||
|
try:
|
||||||
|
int(userinput)
|
||||||
|
except ValueError:
|
||||||
|
userinput = 0
|
||||||
self.clear_screen()
|
self.clear_screen()
|
||||||
|
|
||||||
if userinput == "J" or userinput == "j" or userinput == "1":
|
if userinput == "1":
|
||||||
self.time_start()
|
self.time_start()
|
||||||
else:
|
else:
|
||||||
logging.debug('Terminated by the user')
|
logging.debug('Terminated by the user')
|
||||||
@@ -458,7 +460,7 @@ class TimeTrack:
|
|||||||
|
|
||||||
connect.close()
|
connect.close()
|
||||||
|
|
||||||
elif userinput == "L" or userinput == "l" or userinput == "2":
|
elif userinput == "2":
|
||||||
logging.info('Event should be deleted (eventid: {})'.format(data[0]))
|
logging.info('Event should be deleted (eventid: {})'.format(data[0]))
|
||||||
self.delete_event(data[0])
|
self.delete_event(data[0])
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user