Main index > About existing desklets > Calendar

By jeepston (Desklet Author), on Thu Mar 10 19:37:40 2005: Calendar.

Hi there.

I think that's a great start with calendar desklet. But I have a couple of comments and questions about it.

-- It would be great to make some separation lines between month, days title and dates
-- Can I somehow highlight current date?

Ok, I think all other formatting things I can do by myself.

Thanks.

By darkliquid (Desklet Author), on Fri Mar 11 03:39:44 2005.

I'm planning on adding these features soon, I'm just rewriting the whole thing so it isn't so much of a mess.

Hopefuly I'll have it done soon, but all my Uni work is starting to pile up so we shall see :D

Hopefully, the next release will be soonish. This wont have any additional features per se but it should be easier to modify and add features to.

Shortly following the next release I will hopefully be adding support for:
Cells with coloured background, borders and text.
Custom padding between cells.
Different theming for the heading cell, the day cells and the date number cells.
Different theming for specific date cells such as the current date.

By ZeroDivide (Desklet Author), on Fri Mar 11 14:36:15 2005.

I'm loving the new 0.2.0 version, its looking very nice.

The only thing I noticed is that most calendars use sunday ( not monday ) as the first day of the week.

anyway.. Great job on the desklet, its found a new home on my desktop :D

By darkliquid (Desklet Author), on Fri Mar 11 16:13:01 2005.

ZeroDivide wrote:

The only thing I noticed is that most calendars use sunday ( not monday ) as the first day of the week.


Ahh, I believe there may be a way of changing this, at should be a simple modification is so, I'll get on it and hopefully set up a config.txt option for it.

ZeroDivide wrote:

anyway.. Great job on the desklet, its found a new home on my desktop :D


Excellent! It's always nice to know when people are using your work :D

By darkliquid (Desklet Author), on Fri Mar 11 16:26:16 2005.

I've just added the option to change the first day of the week. The new release will be up shortly.

By ZeroDivide (Desklet Author), on Fri Mar 11 19:59:36 2005.

wow.. that was one quick update :shock:

By jeepston (Desklet Author), on Mon Mar 14 12:23:41 2005.

Here is what I observed: it doesn't change date by itself :? I need to restart the desklet to make it change? Am I doing something wrong? Calendar version is 0.2.1. Btw, can I somehow make cells for the dates smaller or invisible at all?

Thnx

By darkliquid (Desklet Author), on Mon Mar 14 14:12:10 2005.

The cells you can make invisible by setting the alpha to 00. For example, set all the border_color, bg_color, etc things to 'FFFFFF00' which will give whit, but at 0% transparency (in theory)

As for the updating, I'll look into that and fix it soon, I think it is just an oversight on my part from when I changed the way the code works, I'll mess around and add an update call into it.

By darkliquid (Desklet Author), on Mon Mar 14 14:48:03 2005.

Okay, I've made the fix for the updating, but I'm not 100% sure it works yet and I can't remeber how to change my system date so I'll wait till midnight to watch it change :P

I'm more or less certain it will work though as so far the desklet hasn't gone nuts with my new code (which was a very simple copy and paste job from __buildcal, an added function and one extra line.

If anyone can either test it for me or inform me how I can change date without a restart so that python will pick up the change, I'll test it before then and release it sooner.

By jeepston (Desklet Author), on Mon Mar 14 15:26:22 2005.

AFAIK, the command date is responsible for setting and displaying the system date & time. So try to play around with it. And Google, of course :)

By darkliquid (Desklet Author), on Mon Mar 14 16:19:33 2005.

Right, the problem is fixed for sure. In fact, I found some large bugs that would stop it from EVER updating or accepting events of any kind.

Well, I'll just package it up and submit it as 0.3 since some major bugs have been resolved.

By jeepston (Desklet Author), on Wed Mar 23 19:41:55 2005.

Here is another feature that I would like to see in the Calendar:

Possibility to switch the month. In case I want to take a look in a future (past) :)

Will it be comlicated to implement this feature?

By darkliquid (Desklet Author), on Thu Mar 24 05:11:09 2005.

No it wont be difficult at all. In fact, I am in the process of implementing this feature so I can enable the ability to add todos/reminders/etc to dates in different months.

However, seeing different months was to be a change made by the user at run-time by pressing a button.

What I think I will do is add a month offset config option so that by specifying something like:

month_offset: 10

would push the displayed month 10 months forwards, so instead of March 2005, you would get out January 2006.

I'll try adding this soonish.

I believe that off the top of my head this shouldn't be too hard, all it is is modifying the code in the __update() function in the Calendar class so that instead of using the hardcoded 'today()' value, it makes an additional offset aswell.

By CitizenX (Themer / Graphic Artist), on Thu Mar 24 14:48:51 2005.

with the month offset, the style changes for past days and today are still in effect. This means that when you want to see next month, it appears to be the same date but the next month over. I know its not April 24th, but it sure did look like it to my Calendar.

By syfou (Core Developer & Desklet Author), on Thu Mar 24 16:36:23 2005.

Just a quick note: I see that the dates.xml doesn't store any reference about which desklet what responsible for what entry, so I suspect, without looking at the code, that you did not consider the possibility a user might use many desklets...

Nothing wrong there (the use of having many Calendars on a desktop is not obvious), but you should at least make all instances not being ID 0 exit with a exception trace if you want to avoid nasty race conditions.

By darkliquid (Desklet Author), on Thu Mar 24 16:37:14 2005.

Crap!

Right, I'll look into it and try and rectify it soonish, all it should be is a quick hack in the __render_date_cell routines to make it check for an offset value other than 0

By darkliquid (Desklet Author), on Thu Mar 24 16:43:40 2005.

syfou wrote:

Just a quick note: I see that the dates.xml doesn't store any reference about which desklet what responsible for what entry, so I suspect, without looking at the code, that you did not consider the possibility a user might use many desklets...

Nothing wrong there (the use of having many Calendars on a desktop is not obvious), but you should at least make all instances not being ID 0 exit with a exception trace if you want to avoid nasty race conditions.


Erm, I'm not quite sure ow this will be fixed. I am thinking of two ideas at the moment:

1) Adding an attribute to the <datenotes> element to set id, and having the Calendar(s) look only it children of their own <datenotes> or creating their own ones, etc and sticking the whole lot in a <calendar> element

2) using different filenames for different id's, ie: dates_0.xml for id0 dates_1.xml for id1, etc.

All I need to do is figure out how to determine the id from within the desklet *runs off to read documentation*

By syfou (Core Developer & Desklet Author), on Thu Mar 24 16:50:17 2005.

Don't you know your own code? :lol:

Code:


# Do initialisation stuff here
# Get the config file
self.config=Config(adesklets.get_id(), join(self.basedir,'config.txt'))


The multiple file solution is by far easier, as you do not need to bother about file access when multiple instances will try to read and write data.

By darkliquid (Desklet Author), on Thu Mar 24 17:15:55 2005.

syfou wrote:

Don't you know your own code? :lol:

Code:


# Do initialisation stuff here
# Get the config file
self.config=Config(adesklets.get_id(), join(self.basedir,'config.txt'))


The multiple file solution is by far easier, as you do not need to bother about file access when multiple instances will try to read and write data.


Grrr! :P Old code that still remains from the days that this was a heavily hacked version of the mailer desklet that I'd forgotten about to be honest :P

Anyway, I've fixed the problems and have released it as version 0.4.2. Enjoy people! Check the announcement forum for details.

By cRoMo (User), on Mon Apr 11 06:07:02 2005.

Seems that I've just found a bug. Not really important, but still a bug ;)

When You swtich displayed month onwards, the days numbers are beeing displayed with the "up-to-come" color and obviously it's fine.... until reaching another year. Starting woth january 2006 all the days' numbers are beeing displayed then with "past" color, until the April - then, again, everything's OK. In other words, some of the up-to-come days' numbers are beeing colorued with "past" color.

By darkliquid (Desklet Author), on Mon Apr 11 08:54:06 2005.

Thanks for the bug report.

I'll look into it, I expect its down to legacy code laying around from when i changed the way different years and months are displayed.

I'll get on it, it should be a simple matter of altering some if statements in the day cell rendering function. Well, I hope so anyway :)

By cRoMo (User), on Fri Apr 15 11:29:32 2005.

Found another bug: when you'll drag the calendar and the instantly try to move it quick, desklet will disappear. Hope that you can reproduce it. I doubt it's related to calendar's script - it's rather adesklet's fault.

By syfou (Core Developer & Desklet Author), on Fri Apr 15 13:55:01 2005.

adesklets always preserve the content of the window, no matter how fast you move it. If the window gets flushed, it is because it was instructed to to so by the driving script.

This said, I couldn't reproduce this...

By cRoMo (User), on Fri Apr 15 15:30:25 2005.

syfou wrote:

This said, I couldn't reproduce this...

Maybe providing my configuration might be helpful?

By syfou (Core Developer & Desklet Author), on Fri Apr 15 15:38:10 2005.

cRoMo wrote:

Maybe providing my configuration might be helpful?

Unluckily, I do not think so... But who knows? Just post it, and we will see. Maybe someone else experience it?

By cRoMo (User), on Fri Apr 15 18:58:07 2005.

Code:

id0 = {'cell_padding': 2,
 'date_bg_color': 'FFFFFF00',
 'date_border_color': 'FFFFFF00',
 'date_font': 'Vera',
 'date_font_color': 'FFFFFF75',
 'date_font_size': 8,
 'date_past_bg_color': 'FFFFFF00',
 'date_past_border_color': 'FFFFFF00',
 'date_past_font': 'Vera',
 'date_past_font_color': 'FFFFFF30',
 'date_past_font_size': 8,
 'date_today_bg_color': 'FFFFFF00',
 'date_today_border_color': 'FFFFFF00',
 'date_today_font': 'Vera',
 'date_today_font_color': 'FFFFFFE0',
 'date_today_font_size': 8,
 'day_bg_color': 'FFFFFF00',
 'day_border_color': 'FFFFFF00',
 'day_font': 'VeraIt',
 'day_font_color': '00000065',
 'day_font_size': 9,
 'delay': 3600,
 'first_day_of_week': 0,
 'heading_bg_color': 'FFFFFF09',
 'heading_border_color': 'FFFFFF00',
 'heading_font': 'Georgia',
 'heading_font_color': '000000A0',
 'heading_font_size': 9,
 'month_offset': 0,
 'year_offset': 0}

By darkliquid (Desklet Author), on Sun Apr 17 06:24:18 2005.

I've also been unable to reproduce this.

By syfou (Core Developer & Desklet Author), on Tue Apr 19 19:39:21 2005, last edited on Tue Apr 19 19:45:06 2005.

cRoMo wrote:


Although I'm polish I didn't find out how to make names of clendar's days and months beeing localized. Is it possible at all without any big effort?

It is just a matter of asking for the proper locale early in the code... For polish, something like:

Code:


import locale
locale.setlocale(locale.LC_ALL,'pl_PL')



From there, you only have to adapt the config for using suitable fonts (polish is latin2, I believe?), and set the incoding to UTF8, see the documentation on internationalization support. Here is what is look like in french (latin1):

http://adesklets.sourceforge.net/verbatim/calendar_fr.jpg

By syfou (Core Developer & Desklet Author), on Tue Apr 19 19:42:42 2005.

Verbatim copy of a post by cRoMo:

I managed to localize my desklet, but found a problem. Since I've used bitstream Vera font before localazing and it didn't support iso 8859-2 encoding, I've changed font for displaying day names into Microsoft's Verdana. Unfortunately, the names are cut from the bottom, as you can see on the photo below.
I use Vera also for displaying the days numbers, so I temporarly changed the current day's number font into Verdana in order to see how will it look like comparing to Vera, and seems that I know why days names are beeing cut: Verdana is beeing displayed on the screen a couple of pixs lower than Vera. Hope it's clear for you :)

http://cromo.klej.net/problem.jpg

"Visual" description ;)

http://cromo.klej.net/problem_1.jpg

By gnoomy (User), on Fri May 13 13:06:04 2005.

hi everyone, and firstly contragulations for this job! my fluxbox is getting nice thanks to adesklets, that's great...

I'm just encountering a minor bug with the calendar: it's too short. we are in May, which is 31 days long, and beginned on a sunday. That means that 6 lines are needed to show all days this month. But my calendar only has 5... I was a bit surprised to see that there was only 29 days in May :lol:
Is it a bug or have you just forgotten the 6th line?

By Ibex (User), on Wed May 25 04:30:01 2005.

Quote:

hi everyone, and firstly contragulations for this job! my fluxbox is getting nice thanks to adesklets, that's great...

I'm just encountering a minor bug with the calendar: it's too short. we are in May, which is 31 days long, and beginned on a sunday. That means that 6 lines are needed to show all days this month. But my calendar only has 5... I was a bit surprised to see that there was only 29 days in May :lol:
Is it a bug or have you just forgotten the 6th line?

Indeed.

The calendars size is calculated by the function "self._calsize = (self._cellsize * 7)" I think. Edit it to *6 will remove all sundays and the days 23 -> 29, while editting to *8 don't fix anything. I think it would also be nice if the calendar don't needs to be square. So; 7 by 8 cells, so the monthtitle is still centred correct.
Is it possible to easy fix it by myself?

Also another little question; Why is the calendar hiding itselfs when you try to move the calendar with the mouse (without selecting "move" in its menu)?

And excuse me for the bad english. I suggest you blame my teachers :p

------- update;

I was trying to fix the thing by implement both _calsize and _calsize_height with the values 7 and 8. However, it seems like the whole script thinks that the calendar is square, and I'm getting IndexErrors the whole time. Maybe someone else who can fix this issue?

------ edit;

Oh, almost forgotten. Is it possible to give an negative offset to display the previous month?

By darkliquid (Desklet Author), on Sun May 29 06:24:12 2005.

I just fixed the problem you just mentioned. As you rightly said, it because te Calendar assumed it was square though on the worst case scenarios where Sunday is the 1st or 2nd day, the month wraps around the bottom of the desklet, losing the last few days.

I fixed it by changing all the places where is had a fixed row size of 7 (most of the fr row in xrange(0,7) areas, to use len(self._cal) instead, then had to hack some bits where it sized the window using self._calsize, self._calsize to self._calsize, self._calsize+self._cellsize.

You don't really need the above info, but its always nice to see how to solve a problem you where trying to fix :D

As for the calendar hiding when its moved, I believe this is due to adesklets its self (since every desklets I use does this, not just mine). Either way, you still see the outline for movement purposes, so it shouldn't be a problem.

It should be possible to use negative offsets, just set the 'month_offset': 0 in the config.txt to 'month_offset': -1 to see the previous month.

Anyway, don't take this as me being back on form quite yet, I have my last 2 weeks of degree course left to go, but after that I'm back in coding action (in between job hunting!) so hopefully I can address and bugs and what not that people have found. If anyone wants to help out, a nice post with a list of all the feature and bug requests people have made would be useful so I dont have to hunt through the thread for them.

By syfou (Core Developer & Desklet Author), on Sun May 29 14:53:23 2005.

Glad to hear from you, Darkliquid. I hope everything is going well for you at school. I just recall one significant bug report for Calendar while you were away (see previous page, second to last post: this is a repost by me from cRomo).

Quote:


As for the calendar hiding when its moved, I believe this is due to adesklets its self (since every desklets I use does this, not just mine). Either way, you still see the outline for movement purposes, so it shouldn't be a problem.


adesklets was designed to work well on very low-end (by today's standards) hardware, when 2D blitting was far slower: this is why you only get an stippled outline on the root window instead of a fully moving pixmap. Ibex: feel very free to modify the xwindow_move_window() function from src/xwindow.c it you want adesklets to behave differently.

By darkliquid (Desklet Author), on Sun May 29 16:35:27 2005.

I have absolutely no idea why that font problem occurs! It might be down to the way I determine the cellsize (see __getcellsize() method in CalendarDesklet class). It decides on the maximum size based on all fonts and sticks with the largest, this might cause alignment problems for fonts of different sizes.

However, I don't think thats the problem.

I'm not quite sure what the cause is, I'm not even sure if its something specific to my desklet.

Some more screenshots (preferably larger, so I can see the differences more pronounced) of various configurations would help, also, do you notice any ofsetting when comparing these different fonts in say, openoffice? I'm inclined to think its something to do with the actual fonts themselves (because it couldn't be my code of course! :P), but if it isnt I'm really stumped.

By Ibex (User), on Mon May 30 09:25:22 2005.

darkliquid wrote:

It should be possible to use negative offsets, just set the 'month_offset': 0 in the config.txt to 'month_offset': -1 to see the previous month.

Nope, when I change that value to "-1", and restart adesklets, it simplay changes the value to "[]" and refuses it to display the calender of the previous month.

By cRoMo (User), on Wed Jun 1 12:38:47 2005.

Quote:

I'm inclined to think its something to do with the actual fonts themselves (because it couldn't be my code of course! :P), but if it isnt I'm really stumped.

I quite second that, as recently I've found torsmo to have similar issue here :( Bars indicating usage of various devices are lowered in compare to texts describing what do those bars refer to. Problem appears only when I set torsmo to use xft, otherwise it's fine. I have no clue what's the reason for such a distortion, I'm trying to keep my xft libraries and fontocnfig as new as I can (limited by the releases of Ubuntu packages). Same problem appeared when I used to have Debian SID (upgraded recently to Ubuntu). I was also trying to remove my own fontconfig settings and it didn't help though. I think the problem appears when an application using xft uses two types of fonts: truetype and some other. I assume that, as when I use non-trueype font in torsmo, everything works fine, layout isn't distorted. I also think that bars in torsmorc are displayed using the same font, no matter which one you'll choose to display text descriptions.
And I have similar thoughts with adesklet's calendar - when using MS Verdana (TT font) exclusively, or Bitstream Vera (non-TT, or maybe it is?) exclusively, layout is OK.

I don't know what to do, couldn't find any hint what could be the reason for that strange behaviour. Notice, that I have all my font directires hashed-out in "Section Files" (or whatever) in xorg.conf - I only use xft for my X Windows and X apps.

By darkliquid (Desklet Author), on Wed Jun 1 15:15:12 2005.

Ibex wrote:

darkliquid wrote:

It should be possible to use negative offsets, just set the 'month_offset': 0 in the config.txt to 'month_offset': -1 to see the previous month.

Nope, when I change that value to "-1", and restart adesklets, it simplay changes the value to "[]" and refuses it to display the calender of the previous month.


How strange, Ill look into that soon, only 5 days of my degree left to go! :D

As for the font problems cRoMo, there doesn't seem to be much I can do. Maybe you have two matches for Verdana in your fonts directories, a non-TT and a TT one, and the wrong one is being used and causing this mess? I'm really quite clueless so I'm just wildy guessing now.

By darkliquid (Desklet Author), on Wed Jun 8 07:52:48 2005.

darkliquid wrote:

Ibex wrote:

darkliquid wrote:

It should be possible to use negative offsets, just set the 'month_offset': 0 in the config.txt to 'month_offset': -1 to see the previous month.

Nope, when I change that value to "-1", and restart adesklets, it simplay changes the value to "[]" and refuses it to display the calender of the previous month.


How strange, Ill look into that soon, only 5 days of my degree left to go! :D


Okay, I've hacked up a quick fix. There is now a month_offset_negative option that when set to true multiplies the month_offset by -1. Use that in conjunction with a positive month_offset to get the desired results.

I'm not sure why this is required. Is there a flaw in the Config class so that it can't handling negative numbers properly?

By cRoMo (User), on Thu Jun 16 09:34:29 2005.

syfou wrote:

cRoMo wrote:


Although I'm polish I didn't find out how to make names of clendar's days and months beeing localized. Is it possible at all without any big effort?

It is just a matter of asking for the proper locale early in the code... For polish, something like:

Code:


import locale
locale.setlocale(locale.LC_ALL,'pl_PL')



Is it possible that localized names of days and month would begin with capital letter? Just the way it is when you turn of localizing?

By syfou (Core Developer & Desklet Author), on Thu Jun 16 12:32:30 2005.

This is theorically possible manipulating the LC_CTYPE parameter with setlocale, but this proved to be unreliable in many circumstances (just grab your favorite ANSI C or POSIX 1 book for details, or eventually the unix manual page of setlocale).

This said, days and months capitalization is rarely wrong as set by default in a given locale (for instance, in us_EN, days and months start with a upper case letter, as they should). The easiest way to change this behavior is probably to force the change manually by way of direct string manupulation.

By syfou (Core Developer & Desklet Author), on Thu Jun 16 12:41:53 2005.

darkliquid wrote:


Is there a flaw in the Config class so that it can't handling negative numbers properly?

I didn't try this specific case, but negative integers are handled right in my quick experimentation with the class.

By tuxbubling (User), on Sun Sep 18 11:39:35 2005.

syfou wrote:


From there, you only have to adapt the config for using suitable fonts (polish is latin2, I believe?), and set the incoding to UTF8, see the documentation on internationalization support.


Sorry but i don't really understand this part... Is it possible to have a little example on how to do this??

By syfou (Core Developer & Desklet Author), on Sun Sep 18 15:09:30 2005.

tuxbubling wrote:


syfou wrote:


From there, you only have to adapt the config for using suitable fonts (polish is latin2, I believe?), and set the incoding to UTF8, see the documentation on internationalization support.

Sorry but i don't really understand this part... Is it possible to have a little example on how to do this??

I am not sure what you need... Let me rephrase: if you modify the python script to output elements from different locales, it will, but usually as unicode strings (this depends on too many things to be sure, really). In python lingo, those strings are said to be "unencoded". When you print them or handle them to adesklets, they are automatically "encoded" in something that reflects what your system terminal is supposed to understand (latin1, latin2, utf8, etc). Of course, you need to instruct the underlying adesklets interpreter in what charset those strings are received: UTF-8 is usually a good choice, as it degrades gracefully to fallback encodings from ISO 8859 (latin1 to latin9). A longer explanation is given in the documentation (See "Internationalization Support" from Chapter 4). Yours,

By tuxbubling (User), on Sun Sep 18 17:38:37 2005.

syfou wrote:

To instruct adesklets of the input encoding, the most simple way is to change the # -*- coding: ASCII -*- line from the desklet configuration file to fit what will be outputted by the desklet script.


Exactly what i needed thanks!

Regards
Tuxbubling

By eNTi (User), on Tue Sep 20 03:01:22 2005.

hi everyone.

i just got into the adesklet fever and i even found something i was looking for in the calendar README. i want to set an alarm for certain days. would be great, if one could color "marked days" differently and if it would show the entry if you move your mouse over it (like with gdeskcal).
my problem now is, that i can't even set the alarm. i don't know how?

update: ok, i was missing tk support in python. fixed that now and i can add notes at dates now.

still, there's no way to tell, if there's a note on a certain day or not. just make it distinguishable. add settings like "date_note_*" to set the colors.

i can't edit the days, after adding, there's just no window popping up.

a setting for an external sound program and sound file, would be good too.

i'm also not sure if the "Remove_DatesNotes" remove ALL notes or just on one date.

By darkliquid (Desklet Author), on Wed Sep 21 02:55:23 2005.

I've had a couple of people ask for this. I'm planning on rewriting the whole DateNotes section to make it more usable so hopefully I'll be able to address these issues soon.

I'm pretty busy with my new job at the moment, so I don't have a lot of time, but it's on my todo list!

By eNTi (User), on Wed Sep 21 04:13:15 2005.

something different hit me yesterday. i tried to write an alarm using a special character (like: ????...), what ultimatly killed the adesklet. i'm using utf8.

By darkliquid (Desklet Author), on Thu Sep 22 03:48:06 2005.

Yeah, all of a sudden, the whle Datenotes system has stopped working on my end completely and I don't know why, so I'm gonna redo it from scratch eventually.

If anyone else wants t have a go, feel free! The sooner people get the features they want the better!

By sash (User), on Sat Nov 19 19:48:35 2005.

