Calender extention does not work for other than current year (inkscape0.47)

Bug #492173 reported by JohnBandaru
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Aurium

Bug Description

when I try to generate a calender for the next year in the configuration dialogu of the extention the following error message shows up :

Traceback (most recent call last):

  File "d:\Program Files\Inkscape\share\extensions\svgcalendar.py", line 338, in <module>

    e.affect()

  File "d:\Program Files\Inkscape\share\extensions\inkex.py", line 207, in affect

    self.effect()

  File "d:\Program Files\Inkscape\share\extensions\svgcalendar.py", line 331, in effect

    self.create_month(m)

  File "d:\Program Files\Inkscape\share\extensions\svgcalendar.py", line 267, in create_month

    cal = calendar.monthcalendar(self.options.year,m)

  File "d:\Program Files\Inkscape\python\Lib\calendar.py", line 212, in monthdayscalendar

    days = list(self.itermonthdays(year, month))

  File "d:\Program Files\Inkscape\python\Lib\calendar.py", line 183, in itermonthdays

    for date in self.itermonthdates(year, month):

  File "d:\Program Files\Inkscape\python\Lib\calendar.py", line 159, in itermonthdates

    date -= datetime.timedelta(days=days)

OverflowError: date value out of range

and then when i close the dialogue box I get a new dialogue box saying 'Calender' working. please wait. and i am unable to close the application too or any window in inkscape.

Hardware I am using windows Xp Pro,sp3, intel core2duo, 4GB ram, (not sure of which mother board -sorry).

jazzynico (jazzynico)
tags: added: extensions-plugins
Revision history for this message
su_v (suv-lp) wrote :

Not reproduced with Inkscape 0.47 on OS X 10.5.8, Python 2.5.1

steps:
1) Localization: Char Encoding [ utf-8 ]
2) Configuration: Months [ 0 ]
   Configuration: Years [ 2010 ]
   Configuration: Fill empty day boxes [ x ]
   Configuration: Week start day [ Monday ]
   Configuration: Weekend [ Saturday and Sunday ]
all other values are default.
3) Apply

result: inserts calendar without error for the year 2010

Revision history for this message
sas (sas-sas) wrote :

Works for me in Inkscape 0.47 on Windows XP, using the steps given by ~suv.

But if the year is set to 1 (which some people may assume means "next year", since 0 means "current year"), and the week start day is set to Sunday (which I think is the default), then I get the traceback shown in the bug report.

Revision history for this message
su_v (suv-lp) wrote :

reproduced with Inkscape 0.47 on OS X 10.5.8 when changing 2010 to '1':
   Configuration: Years [ 1 ]
as described by sas

Changed in inkscape:
status: New → Confirmed
Revision history for this message
jazzynico (jazzynico) wrote :

Also reproduced on Ubuntu 9.10, Inkcape 0.47pre4, with year=1 (but not with higher values).

Changed in inkscape:
importance: Undecided → Low
Revision history for this message
jazzynico (jazzynico) wrote :

Aurelio, any idea?

Changed in inkscape:
assignee: nobody → Aurium (aurium)
Revision history for this message
Aurium (aurium) wrote :

Hi Nico and all,

The Year box really want a full 4 digits year. The 0 is only a help for fast usage. So the 1 is not the next year, it is the first year of the Christian calendar.

May that need to be more clear on the calendar dialog or it must stop to use 0 as current year.

Revision history for this message
Aurium (aurium) wrote :

...but the year 1 must work. I will try to see why is crashing.

Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

I have figured out why this is happening, when it's printing January of year 1, it looks back to december of year 0 to see if it can carry some days over, but of course there is no year 0. Fortunately the python calendar module thinks that Jan 1st year 1 was a Monday, so there is no problem with ignoring the previous year in this case.

I have written a patch, could some folks test it and see whether it works for them too? It works for me here on a Win 7 machine with revision 9791.

Changed in inkscape:
assignee: Aurium (aurium) → Craig Marshall (craig9)
status: Confirmed → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Still doesn't work (tested on Windows XP and Ubuntu 10.04).
The extension seems to fail just two lines before the start of your patch when calling cal = calendar.monthcalendar(self.options.year,m).

Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

Hi JazzyNico,

Thanks very much for taking a look at this "fix". I am sorry to have not got back to you until now, but I've had no spare time until now, and really none for a few more days. I do plan to look at this bug again in a week or so, I just didn't want you to think I'd abandoned it.

Thanks,
Craig

Revision history for this message
Aurium (aurium) wrote :

Hi Craig and Jazzy,

I think that i found the problem. The year 1 only render with calendar.setfirstweekday(0) and the deafault is calendar.setfirstweekday(6).
I also had changed the default inx year value and its description to stop misunderstands about how it works.

Please see:
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/9872

Changed in inkscape:
assignee: Craig Marshall (craig9) → Aurium (aurium)
status: In Progress → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :
su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.49
Revision history for this message
su_v (suv-lp) wrote :

Proposing to backport with minor change: do not disable live-preview (it's currently disabled in trunk, why?).

tags: added: backport-proposed
Revision history for this message
su_v (suv-lp) wrote :

Affects translated strings, tag removed (sorry).

tags: removed: backport-proposed
Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.