Changes

Line 9: Line 9:  
# Comment on IRC about the Activity that you are going to Port (#sugar on irc.freenode.net)
 
# Comment on IRC about the Activity that you are going to Port (#sugar on irc.freenode.net)
 
# Run this [http://git.gnome.org/browse/pygobject/tree/pygi-convert.sh script] that will convert automatically things as much as it can. This is to avoid some stressful manually conversions that a "simple script" can do using ''sed'' :)
 
# Run this [http://git.gnome.org/browse/pygobject/tree/pygi-convert.sh script] that will convert automatically things as much as it can. This is to avoid some stressful manually conversions that a "simple script" can do using ''sed'' :)
# Convert all the <tt>from sugar. import</tt> to <tt>from sugar</tt>'''3'''<tt>. import</tt>
+
# Convert all the <tt>from sugar.* import</tt> to <tt>from sugar</tt>'''3'''<tt>.* import</tt> using [http://dev.laptop.org/~manuq/sugar-convert.sh this script]
 
# Follow the [[Development_Team/Code_guidelines|Code Guidelines]] during all the porting process
 
# Follow the [[Development_Team/Code_guidelines|Code Guidelines]] during all the porting process
 
# Remove all things related with '''old toolbar''' support. They are no longer maintained
 
# Remove all things related with '''old toolbar''' support. They are no longer maintained
# Write comments on the code, by adding "# README:", "# TODO:" and "# FIXME" explaining what are the problems that you are having with that chunk of code. Put a link if it's necessary
+
# Write comments on the code, by adding '''# README:''', '''# TODO:''' and '''# FIXME:''' explaining what are the problems that you are having with that chunk of code. Put a link if it's necessary
 
# If you are considering to fix some ''pep8'' or ''pylint'' errors/warnings, please create two separate patch files (one for the port and one for the pylint/pep8 changes). If we follow this way it is easier to check the port patches, if not the information about the port itself it's difficult to follow
 
# If you are considering to fix some ''pep8'' or ''pylint'' errors/warnings, please create two separate patch files (one for the port and one for the pylint/pep8 changes). If we follow this way it is easier to check the port patches, if not the information about the port itself it's difficult to follow
 
# Keep reading this wiki page to find out more things that you should do
 
# Keep reading this wiki page to find out more things that you should do
Line 71: Line 71:     
  sugar-launch org.laptop.sugar.GetBooksActivity
 
  sugar-launch org.laptop.sugar.GetBooksActivity
 +
 +
See also [[Development Team/Debugging]].
    
== Check logs with ''multitail'' ==
 
== Check logs with ''multitail'' ==
Line 97: Line 99:  
  cd pygobject
 
  cd pygobject
 
  git grep GdkPixbuf
 
  git grep GdkPixbuf
 +
 +
== Monitoring DBus ==
 +
 +
Not sure how this command works, but it can give us an interesting information. If you run this command and plug an USB drive you will see useful information
 +
 +
dbus-monitor --system
    
= Code Snippets =
 
= Code Snippets =
Line 167: Line 175:  
== Using Pixbuf ==
 
== Using Pixbuf ==
   −
As I said, this is what I did, but maybe is not the correct way to do it or there is a better way. I think that if we are porting an Activity we can take advantage of this and improve the code. manuq told me that the image handling now is done with cairo, so we should port that to cairo. I didn't do this yet, but I'm researching about this.
+
As I said, this is what I did, but maybe is not the correct way to do it or there is a better way. I think that if we are porting an Activity we can take advantage of this and improve the code. manuq told me that the image handling now is done with Cairo, so we should port that to cairo. Although, I didn't do this because I consider that the image handling done in Get Books is really simple and we don't have the necessity to use Cairo here.
    
So, what I did is keep using Pixbuf with Gtk3 version of the Activity. We need to replace and import some things:
 
So, what I did is keep using Pixbuf with Gtk3 version of the Activity. We need to replace and import some things:
Line 212: Line 220:     
  GdkPixbuf.InterpType.BILINEAR
 
  GdkPixbuf.InterpType.BILINEAR
 +
 +
 +
=== Save the GdkPixbuf into a buffer ===
 +
 +
This was very difficult to find out. The gtk2 version of the code was using <tt>pixbuf.save_to_callback</tt> to save the Image on the Journal's Preview Entry but that function no longer exist in Gtk3. So, I found a similar one called <tt>pixbuf.save_to_callbackv</tt> that I couldn't find out how to use it. Even more, I realized that this function call another callback function that doesn't do so much. Reading I found an alternative (and easier) way to do this using <tt>pibuxf.save_to_bufferv</tt>:
 +
 +
succes, data = pixbuf2.save_to_bufferv('png', [], [])
    
= Notes =
 
= Notes =
Line 229: Line 244:  
* <tt>Gtk.ListStore</tt> doesn't have the method '''.reorder'''. There is a [https://bugzilla.gnome.org/show_bug.cgi?id=677941 ticket] reported upstream about this.
 
* <tt>Gtk.ListStore</tt> doesn't have the method '''.reorder'''. There is a [https://bugzilla.gnome.org/show_bug.cgi?id=677941 ticket] reported upstream about this.
 
* Should I use the Sugar's Palette instead of Gtk.Menu?
 
* Should I use the Sugar's Palette instead of Gtk.Menu?
 +
* I replaced the use of <tt>dbus</tt> by [http://developer.gnome.org/gio/unstable/pt02.html Gio] to monitor the (dis)connection of pen drives
    
= Missing / Problematic things (not ported yet) =
 
= Missing / Problematic things (not ported yet) =
    
* [<span style="color: green;">DONE</span>] <del>When a book is downloaded, the cover is not saved in the Journal Entry</del>
 
* [<span style="color: green;">DONE</span>] <del>When a book is downloaded, the cover is not saved in the Journal Entry</del>
* Cancel search button. It shows a really big '''X''' when you start typing: http://bugs.sugarlabs.org/ticket/3385
  −
* Clicking some things on the screen makes the ListView grows a bit and it doesn't fit on the screen (the right scroll-bar goes outside the window)
   
* [<span style="color: green;">DONE</span>] <del>Switch the results to '''Internet Archive''' doesn't work</del>
 
* [<span style="color: green;">DONE</span>] <del>Switch the results to '''Internet Archive''' doesn't work</del>
* Some time when I click on the Search Entry all the toolbar is moved a bit
+
* [<span style="color: orange;">ALTERNATIVE</span>] When the "generic book image" is shown (at the bottom left), the gray color used to fill it is not the same as the background. ''I changed the color with is the GdkPixbuf filled to match with the darker one (style.COLOR_BUTTON_GREY) because I couldn't find how to fill the alpha of the "generic_cover.png" with the old color (style.COLOR_PANEL_GREY)'': http://bugs.sugarlabs.org/ticket/3723
* [<span style="color: orange;">ALTERNATIVE</span>] When the "generic book image" is shown (at the bottom left), the gray color used to fill it is not the same as the background. ''I changed the color with is the GdkPixbuf filled to match with the darker one (style.COLOR_BUTTON_GREY) because I couldn't find how to fill the alpha of the "generic_cover.png" with the old color (style.COLOR_PANEL_GREY)''
+
* [<span style="color: green;">DONE</span>] <del>I'm not sure what is ''org.freedesktop.UDisks.Device'' for? I don't understand it very well but I had to remove it because it was failing</del>. I replaced this by GIO
* After searching and selecting a book, if we change the format to ''EPUB'' the ''Get Book'' button is moved a bit
  −
* When the book download starts, a ''Cancel'' is shown but it doesn't have the '''X''' icon
  −
* The background of the rows on the ListView do not cycle between ''white'' and ''gray''
   
* The ''Catalogs'' column title is bigger than the other column titles
 
* The ''Catalogs'' column title is bigger than the other column titles
 +
* Right clicking on the column titles doesn't show the Gtk.Menu popup
 +
 +
== Theme related things ==
 +
 +
* <del>Cancel search button. It shows a really big '''X''' when you start typing: http://bugs.sugarlabs.org/ticket/3385</del>
 +
* <del>Clicking some things on the screen makes the ListView grows a bit and it doesn't fit on the screen (the right scroll-bar goes outside the window): http://bugs.sugarlabs.org/ticket/3722</del>
 +
* <del>Some time when I click on the Search Entry all the toolbar is moved a bit</del>
 +
* <del>After searching and selecting a book, if we change the format to ''EPUB'' the ''Get Book'' button is moved a bit: http://bugs.sugarlabs.org/ticket/3724</del>
 +
* W<del>hen the book download starts, a ''Cancel'' is shown but it doesn't have the '''X''' icon: http://bugs.sugarlabs.org/ticket/3725</del>
 +
* The background of the rows on the ListView do not cycle between ''white'' and ''gray'': http://bugs.sugarlabs.org/ticket/3726
 
* The column width should be re-sized to fit with the text inside them with a max width pre-set
 
* The column width should be re-sized to fit with the text inside them with a max width pre-set
* Right clicking on the column titles doesn't show the Gtk.Menu popup
      
= References / Useful links =
 
= References / Useful links =
Line 260: Line 280:  
** First version: http://bugs.sugarlabs.org/attachment/ticket/3681/Port-Gtk3-backup.diff
 
** First version: http://bugs.sugarlabs.org/attachment/ticket/3681/Port-Gtk3-backup.diff
 
** Second version: http://bugs.sugarlabs.org/attachment/ticket/3681/Port-Gtk3-backup.2.diff
 
** Second version: http://bugs.sugarlabs.org/attachment/ticket/3681/Port-Gtk3-backup.2.diff
 +
* Used to know the arguments of <tt>GdkPixbuf.Pixbuf.save_to_bufferv</tt> https://mail.gnome.org/archives/javascript-list/2011-March/msg00001.html
 +
* pdb Python's module docs: http://docs.python.org/library/pdb.html
 +
* Monitor Volumes / GNOME Input-Output http://developer.gnome.org/gio/unstable/pt02.html