Improving my Gtk and Music knowledge


Happy new year for everyone!

It is time for a new report about my progress on Outreachy :)

During the past few weeks I have studied about how to work with Gtk. It was necessary since I didn’t have so many experience with it. Also, I have taken a time to understand how Gnome Music works.

One of the results of this is a static current playlist widget implementation that I mentioned in the last post. You can take a look at it here.

Screenshot from 2016-01-09 01-52-31

Obviously it still need to be aesthetically polished but I will let to do this later. As I said, right now I’m focused on to learn and in how things work.

To accomplish it, I used the following approach:

  1. I coded everything without any worries about code style or good practices (aka spiking code). The reasons for this are to focus on learning the basis and to do not distract myself with anything
  2. After have understood what is needed to be done, I rewrote everything trying to achieve a better code quality.

Being more specific, in the first step I coded everything using just Python, without any shortcuts or tools that would facilitate my job.

In the second step, I’ve decided to use Glade to generate the widget structure to than import it using Gtk.Builder. This final approach follows the way that Music works (and probably almost every Gnome App) which permits to separate logic from UI in a better way.

After have completed this steps I’m feeling that I have learned many concepts of GTK and that I’m more prepared to accomplish my Outreachy project.

Finally, I would like to mention one main difficult that I faced. My mentor suggested me to use a ListBox with a ListModel to display the playlist itself. But, until now, I didn’t find a way on how to do this in Python. The documentation is not clear enough and I didn’t find any example of implementation. Well, for now, the solution discussed with my mentor is to forget the ListModel and just use ListBox.

Oh, and I almost forgot, I also take a look on Gnome Music code to find a way to retrieve the data that I will use to feed my widget. It looks like the Player.playlist has the information that I need. I was able to iterate over it and print on terminal the current playlist.

With the static widget and the needed data, I’m going to implement the widget on Music in the next week (the thing is starting to get serious :D). I’m very excited to this and I hope to make a great job.

See you in the next post!

6 thoughts on “Improving my Gtk and Music knowledge

Leave a Reply

Your email address will not be published. Required fields are marked *