View Single Post
Posts: 671 | Thanked: 1,630 times | Joined on Aug 2010
#156
ISO-8601 mod for Advanced Clock Plugin rev 0.11.0

ISO-8601 format again, hardcoded font size

enjoy

ISO_8601_Clock.py
Code:
import cairo
from datetime import datetime
import gtk
import math
import pango

import clock

def get_name():
    return "ISO_8601 Clock"

class ISO_8601_Clock(clock.Clock):
    def __init__(self, drawing_area):
        clock.Clock.__init__(self, drawing_area)

    def draw_clock(self):


# Draw date.in ISO-8601 compliant
        self.context.set_font_size(20)
        self.context.move_to(2, 16)
        text = str(self.time.year) + "." + str(self.time.month).zfill(2) + "." + str(self.time.day).zfill(2)
        self.context.text_path(text)
        self.context.stroke()

# Draw time.
        self.context.set_font_size(20)
        self.context.move_to(2, 35)
        text = str(self.time.hour).zfill(2) + ":" + str(self.time.minute).zfill(2) + ":" + str(self.time.second).zfill(2)
        self.context.text_path(text)
        self.context.stroke()


    def resize(self):
        self.drawing_area.set_size_request(110, 36)
Attached Images
 
Attached Files
File Type: zip ISO_8601_Clock.py.zip (1.0 KB, 470 views)
__________________
Three n900s: One for stable working platform,
One for development testing Chopping Onions
One for saltwater immersion power testing resurrected ! parts scavenging

My Mods for Wonko's Advanced Clock Plugin:
ISO8601 clock mod and Momental_IST clock mod

Printing your Email with the N900
 

The Following 3 Users Say Thank You to theonelaw For This Useful Post: