Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about pyqt (old posts, page 4)

24-hour app #1: Die Schere, a video editor

I have long known that ap­pli­ca­tion de­vel­op­ment is an ar­du­ous process. I have al­so long sus­pect­ed one of the rea­sons it's ar­du­ous is the de­vel­op­er. I should be more speci­fic, I am one of the rea­son­s.

That's be­cause I don't know what I am do­ing, and I don't mean that in the "I am a lame pro­gram­mer" sense (even if that's al­so true some­what), but in the sense that I lit­er­al­ly don't know what the app should look like, or what its fea­ture set should be.

So, I have de­cid­ed to em­bark on a se­ries of ex­per­i­ments I will call 24-hour app­s.

Here are the rules:

  • I shall cre­ate a neat ap­­pli­­ca­­tion, sta­ble, use­­ful, us­able and de­­cen­t-look­ing.

  • I shall do it in no more than 24 hours. Af­ter that time, it should be at least good enough for a pre­view re­lease, if not a be­­ta.

  • Those 24 hours can be split in two or three ses­­sions

  • Time spent do­ing icon­s, doc­s, etc, counts.

  • All de­vel­op­­ment shall be pub­­lic (I am us­ing github)

  • I must have a use for the re­­sult­ing ap­­pli­­ca­­tion, and it should be at least an ad­e­quate so­lu­­tion for that prob­lem.

So, what's the first pro­jec­t? I call it Die Schere (The Scis­sors in ger­man) and it's a video ed­i­tor.

It's not a kden­live re­place­men­t, it's just the video ed­i­tor I wish I had when I need­ed to glue a piece of one video with a piece of an­oth­er.

In the old, pre-dig­i­tal world, that was done us­ing a cut­ter and scotch tape. I want Die Schere to be as use­ful and com­pre­hen­si­ble as that was, but use­ful for clum­sy peo­ple like my­self.

Here is a video af­ter to­day's ses­sion, which last­ed 8 hours:

The ba­sic func­tions are there, even if lots of work is still need­ed.

  • You can load clips to work with them

  • You can cut clips (like us­ing a cut­ter!)

  • You can choose the cut points in­­ter­ac­­tive­­ly or by ed­it­ing a time

  • You can ar­range them (like us­ing scotch tape!)

  • You can gen­er­ate the out­­put video

As a back­end it's us­ing men­coder, but there's no rea­son it should­n't work with ffm­peg or melt if some­one writes 20 lines of code.

Bookrest: the stylesheet editor in action

As usu­al, a video show­ing it:

The cur­rent sta­tus is that the in­fra­struc­ture re­quired for the stylesheet ed­i­tor is in place:

  • I fig­ured out how to turn the StyleSheet ob­­ject back in­­­to a JSON stylesheet.

  • The changes are done and merged back in­­­to the same file.

  • There is UI for 3 of the 6 re­quired pieces. The mis­s­ing ones are text styles, em­bed­d­ed fonts, and con­­fig op­­tions (like, break sub­­sec­­tions to odd pages)

  • The UI for the whole app is pret­­ty rough, I am in full make-it-­­func­­tion­al mode right now. It will be rethought lat­er on.

Bookrest: it was meant to be a stylesheet editor.

In my orig­i­nal post about it I was re­fer­ring to Bookrest as a stylesheet ed­i­tor for rst2pdf, be­cause that's what I want­ed, a way to test style changes and see what they did.

Of course, one thing lead to an­oth­er and it's start­ing to look more like a word pro­ces­sor than any­thing else, but ... well, how about a stylesheet ed­i­tor?

Sure, you can use the "Style" tab, and ed­it at will, but that's not ex­act­ly fun for ev­ery­one.

So, let's work on one. Here's the video of the cur­rent sta­tus:

Of course, this is about 1/20th of the stylesheet ed­i­tor, but at least the di­a­log is there, and most of the re­main­ing work is wiring di­alogs, which is quick us­ing de­sign­er.

It shall be called Bookrest, and it has an outline view.

Yes, the pro­gram known so far as "my rst2pdf ed­i­tor/pre­view­er ap­pli­ca­tion" is now called Bookrest.

What's a bookrest? It's a thing you put a book on.

Why Bookrest? I hope some­day peo­ple will have books open in bookrest. Plus, it ends with "rest", which is the pre­ferred ab­bre­vi­a­tion for re­Struc­tured Tex­t.

And what's the out­line view? It's a click­able tree with the out­line of the doc­u­men­t, of course.

As usu­al, let's go to the video:

The back­ground ren­der­ing was done us­ing python's awe­some mul­ti­pro­cess­ing mod­ule.

rst2pdf previewer: a new feature

I am in the mid­dle of that hon­ey­moon you get start­ing a new ap­p. Ev­ery new fea­ture seems tobe just 50 lines of code away, there is no lega­cy code (in fac­t, you are cre­at­ing that lega­cy code), and you learn new tricks all the time.

So, I did a new fea­ture to­day.

A day or two ago, my ed­i­tor start­ed show­ing a yel­low bar high­light­ing the cur­rent line.

But then I though... would­n't it be more use­ful to have a sim­i­lar bar fol­low­ing you in the PDF?

That way, when you are on a giv­en line, you can im­me­di­ate­ly see where you are in the out­put. Neat, right?

Here is a video show­ing it:

Sad­ly it's not per­fec­t, and prob­a­bly nev­er will be be­cause of do­cu­tils lim­i­ta­tion­s, but it's pret­ty nice!


Contents © 2000-2023 Roberto Alsina