Skip to content

Help us with some python+cairo (GNOME Activity Journal)

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

{ 16 } Comments

  1. cgable | January 7, 2010 at 1:45 am | Permalink

    http://pastebin.com/m2d42adae

  2. Gary van der Merwe | January 7, 2010 at 1:51 am | Permalink

    The code for bzr viz uses cairo.

    See
    http://bazaar.launchpad.net/~bzr-gtk/bzr-gtk/trunk/annotate/head%3A/branchview/graphcell.py#L131

  3. Jonh Wendell | January 7, 2010 at 1:54 am | Permalink

    Checkout the comments: http://www.bani.com.br/lang/pt-br/2009/11/rounded-boxes-in-gtk/

  4. Stuart Jansen | January 7, 2010 at 2:15 am | Permalink

    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()

  5. whise | January 7, 2010 at 2:23 am | Permalink

    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

  6. Luiz Armesto | January 7, 2010 at 2:33 am | Permalink

    There are 3 methods on cairo cookbook:

    http://www.cairographics.org/cookbook/roundedrectangles/

  7. Matthew | January 7, 2010 at 5:11 am | Permalink

    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 :)

  8. Anonymous | January 7, 2010 at 5:35 am | Permalink

    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…

  9. Cypher | January 7, 2010 at 7:58 am | Permalink

    Or just use Qt and PyQt or PySide ;)

  10. Ploum | January 7, 2010 at 8:59 am | Permalink

    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

  11. Tobias | January 7, 2010 at 10:30 am | Permalink

    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/

  12. tm | January 7, 2010 at 10:42 am | Permalink

    http://git.gnome.org/browse/hamster-applet/tree/hamster/graphics.py#n123

  13. Randal Barlow | January 7, 2010 at 12:22 pm | Permalink

    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.

  14. Randal Barlow | January 7, 2010 at 12:26 pm | Permalink

    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.

  15. RainCT | January 7, 2010 at 11:43 pm | Permalink

    @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).

  16. RainCT | January 7, 2010 at 11:46 pm | Permalink

    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

  1. [...] search Seif Lotfy: Help us with some python+cairo (GNOME Activity Journal) is now available in this link…: News [...]

  2. [...] 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

Your email is never published nor shared. Required fields are marked *