-
 KDE-Apps.org Applications for the KDE-Desktop 
 GTK-Apps.org Applications using the GTK Toolkit 
 GnomeFiles.org Applications for GNOME 
 MeeGo-Central.org Applications for MeeGo 
 CLI-Apps.org Command Line Applications 
 Qt-Apps.org Free Qt Applications 
 Qt-Prop.org Proprietary Qt Applications 
 Maemo-Apps.org Applications for the Maemo Plattform 
 Java-Apps.org Free Java Applications 
 eyeOS-Apps.org Free eyeOS Applications 
 Wine-Apps.org Wine Applications 
 Server-Apps.org Server Applications 
 apps.ownCloud.com ownCloud Applications 
--
-
 KDE-Look.org Artwork for the KDE-Desktop 
 GNOME-Look.org Artwork for the GNOME-Desktop 
 Xfce-Look.org Artwork for the Xfce-Desktop 
 Box-Look.org Artwork for your Windowmanager 
 E17-Stuff.org Artwork for Enlightenment 
 Beryl-Themes.org Artwork for the Beryl Windowmanager 
 Compiz-Themes.org Artwork for the Compiz Windowmanager 
 EDE-Look.org Themes for your EDE Desktop 
--
-
 Debian-Art.org Stuff for Debian 
 Gentoo-Art.org Artwork for Gentoo Linux 
 SUSE-Art.org Artwork for openSUSE 
 Ubuntu-Art.org Artwork for Ubuntu 
 Kubuntu-Art.org Artwork for Kubuntu 
 LinuxMint-Art.org Artwork for Linux Mint 
 Arch-Stuff.org Art And Stuff for Arch Linux 
 Frugalware-Art.org Themes for Frugalware 
 Fedora-Art.org Artwork for Fedora Linux 
 Mandriva-Art.org Artwork for Mandriva Linux 
--
-
 KDE-Files.org Files for KDE Applications 
 OpenTemplate.org Documents for OpenOffice.org
 GIMPStuff.org Files for GIMP
 InkscapeStuff.org Files for Inkscape
 ScribusStuff.org Files for Scribus
 BlenderStuff.org Textures and Objects for Blender
 VLC-Addons.org Themes and Extensions for VLC
--
-
 KDE-Help.org Support for your KDE Desktop 
 GNOME-Help.org Support for your GNOME Desktop 
 Xfce-Help.org Support for your Xfce Desktop 
--
openDesktop.orgopenDesktop.org:   Applications   Artwork   Linux Distributions   Documents    LinuxDaily.com    Linux42.org    OpenSkillz.com   
 
Artwork
News
Groups
Knowledge
Events
Forum
People
Jobs
Register
Login


Sponsoring


-
- Content .- Fans  .- Knowledge Base  . 

HelloWorldScreenlet

   0.1  

Desklets

Score 57%
HelloWorldScreenlet
zoom


Link:  http://
Downloads:  2272
Submitted:  Oct 9 2007
Updated:  Oct 10 2007

Description:

This is a demonstration screenlet, not for use by normal users. The code is commented extensively to help developers understand how to code screenlets, and to provide them with an example of screenlet that has updating text on a simple background. Hopefully this demonstration screenlet will allow you to understand how a screenlet is coded and allow you to code desklets of your own to better Gnome.




Changelog:

*Fixed Possible Memory Leak in draw_text() definition

**Changed the draw_text() definition to accept values for font type and the width of the "drawing area"




LicenseGPL
Send to a friend
Subscribe
Other  Artwork  from mkoehle1
Report inappropriate content



-

 aa

 
 by Whise on: Oct 9 2007
 
Score 50%

self.draw_text(ctx, '<b>' + self.mytext + '</b>', 10, 10, 10)


where did you find this? is it on the latest bzr? what does the 10,10,10 represent?

nice job


Check out my Screenlets here

http://gnome-look.org/usermanager/search.php?username=Whise&action=contents

Reply to this

-

 Re: aa

 
 by mkoehle1 on: Oct 9 2007
 
Score 50%

Whise,

No, it isn't part of the bzr, I just have it defined below:

=======================================

# This is a user defined function that will tell python how to draw the text onto the background
def draw_text(self, ctx, value, x, y, size):

=======================================

The 10,10,10 represents the x coordinate, y coordinate, and the font size. Therefore, I decided to have the drawing position start 10 pixels from left of the background and 10 pixels down from the top of the background, and I decided to use size 10 font. Thanks for asking for clarification.


Michael W. Koehler
Reply to this

-

 Re: aa

 
 by Whise on: Oct 9 2007
 
Score 50%

nevermind i just saw you def...

you wrote it your self?

i should warn you that you shouldnt make people use yor funtion because of several things

you should check out this topic

http://forum.compiz-fusion.org/showthread.php?t=3576&highlight=memory+leak

because in the way you draw your text there is a memory leak , that can become very severe so i advise you to read the topic

also you should allow people to select the width of the text area pago allows you to do that


Check out my Screenlets here

http://gnome-look.org/usermanager/search.php?username=Whise&action=contents

Reply to this

-

 Re: Re: aa

 
 by Whise on: Oct 9 2007
 
Score 50%

sorry for the spelling :)


Check out my Screenlets here

http://gnome-look.org/usermanager/search.php?username=Whise&action=contents

Reply to this

-

 Re: Re: aa

 
 by mkoehle1 on: Oct 9 2007
 
Score 50%

Whise,

Great catch - I hadn't thought about this. I fixed that problem in the draw_text() def, but I didn't add the option to change the text width yet. I'll add that in when I get a chance - Thanks for the pointer.


Michael W. Koehler
Reply to this

-

 Re: Re: Re: aa

 
 by Whise on: Oct 10 2007
 
Score 50%

could you also implement the font option? that would be nice, if you implement those 2 i think you should contact rix and ask him about implementing the draw_text function in the screenlets core, making the life easyier for devs


Check out my Screenlets here

http://gnome-look.org/usermanager/search.php?username=Whise&action=contents

Reply to this

-

 Re: Re: Re: Re: aa

 
 by mkoehle1 on: Oct 10 2007
 
Score 50%

Whise,

I've changed the draw_text() definition to be as follows:

=====================================
def draw_text(self, ctx, value, x, y, width, font, size):
=====================================

The added options are 'width' and 'font', which are variables representing the width of the drawing area and the font type, respectively. Please tell me if there is anything else that you would like me to modify.


Michael W. Koehler
Reply to this

-

 Re: Re: Re: Re: Re:

 
 by Whise on: Oct 10 2007
 
Score 50%

seems really good now , if you can only add the option to set a default font in case the font doesnt get specified (maybe sans), after that maybe you should contact RYX and see if he can get this funtion into the core seems really helpfull

nice job


Check out my Screenlets here

http://gnome-look.org/usermanager/search.php?username=Whise&action=contents

Reply to this

-

 Re: Re: Re: Re: Re:

 
 by Whise on: Oct 10 2007
 
Score 50%

ohh and i forgot , also there is need for the option for text color , maybe that should be specified outside the function


Check out my Screenlets here

http://gnome-look.org/usermanager/search.php?username=Whise&action=contents


Add commentBack






-
 
 
 Who we are
Contact
More about us
Frequently Asked Questions
Register
Twitter
Blog
Explore
Artwork
Jobs
Knowledge
Events
People
Updates on identi.ca
Updates on Twitter
Facebook App
Content RSS   
Events RSS   

Participate
Groups
Forum
Add Artwork
Public API
About GNOME-Look.org
Legal Notice
Spreadshirt Shop
CafePress Shop
Advertising
Sponsor us
Report Abuse
 

Copyright 2003-2014 GNOME-Look.org Team  
All rights reserved. GNOME-Look.org is not liable for any content or goods on this site.
All contributors are responsible for the lawfulness of their uploads.
GNOME and the foot logo are trademarks of the GNOME Foundation.