HelloWorldScreenlet

Conky

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

0
Become a Fan
5.0

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.
Last 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"


Ratings & Comments

9 Comments

Whise

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

mkoehle1

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.

Whise

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

Whise

sorry for the spelling :)

mkoehle1

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.

Whise

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

mkoehle1

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.

Whise

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

Whise

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

Pling
0 Affiliates
Details
license
version 0.1
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 0

Other Conky:

System Status
Whise
last update date: 17 years ago

Score 5.0

Genetic code
Whise
last update date: 17 years ago

Score 5.0

BCCRScreenlet
gartuz
last update date: 17 years ago

Score 5.0

Diggler
Whise
last update date: 17 years ago

Score 5.0

Comic
Whise
last update date: 17 years ago

Score 5.0

Clear-enGlish Theme pack (Picframe Theme
ClearenGlish
last update date: 17 years ago

Score 4.7