def main(): sess = Session() tracker = sess.getTracker() while True: if tracker.exceedLimit(): sess.endSession(status=ax.State.END_SESSION) displayEnd() pygame.quit() quit() for event in pygame.event.get(): if event.type == pygame.QUIT: sess.endSession(status=ax.State.PAUSE) pygame.quit() quit() if event.type == pygame.MOUSEBUTTONUP: stateClicked = mouseHoverState(event.pos) #the click is somewhere of value and it is not the current state if stateClicked != -1 and stateClicked != tracker.getCurrentState( ): tracker.endCurrentContainer() if stateClicked == ax.State.WORKING: tracker.appendContainer(ax.State.WORKING) elif stateClicked == ax.State.INTERRUPTED: tracker.appendContainer(ax.State.INTERRUPTED) elif stateClicked == ax.State.BREAK: tracker.appendContainer(ax.State.BREAK) elif stateClicked == ax.State.WASTED: tracker.appendContainer(ax.State.WASTED) else: sess.endSession(status=ax.State.END_SESSION) pygame.quit() quit() displayWrapper(tracker) pygame.display.update() clock.tick(60)
if event in (None, "Cancel"): print("Session cancelled... No harm done...") window.close() window = None window0.UnHide() initPhase = True continue if validEndSession(values['-TASK-'], values['-DETAILS-']): window['-END SESSION-'].update(disabled=False) elif not validEndSession(values['-TASK-'], values['-DETAILS-']): window['-END SESSION-'].update(disabled=True) if event == "-END SESSION-": print("Ending session early...") session.endSession(values['-TASK-'], values['-DETAILS-']) session = None window.close() window = None window0.UnHide() initPhase = True continue if event == "toggleStart": session.toggleStart(initPhase) window['toggleStart'].update( text=StartPause[session.started]) #update # note, if the session isn't in the started state, the progress bar doesn't progress if session != None and session.started: if session.progress >= 1000: