/usr/share/scribus/samples/Calender.py is in scribus-data 1.4.6+dfsg-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" This Script creates a Calendar Sheet for the Current Month """
import sys
try:
from scribus import *
except ImportError:
print "This script only runs from within Scribus."
sys.exit(1)
import calendar
import time
def main():
Month = time.localtime()[1]
Year = time.localtime()[0]
Objects = []
MonthList = ["January","February","March","April","May","June","July","August","September","October","November","December"]
DaysList = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
Xcoor = 10
Ycoor = 30
DayC = 0
Calend = calendar.monthcalendar(Year, Month)
ob = createText(10, 10, 245, 20)
Title = MonthList[Month-1] + " " + str(Year)
setText(Title, ob)
Objects.append(ob)
for lx in range(45, 245, 35):
ob = createLine(lx, 30, lx, 20*len(Calend)+50)
Objects.append(ob)
for ly in range(50, 20*len(Calend)+50, 20):
ob = createLine(10, ly, 255, ly)
Objects.append(ob)
ob = createRect(10, 30, 245, 20*len(Calend)+20)
setFillColor("None", ob)
Objects.append(ob)
for day in range(7):
ob = createText(Xcoor, Ycoor, 35, 20)
setTextAlignment(ALIGN_CENTERED, ob)
setFontSize(12, ob)
if day == 6:
setTextColor("Red", ob)
setText(DaysList[day], ob)
Objects.append(ob)
Xcoor = Xcoor + 35
Ycoor = Ycoor + 20
for lines in Calend:
Xcoor = 10
DayC = 0
for rows in lines:
if rows != 0:
ob = createText(Xcoor, Ycoor, 35, 20)
setTextAlignment(ALIGN_CENTERED, ob)
if DayC == 6:
setTextColor("Red", ob)
setText(str(rows), ob)
Objects.append(ob)
Xcoor = Xcoor + 35
DayC = DayC + 1
Ycoor = Ycoor + 20
groupObjects(Objects)
if __name__ == '__main__':
if haveDoc():
try:
setRedraw(False)
main()
finally:
setRedraw(True)
redrawAll()
else:
messageBox("Calendar Script", "Please run this script with a document open.", ICON_INFORMATION);
|