Пример #1
0
def add_pomodoro():	
	outputFile = open('pomLog.csv','a',newline='')
	pomWriter = csv.writer(outputFile, lineterminator='\n')
	print('YAY! a new tomato!')
	x = Pomodoro()
	pomWriter.writerow([x.date,time_convert(x.time),x.tags,x.notes])
	outputFile.close()
Пример #2
0
 def testPauseAndResumePomodoros(self):
     pomo = Pomodoro()
     # we cannot pause a Pomodoro that has not been started yet
     self.assertRaises( Exception, pomo.pause )
     pomo.start()
     time1 = pomo.getTimeLeft()
     pomo.pause()
     time.sleep(1)
     pomo.resume()
     time2 = pomo.getTimeLeft()
     self.assertTrue( time2 + timedelta(seconds=1) < time1  )
Пример #3
0
def main():
    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(False)

    w = Pomodoro()

    tray = MySystemTray()
    menu = tray.get_menu()
    timer_action = menu.addAction("Timer")
    timer_action.triggered.connect(w.show)

    app.exec_()
Пример #4
0
    def testCreatePomodoros(self):
        pomo = Pomodoro()
        self.assertEquals( timedelta(minutes=25), pomo.pomodoroTime,
            'A pomodoro starts with a default time of 25 minutes and it \
            does not start counting down until it is started')

        pomo2 = Pomodoro(minutes=1)
        self.assertEquals( timedelta(minutes=1), pomo2.pomodoroTime,
            'A pomodoro can be started with any integer positive value')
        self.assertTrue( pomo2.pomodoroTime == timedelta(minutes=1),
            'A pomodoro can be created with the low boundary value' )

        # max int32 value
        pomo3 = Pomodoro(minutes=2147483647)
        self.assertEqual( timedelta(minutes=2147483647), pomo3.pomodoroTime,
            'A pomodoro can be created with the high boundary value')
        # test that we can't create pomodoros with non valid values
        self.assertRaises( Exception, Pomodoro, -2)
        self.assertRaises( Exception, Pomodoro, 0)
        self.assertRaises( Exception, Pomodoro, 'a string' )
        self.assertRaises( Exception, Pomodoro, [] )
Пример #5
0
 def testPomodoroPausesCounter(self):
     pomo = Pomodoro()
     pomo.start()
     self.assertEquals( pomo.pauses, 0 )
     pomo.pause()
     pomo.resume()
     self.assertEquals( pomo.pauses, 1 )
     i=0
     while i<10:
         pomo.pause()
         pomo.resume()
         i += 1
     self.assertEquals( pomo.pauses, 11 )
Пример #6
0
def main():

    # create pomodoro & begin first task

    task_goal = input("Enter the number of tasks you want to do today: ")
    task_length_minutes = input("Enter the length of each task: ")
    short_break_length = input("Enter the length of a short break: ")
    long_break_length = input("Enter the length of a long break: ")
    pomodoro = Pomodoro(task_goal, long_break_length, short_break_length,
                        task_length_minutes)
    pomodoro.start_task()

    while True:

        # Initialize last_summary variable to 15 seconds in the past
        last_summary = pomodoro.timer_start - timedelta(seconds=15)

        # while the timer is running
        while pomodoro.get_time_remaining() > timedelta(seconds=0):

            current_time = datetime.now()

            # print a summary of the current timer every 15 seconds
            if (current_time - last_summary) > timedelta(seconds=15):
                pomodoro.print_summary()

                # update timer to track when the last summary was printed
                last_summary = current_time

        # if we are on a task, complete the task.  Otherwise, we start the task timer
        if pomodoro.timer_type == Pomodoro.TIMER_TASK:

            # complete the task
            pomodoro.complete_task()

            # check to see if need to continue to a break or stop the pomodoro
            if pomodoro.done():
                break
            if pomodoro.task_count % pomodoro.long_break_goal == 0:
                pomodoro.start_long_break()
            else:
                pomodoro.start_short_break()
        else:
            pomodoro.start_task()

    # we have met our pomodoro goal
    print("\nPomodoro Complete!")
Пример #7
0
def pomodoro_callback(bot, update, **kwargs):
    global pomodoro
    args = kwargs.get('args')
    _job_queue = kwargs.get('job_queue')

    if args[0] == 'start':
        logger.info('starting pomodoro')
        pomodoro = Pomodoro()
        _job_queue.run_repeating(pomodoro_alarm,
                                 interval=0,
                                 first=0,
                                 context=update.message.chat_id)

    if args[0] == 'stop':
        logger.info('stopping pomodoro')
        pomodoro = None
        _job_queue.enabled = False
def run(new):
    while True:
        if new == False:
            p = load_pomodoro()
            new = True

        show_commands()
        choice = input('\nWhat would you like to do? ')

        if choice == 'a':
            if not p:
                p = Pomodoro()

            while True:
                task = input('\nTask: ')
                p.add_task({"task": task, "complete": False})
                response = input('\nWould you like to add another task? ')

                if response == 'n':
                    break

        elif choice == 'r':
            try:
                p.check_tasks()
                to_remove = input('\nPlease select a task to remove: ')
                p.remove_task(int(to_remove))

            except UnboundLocalError:
                print('\nYou have not loaded or created a pomodoro session, so no tasks can be deleted')
        
        elif choice == 's':
            filename = input('\nPlease enter a name for your save: ')
            p.save_tasks(filename=filename)
        
        elif choice == 'p':
            p.check_tasks()
        
        elif choice == 'b':
            # TODO: add the running of a pomodoro
            p.begin_pomodoro()

        else:
            break
Пример #9
0
import os

from pomodoro import Pomodoro

os.chdir("..")  # Go up one directory from working directory

# Create database if it does not exist
database_path = "data\pomodoros.db"
if not os.path.exists(database_path):
    print("Creating database ...")
    os.system("database.py")

conn = sqlite3.connect("data\pomodoros.db")
cursor = conn.cursor()

pomodoro = Pomodoro(cursor)

### Main loop
while True:
    # Show the categories available
    category_id = pomodoro.show_categories()
    project_id = pomodoro.show_projects(category_id)
    pomodoro_time = input("Add the length of the pomodoro in minutes: ")

    # call for the timer
    pomodoro.timer(minutes=pomodoro_time)

    # Rest timer
    pomodoro.timer(mode="rest")

    # Ask for satisfaction
Пример #10
0
from pomodoro import Pomodoro

pomodoro = Pomodoro()
pomodoro.start()
Пример #11
0
from pomodoro import Pomodoro
from breakTime import BreakTime, BreakEnum
import time

total_checkmark_to_long_break = 5

btime = BreakTime(3, 15)
pomodoro = Pomodoro(2, total_checkmark_to_long_break)


def startBreak(checkmark, cicle, breakType):
    print('\n--- Time to rest! ---\n')
    btime.run(breakType)
    pomodoro.run()


pomodoro.onFinishSection += startBreak

pomodoro.run()
Пример #12
0
 def testPomodoroNotActiveAfterItsTimePassed(self):
     pomo = Pomodoro(seconds=1)
     pomo.start()
     time.sleep(1)
     self.assertRaises( Exception, pomo.pause )
Пример #13
0
 def testStartAndRestartPomodoros(self):
     pomo = Pomodoro()
     pomo.start()
     self.assertTrue( pomo.getTimeLeft() < timedelta(minutes=25), 'A started pomodoro initiates the countdown' )
     pomo.start()
     self.assertTrue( pomo.getTimeLeft().seconds/60 == 24 )
Пример #14
0
def load_pomodoro():
    Pomodoro.show_saved_pomodoros()
    choice = input('\nPlease select a pomodoro to load: ')
    p = Pomodoro(Pomodoro.load_pomodoro(choice))
    return p
Пример #15
0
def main():
    pomodoro = Pomodoro()
    pomodoro.run()