Difference between revisions of "Features/GTK3/API wish list"

From Sugar Labs
< Features‎ | GTK3
Jump to navigation Jump to search
(Created page with "=Summary= There are a lot of code copy/pasted in the activities, and we can provide a easier API to new/occasional developers. Would be good use the change to GTK3 to improve ou...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Summary=
+
<noinclude>[[Category:Wish list]]
 +
</noinclude>
 +
==Summary==
  
 
There are a lot of code copy/pasted in the activities, and we can provide a easier API to new/occasional developers.
 
There are a lot of code copy/pasted in the activities, and we can provide a easier API to new/occasional developers.
Line 5: Line 7:
 
This pages is right now, to discuss ideas, and collect useful information.
 
This pages is right now, to discuss ideas, and collect useful information.
  
=Owner=
+
==Owner==
  
 
The Activity Team  
 
The Activity Team  
  
=Ideas=
+
==Ideas==
  
== Toolbar items factory methods ==
+
=== Toolbar items factory methods ===
  
 
Walter use in his activities factory methods to create buttons, separators, entry, etc.
 
Walter use in his activities factory methods to create buttons, separators, entry, etc.
Line 43: Line 45:
  
 
We can add methods like create_button, create_label and create_entry to the toolbar
 
We can add methods like create_button, create_label and create_entry to the toolbar
 +
 +
=== Code to enable/disable power management===
 +
 +
Many activities have code to deal with pm.
 +
 +
=== Code to recognize XO-1, XO-1.5, XO-1.75 and other hardware===
 +
 +
A few activities repeat code to recognize hardware.
 +
 +
More problems ahead http://dev.laptop.org/ticket/11116

Latest revision as of 15:38, 9 August 2011


Summary

There are a lot of code copy/pasted in the activities, and we can provide a easier API to new/occasional developers. Would be good use the change to GTK3 to improve our small sugar-toolkit/sugar APIs This pages is right now, to discuss ideas, and collect useful information.

Owner

The Activity Team

Ideas

Toolbar items factory methods

Walter use in his activities factory methods to create buttons, separators, entry, etc. This remove a lot of duplicated code. Example:

def _label_factory(label, toolbar):
    Factory for adding a label to a toolbar 
   my_label = gtk.Label(label)
   my_label.set_line_wrap(True)
   my_label.show()
   _toolitem = gtk.ToolItem()
   _toolitem.add(my_label)
   toolbar.insert(_toolitem, -1)
   _toolitem.show()
   return my_label


def _entry_factory(length, toolbar, callback):
    Factory for adding a text enrty to a toolbar 
   my_entry = gtk.Entry()
   my_entry.set_max_length(length)
   my_entry.set_width_chars(length)
   my_entry.connect('changed', callback)
   my_entry.show()
   _toolitem = gtk.ToolItem()
   _toolitem.add(my_entry)
   toolbar.insert(_toolitem, -1)
   _toolitem.show()
   return my_entry

We can add methods like create_button, create_label and create_entry to the toolbar

Code to enable/disable power management

Many activities have code to deal with pm.

Code to recognize XO-1, XO-1.5, XO-1.75 and other hardware

A few activities repeat code to recognize hardware.

More problems ahead http://dev.laptop.org/ticket/11116