import curses
import sys
import datetime
import cumodoro.config as config
from cumodoro.component.frame import Frame
import cumodoro.globals as globals
from cumodoro.timeconvert import *
import types
from cumodoro.component.window import Window
from cumodoro.error import *
import logging

log = logging.getLogger('cumodoro')

class Weekswitcher(Window):
    def __init__(self):
        super(Weekswitcher,self).__init__()

        self.update_current_time()
        self.frame_titles = [ "week_frame" , "year_frame", "level_frame" ]
        self.values = [ [True,self.current_week,False], [True,self.current_year,False], [True,globals.database.levels-1,False] ]

        frame = Frame()
        frame.set_size(16,1)
        frame.name = "Level  "
        frame.title = "level_frame"
        self.add_frame(frame.title,frame)
        self.level_frame = frame

        frame = Frame()
        frame.set_size(16,1)
        frame.name = "Year   "
        frame.title = "year_frame"
        self.add_frame(frame.title,frame)
        self.year_frame = frame

        frame = Frame()
        frame.set_size(16,1)
        frame.name = "Week   "
        frame.title = "week_frame"
        self.add_frame(frame.title,frame)
        self.week_frame = frame

        for i in range(len(self.frame_titles)):
            frame = self.frames[self.frame_titles[i]]