Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions
Calender Namespace Reference

Functions

def main

Function Documentation

def Calender.main ( )

Definition at line 17 of file Calender.py.

00017 
00018 def main():
00019     Month = time.localtime()[1]
00020     Year = time.localtime()[0]
00021     Objects = []
00022     MonthList = ["January","February","March","April","May","June","July","August","September","October","November","December"]
00023     DaysList = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
00024     Xcoor = 10
00025     Ycoor = 30
00026     DayC = 0
00027     Calend = calendar.monthcalendar(Year, Month)
00028     ob = createText(10, 10, 245, 20)
00029     Title = MonthList[Month-1] + " " + str(Year)
00030     setText(Title, ob)
00031     Objects.append(ob)
00032     for lx in range(45, 245, 35):
00033         ob = createLine(lx, 30, lx, 20*len(Calend)+50)
00034         Objects.append(ob)
00035     for ly in range(50, 20*len(Calend)+50, 20):
00036         ob = createLine(10, ly, 255, ly)
00037         Objects.append(ob)
00038     ob = createRect(10, 30, 245, 20*len(Calend)+20)
00039     setFillColor("None", ob)
00040     Objects.append(ob)
00041     for day in range(7):
00042         ob = createText(Xcoor, Ycoor, 35, 20)
00043         setTextAlignment(ALIGN_CENTERED, ob)
00044         setFontSize(12, ob)
00045         if day == 6:
00046             setTextColor("Red", ob)
00047         setText(DaysList[day], ob)
00048         Objects.append(ob)
00049         Xcoor = Xcoor + 35
00050     Ycoor = Ycoor + 20
00051     for lines in Calend:
00052         Xcoor = 10
00053         DayC = 0
00054         for rows in lines:
00055             if rows != 0:
00056                 ob = createText(Xcoor, Ycoor, 35, 20)
00057                 setTextAlignment(ALIGN_CENTERED, ob)
00058                 if DayC == 6:
00059                     setTextColor("Red", ob)
00060                 setText(str(rows), ob)
00061                 Objects.append(ob)
00062             Xcoor = Xcoor + 35
00063             DayC = DayC + 1
00064         Ycoor = Ycoor + 20
00065     groupObjects(Objects)