Podcast Lookup

Autohiding fullscreen toolbar, error dialogs and file format filtering

Planet Python – The Open Sourcerer

  • October 15, 2012

About this episode

Here’s one of the reasons why I’m not exactly in a hurry to learn C. When you ask me to read through C code, this is what happens:

No jokes. Even after simplifying and compacting the code, it’s still such a pain for me to navigate through C that I actually felt the need to output the code onto thin slices of dead plants and stick them to a wall. This piece of code that I wanted to understand for a long time suddenly became clear after a few hours of analysis with a blue “thinkpad” and ballpoint pen:

And that was just reading and annotating… imagine if I actually had to write that code.
What was this code for, you ask? Making the toolbar hide nicely in fullscreen mode. Thus 400 lines of compacted C code to analyze from Gedit (nearly 700 if you don’t compact and just search code related to the fullscreen toolbar) became 50 lines of Python code in Pitivi.
Okay, the fullscreen toolbar is not the only thing I’ve been up to lately. While cleaning up code or looking at old bug reports, I fixed some little details, such as filtering out unknown/irrelevant file types from the file chooser dialog when importing clips:

A combobox (defaults to “Supported file formats”) allows you to change the strictness of the filtering. The same is true of the “missing clips” file chooser. By default, we now show only files with the same extension as the one you’re looking for:

I also made it error out if you don’t provide the requested replacement clips, with a new error dialog to explain accordingly:

This is better than being stuck inside an infinite asynchronous loop, trust me. There are also some new error dialogs (everyone loves those) to catch some silly corner cases, such as trying to save in a read-only directory (because GTK doesn’t do it for us):

…And even crazier scenarios, including someone explicitely bypassing the file extension filters to try to load a movie file as if it was a project file:

It’s the little details that count. You can’t make something too bullet-proof.
I also progressively reworked the pitivi git environment/build script to make it smarter and friendlier. Not only does it allow you to continue where you interrupted the checkouts/builds, but it has a built-in debugging duck:

“What, that’s it? Don’t you have more exciting stuff to show?”
Well, it turns out that Pitivi itself is pretty much ready*, it’s in very good shape. What’s preventing a release is the need for GNonLin (and after that, GES) to be fixed, and there’s nothing I can personally do about that (except testing and mentoring interested contributors). So if reading and writing C does not require you to stick pieces of dead plants onto walls, come talk to us!
*: except if we embark on the project of refactoring and porting the whole timeline UI to Clutter… Oh, and we need someone to fix undo & redo after that… And expand our test suite… And improve our title editor UI… And update the user manual/documentation…