def __init__(self): wx.Frame.__init__( self, None, -1, u"Статистика", style=wx.DEFAULT_FRAME_STYLE ^ (wx.RESIZE_BORDER), size=(450, 300), ) self.Centre() self.construct_frame() self.Layout() self.Bind(wx.EVT_CLOSE, self.onClose) self.Show(False) NotificationCenter().addObserver(self, self.onDBUpdate, "dbUpdated") NotificationCenter().addObserver(self, self.onUpdateUI, "updateUI")
def newPomodoro(self, description): curtime = str(int(time.time())) task = DBTask(DBTask.DBTASK_ADD, { "time": curtime, "desc": description }) self.queue.put(task, True, self.DBREQUEST_TIMEOUT) self.queue.join() NotificationCenter().postNotification("dbUpdated", self) return task.result
def __init__(self): wx.Frame.__init__( self, None, -1, 'Pomodoro it!', style=wx.BORDER_DEFAULT | wx.STAY_ON_TOP, size=(220, 120), ) state = PomodoroState() self.__state_dict = { state.StateNoState: { 'bs': '...' }, state.StateInPomodoro: { 'bs': u"Отменить..." }, state.StateInRest: { 'bs': u"Отдыхайте!" }, state.StateWaitingPomodoro: { 'bs': u"Начать помидору" }, state.StateWaitingRest: { 'bs': u"Начать отдых" }, state.StatePomodoroKilled: { 'bs': u"Начать помидору" }, } self.buildFrame() self.updateUI() self.makeMenu() self.Show(False) NotificationCenter().addObserver(self, self.onDBUpdate, "dbUpdated") NotificationCenter().addObserver(self, self.onUpdateUI, "updateUI")
def __init__(self): self.queue = Queue() self.dbThread = DataBaseThread(self.queue) self.dbThread.start() NotificationCenter().addObserver(self, self.willQuit, "beforeQuit")
def connectToDB(self, fname): self.conn = sqlite.connect(fname) self.dbpath = fname NotificationCenter().postNotification("dbConnected", self)
def didApplicationLoaded(self): NotificationCenter().postNotification("dbUpdated", self)
def updateUI(self): if self.now_creation: return NotificationCenter().postNotification("updateUI", self)
def quit(self): NotificationCenter().postNotification("beforeQuit", self) self.toggleState(PomodoroState.StateNoState) map(lambda x: x.Destroy(), self.__viewControllers.values()) print "Views were destroyed"