I installed Calendar today and I must say that it is an outstanding desklet--both WRT eye candy and functionality. Here it is as part of my desktop:
http://art.archlinux.org/main.php?g2_view=core:DownloadItem&g2_itemId=672&g2_serialNumber=1

As you may notice I made some slight changes to the code: the current day of the week can be highlighted in a similar manner as today's date. I made the change after my wife noted that it would be nice if today's week day could be highlighted just like today's date.

This was my 1st time scripting Python, so the conditional checking might have been done better. If there is any better way of doing this please let me know.

I am also particularly interested to find out if this change works with different locales. If someone can test it, please let me know.

I made a patch (you may want to make a copy of your orig Calendar.py first):

Code:


--- Calendar.py.orig    2005-11-19 17:38:16.000000000 -0700
+++ Calendar.py 2005-11-19 16:14:31.000000000 -0700
@@ -42,6 +42,11 @@
                                        'day_font_color': '000000',
                                        'day_bg_color': 'AAAAAA',
                                        'day_border_color': '000000',
+                                       'day_today_bg_color': 'AAAAAA',
+                                       'day_today_border_color': '000000',
+                                       'day_today_font': 'VeraBd',
+                                       'day_today_font_color': 'FFFFFF',
+                                       'day_today_font_size': 12,
                                        'date_font': 'Vera',
                                        'date_font_size': 12,
                                        'date_font_color': 'AAAAAA',
@@ -112,6 +117,14 @@
                self._day_font_color = (self.config.color(self.config['day_font_color']))
                self._day_bg_color = (self.config.color(self.config['day_bg_color']))
                self._day_border_color = (self.config.color(self.config['day_border_color']))
+               self._day_today_font = adesklets.load_font('%s/%d' % (self.config['day_today_font'],
+                       
+                               self.config['day_today_font_size']))
+
+               self._day_today_font_color = (self.config.color(self.config['day_today_font_color']))
+               self._day_today_bg_color = (self.config.color(self.config['day_today_bg_color']))
+               self._day_today_border_color = (self.config.color(self.config['day_today_border_color']))
+
 
                self._date_font = adesklets.load_font('%s/%d' % (self.config['date_font'],
                                                                                                                 self.config['date_font_size']))
@@ -240,19 +253,29 @@
                adesklets.context_set_blend(True)

 
                # Draws the day cell background
-               adesklets.context_set_color(*self._day_bg_color)
+               if (datetime.date.today().strftime('%a').startswith(cell[0])):
+                       adesklets.context_set_color(*self._day_today_bg_color)
+               else:
+                       adesklets.context_set_color(*self._day_bg_color)
                adesklets.image_fill_rectangle(self._cell_padding, self._cell_padding,
                                                                                   (self._cellsize - self._cell_padding), (self._cellsize - self._cell_padding))
 
                # Draws the day cell border
-               adesklets.context_set_color(*self._day_border_color)
+               if (datetime.date.today().strftime('%a').startswith(cell[0])):
+                       adesklets.context_set_color(*self._day_today_border_color)
+               else:
+                       adesklets.context_set_color(*self._day_border_color)
                adesklets.image_draw_rectangle(self._cell_padding, self._cell_padding,
                                                                          (self._cellsize - self._cell_padding), (self._cellsize - self._cell_padding))
 
                # Draws the day cell text
-               adesklets.context_set_font(self._day_font)
+               if (datetime.date.today().strftime('%a').startswith(cell[0])):
+                       adesklets.context_set_font(self._day_today_font)
+                       adesklets.context_set_color(*self._day_today_font_color)
+               else:
+                       adesklets.context_set_font(self._day_font)
+                       adesklets.context_set_color(*self._day_font_color)
                x, y = adesklets.get_text_size(cell)
-               adesklets.context_set_color(*self._day_font_color)
                adesklets.text_draw(((self._cellsize / 2) - (x / 2)),((self._cellsize / 2) - (y / 2)),cell)
 
                # Blend day cell image into main buffer



I hope this is of use to someone.

Does anyone run this desklet with the reminder feature? If so, I wouldn't mind seeing some screenshots.

Thanks for reading through all this.

By syfou (Core Developer & Desklet Author), on Sun Nov 20 03:40:52 2005.

sash wrote:


This was my 1st time scripting Python, so the conditional checking might have been done better. If there is any better way of doing this please let me know.

This already looks fine and pythonic to me... Of course, you could have shortened it with such expressions as:

Code:


adesklets.context_set_color(*(col1, col2)[condition])


But what's the point of using Python if it has to feel like C? ;-)

sash wrote:


I am also particularly interested to find out if this change works with different locales. If someone can test it, please let me know.

It looks good with the fr_FR locale (it is not Hebrew, I agree):

http://adesklets.sourceforge.net/verbatim/cal_sash.jpg
But I am not sure I understand this; what makes you think it could cause problems? Just curious...

sash wrote:


you may want to make a copy of your orig Calendar.py first:

What about patch --reverse? ;-)

sash wrote:


