THE SUGAR FONT PANEL

As i mentioned few days before in my blog about the sugar font panel i was making, is done and would like to disscuss the technical stuffs related to it and the proccess of its turning it on. It all started with playing of the codes which i got from (http://git.sugarlabs.org/projects/sugar/repos/mainline/trees/master/extensions/cpsection) , i started with codes of frame (one of sugar control panel extension for changing the frame view etc). First of all i set the development environment hoping into(http://wiki.sugarlabs.org/go/Jhbuild).

Basically we need four files to make a control panel extension for sugar i.e Makefile.am, view.py, model.py, _init_.py, in the process of building two more files Makefile.in and Makefile gets generated. Then you need to place you extensions icon in sugar/data/icon directory.

Other than that you need to git add the icon of the extension by git add data/icons/<iconname> in my case it was git add format-text-size.svg. After doing all these stuff you need to edit few more files which i will be explaining with screenshots.

The first one is editting the Makefile.am in data/icon directory.

Then you need to edit configure.ac in source/sugar directory by extensions/cpsection/<extension name>/Makefile

You also need to edit Makefile.am in sugar/extensions/cpsection.

Finally all edits are done and now there are few basic commands you need to go through it.

-./autogen.sh –prefix=/home/yevelempy/sugar-jhbuild/install

-make install

Every time you change the codes of  Model.py, view.py or _init_.py, you need to run “Make install” inside sugar-jhbuild/source/sugar and if you change configure.ac or any Makefile.am files you need to run autogen.sh.Finally things were over and i could my icon showing up and i was happy but now came the original fun 😉

I started just by copying codes of frame panel with few bit of changes and results were awsome :P, The original mockup which was like .

was looking something like(below) this in the beginning after my cutting and pasting of codes.

Then the results started improving a bit as i digged depper into python and pygtk stuff(although i was lazy and took time to get the stuff done and still lot needs to be done). The later results were on path of improvement

And then

Finally things came down to

Now came the issue of inserting labels and marks as you can see in original mockup, ” | ”  and labels like Default, Small, Large etc. With the help of folks from #sugar i could get up to the exact function which turned up as a magic wand ” self._font_size_slider.add_mark(co-ordinates,gtk.POS_BOTTOM,_(‘Label name’))” . Now i could get things upto

And finally things scalled down to the original mockup. You need to run the gconftool -2 command to set the gconf values and see the changes, the command goes like “gconftool -2  –get  /desktop/sugar/font/font_size” in my case. Now you will get your desired thngs done. Although there are few points which still needs to be read and done pretty well.

My codes can be found at ” http://git.sugarlabs.org/projects/sugar/repos/yevlempy/commits/973b0bd9def313cf6cf9ffea967c4626ebb9ffc6 “. Will be updating on my later improvements. yo !!

Advertisements

About yevlempy
A foodie, a cleartripper, a linux geek!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: