We are trying to implement rounded corners with pygtk. The only solution way to do it is to use cairo afaik. Can some1 help us out with that. Code snippets would be awesome. We need it for the day headers. Also u might like to help us hack the calendar as seen on the mockups from the previous post. Cheers
You can find me on
StatPress
Visits today: 479Administration
Blogroll










{ 16 } Comments
http://pastebin.com/m2d42adae
The code for bzr viz uses cairo.
See
http://bazaar.launchpad.net/~bzr-gtk/bzr-gtk/trunk/annotate/head%3A/branchview/graphcell.py#L131
Checkout the comments: http://www.bani.com.br/lang/pt-br/2009/11/rounded-boxes-in-gtk/
def rounded_rectangle(cr, x, y, w, h, r):
cr.new_path()
cr.move_to(x+r, y)
cr.line_to(x+w-r, y)
cr.curve_to(x+w, y, x+w, y, x+w, y+r)
cr.line_to(x+w, y+h-r)
cr.curve_to(x+w, y+h, x+w, y+h, x+w-r, y+h)
cr.line_to(x+r, y+h)
cr.curve_to(x, y+h, x, y+h, x, y+h-r)
cr.line_to(x, y+r)
cr.curve_to(x, y, x, y, x+r, y)
cr.close_path()
hi Seif.
You could check the screenlets code (drawing module), it has a toon of rounded rectangles even with shadows and stuff…
best regards whise
There are 3 methods on cairo cookbook:
http://www.cairographics.org/cookbook/roundedrectangles/
global PI, PI_OVER_180
cr.new_sub_path()
cr.arc(r+x, r+y, r, PI, 270*PI_OVER_180)
cr.arc(w-r, r+y, r, 270*PI_OVER_180, 0)
cr.arc(w-r, h-r, r, 0, 90*PI_OVER_180)
cr.arc(r+x, h-r, r, 90*PI_OVER_180, PI)
cr.close_path()
This will give you a rounded rectangle at x, y, with corner radius r and width and height w, h.
PI and PI_OVER_180 should be obvious
Just a thought, but have you considered implementing the interface using HTML instead? Rounded corners and a whole lot more become fairly easy that way. Just link to libwebkit…
Or just use Qt and PyQt or PySide
We have some rounded squares in Getting Things GNOME!
You can see a really short example at comment #13 of the following bug :
https://bugs.edge.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/458545
I know this comment is not related to this post, but to Zeitgeist.
I thing it would be cool to have a FacetZoom for the timeline what do you think?
http://river-valley.tv/facetzoom/
http://advancingusability.wordpress.com/2008/03/31/facetzoom-first-open-source-release/
http://git.gnome.org/browse/hamster-applet/tree/hamster/graphics.py#n123
I actually was working on that(and making the next button stop behaving like a fortune teller) for the last few hours, after I noticed your last blog post with the example screenshots.
Here is my branch:
https://code.launchpad.net/~email-tehk/gnome-activity-journal/various-adjustments
Currently I do not have the colors correct, but that is just another line or two that I will work on when I wake up.
I was actually working on that tonight, before I even noticed this post. I started after I updated my branch and settled into making the next button nolonger a oracle who likes to show you the admittedly empty future. After that noticed the screenshots you posted and decided to play around with cairo.
My branch is here:
https://code.launchpad.net/~email-tehk/gnome-activity-journal/various-adjustments
It works, but colors and resizing are a bit wacky but those are just another few lines. Just have to have find the gtk selected color and use that instead of the green I have there now.
@Randal Barlow
On the Next button, you are supposed to be able to drag documents into the future for marking them as bookmarked for that particular day.
From http://live.gnome.org/Zeitgeist/UseCases:
«Mundungus is tired of working and decides he’ll finish what he’s working on next Monday. He opens the Journal and creates an “activity group” in the area for Monday and uses the “Save currently open resources” option to place everything he’s currently using there; he also drags some additional resources (files, websites, contacts, etc.) he used earlier this day into the group box. Once that’s done, he can close everything he’s doing and focus on watching his favorite lolcat pictures, without worrying about not finding his resources again.»
(However, note that the stuff on that page is just to give some ideas of stuff we’d like to see in the desktop of tomorrow, it doesn’t need to be exactly as described and some of the stuff can’t be done with Zeitgeist alone).
About going into the future, you’re supposed to be able to drag stuff there to bookmark it for that particular day. There’s also an idea of showing calendar entries in the Journal.
Eg., from http://live.gnome.org/Zeitgeist/UseCases (*):
«Mundungus is tired of working and decides he’ll finish what he’s working on next Monday. He opens the Journal and creates an “activity group” in the area for Monday and uses the “Save currently open resources” option to place everything he’s currently using there; he also drags some additional resources (files, websites, contacts, etc.) he used earlier this day into the group box. Once that’s done, he can close everything he’s doing and focus on watching his favorite lolcat pictures, without worrying about not finding his resources again.»
(* Note that the UseCases page is just a random list of stuff we imagine as possibilities for the desktop of tomorrow. They don’t need to be exactly as described and not all of the stuff there is possible with Zeitgeist alone but needs additional infrastructure).
{ 2 } Trackbacks
[...] search Seif Lotfy: Help us with some python+cairo (GNOME Activity Journal) is now available in this link…: News [...]
[...] Found this interesting post today, here is a quick excerpt of it: We need it for the day headers. Also u might like to help us hack the calendar as seen on the mockups from the previous post. Cheers. Categories: Uncategorized Tags: Comments (16) Trackbacks (1) Leave a comment Trackback … Read the rest of this great post Here [...]
Post a Comment