--- pypanel.orig 2007-12-31 20:56:38.000000000 -0500 +++ pypanel 2008-01-01 20:27:06.000000000 -0500 @@ -605,6 +605,24 @@ ppshade(win.id, rpm, P_START, P_LOCATION, P_WIDTH, P_HEIGHT, r, g, b, SHADE) + #------------------ + def MSDClock(self): + #------------------ + import string, calendar + + timeList = list() + pos = (calendar.timegm(time.localtime()) % 86400) / 86400.0 + + pos *= CLOCK_RADIX**CLOCK_PRECISION + intPos = int(pos) + + for i in range(CLOCK_PRECISION): + timeList.append(string.upper(string.hexdigits[intPos % CLOCK_RADIX])) + intPos /= CLOCK_RADIX + timeList.reverse() + + return "".join(timeList) + #--------------------------------------- def updatePanel(self, root, win, panel): #--------------------------------------- @@ -621,7 +639,11 @@ if CLOCK: clock = panel[CLOCK] - clock.name = time.strftime(CLOCK_FORMAT, time.localtime()) + if CLOCK_MSDFRAC: + clock_format = CLOCK_FORMAT.replace("MSDFRAC", self.MSDClock()) + clock.name = time.strftime(clock_format, time.localtime()) + else: + clock.name = time.strftime(CLOCK_FORMAT, time.localtime()) clock.width = ppfontsize(clock.name) + 2 space -= clock.width + P_SPACER*2 if DESKTOP: @@ -879,7 +901,11 @@ if AUTOHIDE and not self.hidden: self.toggleHidden() if CLOCK: - now = time.strftime(CLOCK_FORMAT, time.localtime()) + if CLOCK_MSDFRAC: + clock_format = CLOCK_FORMAT.replace("MSDFRAC", self.MSDClock()) + now = time.strftime(clock_format, time.localtime()) + else: + now = time.strftime(CLOCK_FORMAT, time.localtime()) if clock.name != now: clock.name = now self.clearPanel(clock.x1+1, 0, clock.x2-(clock.x1+1), P_HEIGHT) @@ -914,6 +940,10 @@ MINIMIZED_SHADOW_COLOR = "0xffffff" DESKTOP_SHADOW_COLOR = "0xffffff" CLOCK_SHADOW_COLOR = "0xffffff" +# MSDFRAC CLOCK PATCH +CLOCK_MSDFRAC = 1 +CLOCK_PRECISION = 4 +CLOCK_RADIX = 16 #------------------------- if __name__ == "__main__":