SUGAR JOURNEY

21.01.2010

The first and foremost task for playing with sugar is obviously installing it and that can be done by “yum groupinstall sugar-desktop” and then you can have fun playing with it. If you are going for development then you need to follow “http://wiki.sugarlabs.org/go/Development_Team/Jhbuild” . Today i am going through the various control-panel settings and codes for sugar “http://git.sugarlabs.org/projects/sugar/repos/mainline/trees/master/extensions/cpsection” . I also wrote a small code for font panel with the help of gnome documentations

#!/usr/bin/env python

import pygtk
pygtk.require(‘2.0’)
import gtk

class FontButtonExample:
def __init__(self):
window = gtk.Window()
window.connect(‘destroy’, lambda w: gtk.main_quit())
vbox = gtk.VBox()
window.add(vbox)
hbox = gtk.HBox()
vbox.pack_start(hbox, False)
label = gtk.Label(‘Current Font:’)
hbox.pack_start(label, False)
fontbutton = gtk.FontButton(‘Monospace Italic 14’)
fontbutton.set_use_font(True)
fontbutton.set_title(‘Select a font’)
fontbutton.connect(‘font-set’, self.font_set_cb)
hbox.pack_start(fontbutton)
self.fontbutton = fontbutton
bbox = gtk.HButtonBox()
vbox.pack_start(bbox, False)
b = gtk.ToggleButton(”, False)
b.connect(‘toggled’, self.use_font_cb)
b.set_active(True)
bbox.pack_start(b)
b = gtk.ToggleButton(”, False)
b.connect(‘toggled’, self.use_size_cb)
b.set_active(False)
bbox.pack_start(b)
b = gtk.ToggleButton(”, False)
b.connect(‘toggled’, self.show_style_cb)
b.set_active(True)
bbox.pack_start(b)
b = gtk.ToggleButton(”, False)
b.connect(‘toggled’,  self.show_size_cb)
b.set_active(True)
bbox.pack_start(b)
window.show_all()
return
def use_font_cb(self, togglebutton):
self.fontbutton.set_use_font(togglebutton.get_active())
return
def use_size_cb(self, togglebutton):
self.fontbutton.set_use_size(togglebutton.get_active())
return
def show_style_cb(self, togglebutton):
self.fontbutton.set_show_style(togglebutton.get_active())
return
def show_size_cb(self, togglebutton):
self.fontbutton.set_show_size(togglebutton.get_active())
return
def font_set_cb(self, fontbutton):
font = fontbutton.get_font_name()
print ‘You have selected the font:’, font
return

def main():
gtk.main()

if __name__ == ‘__main__’:
cbe = FontButtonExample()
main()

I also went through writting Makefile for font-panel and the __init__.py files. Need to concentrate on coding after the design is fixed i.e will be done by saturday in the meeting (design will be fixed). Got good feedback on designs i proposed for the font-panels. Looking forward on working things out.

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: