def __init__(self, closeFunc): gtk.Widget.__init__(self) self.initVars() ### self.closeFunc = closeFunc self.connect('expose-event', self.onExposeEvent) self.connect('scroll-event', self.onScroll) self.connect('button-press-event', self.buttonPress) self.connect('motion-notify-event', self.motionNotify) self.connect('button-release-event', self.buttonRelease) self.connect('key-press-event', self.keyPress) #self.connect('event', show_event) self.currentTime = getCurrentTime() self.timeWidth = 24*3600 self.timeStart = self.currentTime - self.timeWidth/2.0 self.buttons = [ Button('home.png', self.centerToNowClicked, 1, -1, False), Button('resize-small.png', self.startResize, -1, -1, False), Button('exit.png', closeFunc, 35, -1, False) ] ## zoom in and zoom out buttons FIXME self.data = None ######## self.movingLastPress = 0 self.movingV = 0 self.movingF = 0 ####### self.boxEditing = None
def currentTimeUpdate(self): tm = getCurrentTime() timeout_add(int(1000 * (1.01 - tm % 1)), self.currentTimeUpdate) self.currentTime = int(tm) if self.parent: if self.parent.get_visible() and self.timeStart <= tm <= self.timeStart + self.timeWidth + 1: self.queue_draw()
def centerToNow(self): self.stopMovingAnim() self.timeStart = getCurrentTime() - self.timeWidth/2.0