svgcalendar.py revision 29487a8c51798146d1e86d0cfdd0e9d04ac89a34
'''
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>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
__version__ = "0.1"
from datetime import *
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='Week start day. ("sun" or "mon")')
help='Define the weekend days. ("sat+sun" or "sat" or "sun")')
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.')
'July August September October November December',
help='The month names for localization.')
help='The week day names for localization.')
def validate_options(self):
# 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.')
# Convert year 0 to current year:
# Set the calendar start day:
else:
# initial values:
month_x_pos = 0
month_y_pos = 0
else:
#self.month_w = self.doc_w / self.months_per_line
) / 2 ) #- 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
def write_month_header(self, g, m):
week_x = 0
week_x += 1
else:
week_x += 1
def create_month(self, m):
txt_atts = {
self.month_x_pos) +
self.write_month_header(g, m)
if m == 1:
before_month = \
else:
before_month = \
if m == 12:
next_month = \
else:
next_month = \
# How mutch before month days will be showed:
week_y = 0
week_x = 0
pass # draw nothing
elif day==0:
if before:
bmd -= 1
else:
bmd += 1
else:
week_x += 1
week_y += 1
txt_atts = {
self.create_month(m)
else:
if __name__ == '__main__':
e = SVGCalendar()
e.affect()