'''
A calendar generator plugin for Inkscape, but also can be used as a standalone
command line application.
Copyright (C) 2008 Aurelio A. Heckert <aurium(a)gmail.com>
Week number option added by Olav Vitters and Nicolas Dufour (2012)
More on ISO week number calculation on:
(The first week of a year is the week that contains the first Thursday
of the year.)
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
'''
import calendar
import re
from datetime import *
import inkex
import simplestyle
dest="tab")
help="Month to be generated. If 0, then the entry year will be generated.")
help="Year to be generated. If 0, then the current year will be generated.")
help="Fill empty day boxes with next month days.")
help="Include a week number column.")
help='Week start day. ("sun" or "mon")')
help='Define the weekend days. ("sat+sun" or "sat" or "sun")')
help='Automatically set the size and positions.')
help='Number of months side by side.')
help='The width of the month days box.')
help='The space between the month boxes.')
help='Color for the year header.')
help='Color for the month name header.')
help='Color for the week day names header.')
help='Color for the common day box.')
help='Color for the weekend days.')
help='Color for the next month day, in enpty day boxes.')
help='Color for the week numbers.')
'April May June '+ \
'July August September ' + \
'October November December',
help='The month names for localization.')
help='The week day names for localization.')
help='The week number column name for localization.')
help='The input encoding of the names.')
#inkex.errormsg( self.options.input_encode )
# Convert string names lists in real lists
# Validate names lists
'" is invalid. Using default.')
'April', 'May', 'June',
'July', 'August', 'September',
'October', 'November', 'December']
'" is invalid. Using default.')
'Fri','Sat']
# Convert year 0 to current year
# Year 1 starts it's week at monday, obligatorily
# Set the calendar start day
else:
# Convert string numbers with unit to user space float numbers
# initial values
#month_margin month_width months_per_line auto_organize
else:
else:
else:
#self.month_w = self.doc_w / self.months_per_line
else:
(self.month_margin * \
else:
'font-family': 'arial',
'text-anchor': 'middle',
'text-align': 'center',
}
# weekend values: "sat+sun" or "sat" or "sun"
else:
return False
cal2 = []
if day != 0:
return cal2
try:
except:
exit(1)
week_x = 0
else:
try:
wday,
except:
exit(1)
week_x += 1
txt_atts = {
'transform': 'translate(' +
self.month_x_pos) + \
',' + \
')',
'id': 'month_' + \
str(m) + \
'_' + \
self.write_month_header(g, m)
if m == 1:
before_month = \
else:
before_month = \
if m == 12:
next_month = \
else:
next_month = \
# add a line after the last week
# add a line before the first week (Feb 2009)
# How mutch before month days will be showed:
week_y = 0
week_x = 0
# Remove leap week (starting previous year) and empty weeks
week_x += 1
else:
week_x += 1
pass # draw nothing
elif day == 0:
if before:
bmd -= 1
else:
bmd += 1
else:
week_x += 1
week_y += 1
self.create_month(m)
else:
e = SVGCalendar()
e.affect()