I hope this is of use to someone.

It already is. Thanks for sharing this! Regards,

By sash (User), on Sun Nov 20 10:16:46 2005.

syfou wrote:


This already looks fine and pythonic to me... Of course, you could have shortened it with such expressions as:

Code:


adesklets.context_set_color(*(col1, col2)[condition])


But what's the point of using Python if it has to feel like C? ;-)


Thanks, I learned something new.


syfou wrote:


But I am not sure I understand this; what makes you think it could cause problems? Just curious...


It was untested. And I don't know how weeekday names are shortened for different locales. In general I hate to rely on string comparison. Good to see it working properly though :-)

syfou wrote:


What about patch --reverse? ;-)

I didn't know about it either--will have to look it up.

syfou wrote:


sash wrote:


I hope this is of use to someone.

It already is. Thanks for sharing this!


You are welcome. And thanks for using it--my SO is glad someone found it useful since that was her idea.

By Walt H (User), on Sun Feb 26 01:59:25 2006.

Okay, I've installed Calendar-0.5.3 and I can't get it to do what others seem able to get it to do.

I've read the stuff about configuring transparency with the Calendar desklet, but I be damned if I understand how to make it work properly. I see it can be done, but I don't understand how. The instructions say something about

darkliquid wrote:


The cells you can make invisible by setting the alpha to 00. For example, set all the border_color, bg_color, etc things to 'FFFFFF00' which will give whit, but at 0% transparency (in theory)


but what exactly does that mean? How about some examples? When I try it, I get what almost seems like transparency but with black streaks through it. I see where other desklets allow a True/False setting for transparency. Could something like that somehow work here?

All I seem to be doing when I try to change things is make it uglier.

By Walt H (User), on Sun Feb 26 11:05:30 2006.

More problems with the calendar desklet. This is what it looked like at first boot this morning:

[URL=http://img132.imageshack.us/my.php?image=calendar0ha.jpg]http://img132.imageshack.us/img132/6451/calendar0ha.th.jpg[/URL]

Nothing was changed after the snapshot of it and weatherforecast posted in that thread and repeated here:

[URL=http://img130.imageshack.us/my.php?image=weather9li.jpg]http://img130.imageshack.us/img130/6779/weather9li.th.jpg[/URL]

The background reverted back (one of the things I don't like about IceWM), but otherwise, everything remained the same in terms of configuration of the two desklets. Any thoughts? Thanks.

By syfou (Core Developer & Desklet Author), on Sun Feb 26 15:53:32 2006.

Walt H wrote:


[...] but what exactly does that mean? How about some examples? When I try it, I get what almost seems like transparency but with black streaks through it.

I am not sure what version of Calendar you have...

In Calendar-0.5.3/README, darkliquid wrote:


When setting colours, use HTML style colour codes. If you want to set alpha transparency, you can do so like this: 'FFFFFF' = fully white, 'FFFFFF80' = white at 50% transparency. Note the extra hex byte value for transparency. To remove border/backgrounds/etc just set the colour to 100% transparency

This said, black streaks are undoubtedly abnormal, and not something you should experience, no matter what you try. This combined with your other posts (here, and there) makes me think there is something wrong with the core install... More on this below.

Walt H wrote:


This is what it looked like at first boot this morning:

[URL=http://img132.imageshack.us/my.php?image=calendar0ha.jpg]http://img132.imageshack.us/img132/6451/calendar0ha.th.jpg[/URL]

That's pretty bad indeed. I am more and more convinced all the bugs you reported so far are related to a deficient Imlib2/adesklets installment: see there. Yours,

By Walt H (User), on Sun Feb 26 22:11:47 2006: setting transparency.

I read darkliquid's post about transparency, but I'm not sure what the value should be to create full transparency if FFFFFF80 is white at 50% transparency; what would white at 100% transparency look like?

By syfou (Core Developer & Desklet Author), on Mon Feb 27 01:40:47 2006.

This is often called RGBA notation: a color is noted as RRGGBBAA. Each two digits (RR, GG, BB and AA) are giving an intensity in hexadecimal for respectively the red, green, blue and alpha components of the color, with 00 (decimal: 0) being no intensity at all, and FF (decimal: 255) being full intensity.

The alpha component defines how opaque a given color is: a color with no alpha intensity (hexadecimal:00) is fully transparent; one with maximal alpha intensity (hexadecimal: FF) is fully opaque... This is called alpha compositing. Hence, any color with an alpha channel of zero (hexadecimal: 00) will be completely transparent.

_________________
Sylvain

P.-S. As mentioned before, black streaks are signs of a deeper problem that is not an expected consequence from playing with the alpha channel -- we have to solve that first.

By Walt H (User), on Mon Feb 27 22:41:45 2006.

I was able to upgrade imlib2, and that cleared the problem up. Now I just have to get the look I want. Thanks for pointing me in the right direction.

By syfou (Core Developer & Desklet Author), on Mon Feb 27 23:16:01 2006.

You are very welcomed, Walt H. I hope adesklets will prove useful to you. Yours,

By sash (User), on Sat Mar 25 18:50:24 2006: Calendar colors.

Have you come up with a color/font scheme that you worked hard to get the Calendar to look just right? Now is your chance to share your creation with everybody. Here are some of mine...

The first one has sort of chocolate colors. It goes well with brownish looking wallpapers, the Ubuntu theme for example:

Code:

# -*- coding: ASCII -*-
#
#       This is Calendar.py desklet configuration file;
#       
id0 = {'cell_padding': 2,
 'date_bg_color': '804A17AA',
 'date_border_color': '000000',
 'date_font': 'Vera',
 'date_font_color': 'AAAAAA',
 'date_font_size': 12,
 'date_past_bg_color': '55555533',
 'date_past_border_color': '00000099',
 'date_past_font': 'Vera',
 'date_past_font_color': 'AAAAAA99',
 'date_past_font_size': 12,
 'date_today_bg_color': '804A17AA',
 'date_today_border_color': '000000',
 'date_today_font': 'VeraBd',
 'date_today_font_color': 'FFFFFF',
 'date_today_font_size': 12,
 'day_bg_color': 'CC9360AA',
 'day_border_color': '000000',
 'day_font': 'Vera',
 'day_font_color': '000000',
 'day_font_size': 12,
 'day_today_bg_color': 'CC9360AA',
 'day_today_border_color': '000000',
 'day_today_font': 'VeraBd',
 'day_today_font_color': 'FFFFFF',
 'day_today_font_size': 12,
 'delay': 3600,
 'first_day_of_week': 6,
 'heading_bg_color': '00ffcc55',
 'heading_border_color': '000000',
 'heading_font': 'Vera',
 'heading_font_color': 'CC9360',
 'heading_font_size': 14,
 'month_offset': 0,
 'month_offset_negative': False,
 'year_offset': 0,
 'year_offset_negative': False}



Here is one that has blue-ish colors, I discovered an XP-looking style for Fluxbox, so I changed the colors to match:

Code:


# -*- coding: ASCII -*-
#
#       This is Calendar.py desklet configuration file;
#       
id0 = {'cell_padding': 2,
 'date_bg_color': 'FFFFFF99',
 'date_border_color': '000000',
 'date_font': 'Vera',
 'date_font_color': '000000',
 'date_font_size': 12,
 'date_past_bg_color': '55555533',
 'date_past_border_color': '00000099',
 'date_past_font': 'Vera',
 'date_past_font_color': 'FFFFFFAA',
 'date_past_font_size': 12,
 'date_today_bg_color': '2293FFAA',
 'date_today_border_color': '000000',
 'date_today_font': 'VeraBd',
 'date_today_font_color': 'FFFFFF',
 'date_today_font_size': 12,
 'day_bg_color': 'FFFFFF99',
 'day_border_color': '000000',
 'day_font': 'Vera',
 'day_font_color': '000000',
 'day_font_size': 12,
 'day_today_bg_color': '2293FFAA',
 'day_today_border_color': '000000',
 'day_today_font': 'VeraBd',
 'day_today_font_color': 'FFFFFF',
 'day_today_font_size': 12,
 'delay': 3600,
 'first_day_of_week': 6,
 'heading_bg_color': '0066cc55',
 'heading_border_color': 'FFFFFF',
 'heading_font': 'Vera',
 'heading_font_color': 'FFFFFF',
 'heading_font_size': 14,
 'month_offset': 0,
 'month_offset_negative': False,
 'year_offset': 0,
 'year_offset_negative': False}

By Damageplan (User), on Fri Apr 28 06:01:03 2006.

Sorry for my stupid question, but how can i apply the patch from sash!
Thanks for your help!

Matthias

By schlum (User), on Fri Apr 28 09:31:33 2006.

Hello
Save the page into a file (e.g. Calendar.py.patch)
Go to the folder where Calendar.py is located and do a
patch -p1 < /path/to/Calendar.py.patch

By pillzdb (User), on Mon Dec 4 18:49:15 2006: Calendar bug.

Hey all,

Loving the Calendar adesklet.

However, with the onset of the new year, I've discovered what I believe to be a bug in the Calendar.py code (using Calendar-0.5.3). In addition to the current month, I have a 3-month setup with the previous and next months as well. For some reason, the next month is not using the appropriate bg colours that I have specified in the config.txt file -- perhaps due to some malformed date comparison code in the python script. See the below image (I would expect all of my January 2007 days to follow the date_bg_color rules but they seem to instead be using the date_past_bg_color instead...):

http://img371.imageshack.us/img371/9529/adeskletscalendarbugkw6.png

I am not too familiar with how this python gui stuff works so have not been able to fix this. Perhaps one of the core developers could fix this easily.

Other than this minor issue, I really like how light-weight these desklets are... Running them without anything related to gnome in xfce4 ;)


adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.