Package: pypanel Version: 2.4-1.1 Severity: wishlist Tags: patch pypanel doesn't have an option on the Clock format to use different bases like Bin, Oct or Hex. Attaching patch which solves the problem
-- aka nxvl Yo uso Software Libre, y tu?
--- pypanel.orig 2007-10-08 23:36:58.000000000 -0500 +++ pypanel 2007-10-12 02:16:23.000000000 -0500 @@ -604,6 +604,25 @@ b = int("0x"+BG_COLOR[6:8],0) ppshade(win.id, rpm, P_START, P_LOCATION, P_WIDTH, P_HEIGHT, r, g, b, SHADE) + + #--------------------------------------- + def baseClock(self,base,hourDigits,minDigits): + #--------------------------------------- + hourList = list() + minList = list() + (min,hour) = time.strftime("%M:%H", time.localtime()).split(":") + + for i in range(hourDigits): + (hour, remainder) = divmod(int(hour),base) + hourList.append('%X' % remainder) + hourList.reverse() + + for i in range(minDigits): + (min, remainder) = divmod(int(min),base) + minList.append(str('%X' % remainder)) + minList.reverse() + + return "".join(hourList)+":"+"".join(minList) #--------------------------------------- def updatePanel(self, root, win, panel): @@ -621,7 +640,14 @@ if CLOCK: clock = panel[CLOCK] - clock.name = time.strftime(CLOCK_FORMAT, time.localtime()) + if CLOCK_FORMAT == 'bin': + clock.name = self.baseClock(2,5,6) + elif CLOCK_FORMAT == 'hex': + clock.name = self.baseClock(16,2,2) + elif CLOCK_FORMAT == 'oct': + clock.name = self.baseClock(8,2,2) + 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 +905,14 @@ if AUTOHIDE and not self.hidden: self.toggleHidden() if CLOCK: - now = time.strftime(CLOCK_FORMAT, time.localtime()) + if CLOCK_FORMAT == 'bin': + now = self.baseClock(2,5,6) + elif CLOCK_FORMAT == 'hex': + now = self.baseClock(16,2,2) + elif CLOCK_FORMAT == 'oct': + now = self.baseClock(8,2,2) + 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)