NanoNote: selecting of PDF file for viewing

There is one problem with the NanoNote: the PDF viewer (nupdf), the video player (mplayer) and several other programs have no easy tool for browsing and opening of files.

It is not a problem for most current user because the file to be opened can always be specified from the command line. But non-geek usually want to have something more “user friendly”.

So I have started to search a simple file browser (yes, there is at leat the Midnight Commander but it is too powerfull for such task). T Jlime has a very nice file picker ( a SDL-based fileselector). I have spent some time when attempting to make it work under the OpenWRT but without success, yet (it might be my fault).

The I have started to make a simple script which utilises the dialog program for actual file picking. It’s not that cool, it’s even somewhat ugly but it works (well, at least it works for me).

Simple list of files for NanoNote

I have had to make two files. The first one is the actual script (/usr/bin/pick-pdf):


#! /bin/bash

export CMD=nupdf
export EXT=pdf

export i=0

echo " "
echo "Searching for *.$EXT files. It may take a while..."
echo " "

rm -f /tmp/fsel.tmp 2>/dev/null
touch /tmp/fsel.tmp
for aa in `find . -name "*.$EXT" -print` ;do i=`expr $i + 1` ; echo $i $aa >>/tmp/fsel.tmp ;done
export B=`cat /tmp/fsel.tmp`
export A=`dialog --menu "Select a File" 0 50 20 $B --stdout`

if test $A > 0
then
export C=`grep "^$A" /tmp/fsel.tmp`
export D=`echo $C | cut -d' ' -f2 -`
$CMD $D
else
echo "No file selected!"
fi

And the second one is a starter for the Gmenu2x (/usr/share/gmenu2x/sections/applications/pickpdf):


title=PDF
icon=skin:icons/generic.png
exec=/usr/bin/pick-pdf
params=/root/

And that is all. There are many things to improve, of course. But it is also possible to modify the script for other programs and file types.

NanoNote: selecting of PDF file for viewing

Bard Storyteller text reader

There is another new and nice piece of software for our Ben NanoNotes – the Bard Storyteller e-book reader.

Bard Storyteller text reader on NanoNote

At the moment it can only read plain text files but a support for XHTML and ePub is planned. And it supports the voice synthesis CMU Flite software so it can also read the texts for you. I have been using the Bard with the default Flite wersion which is shipped with the OpenWRT. It is not recommended (a more recent Flite should be used instead) but it works very well for me.

The version 0.6 of the Bard allows to configure text and background colors for all windows. It has to be done inside the ~/.bard_config file but it is easy to do. For example, I have changed background color from white to light gray which is better for my eyes. As you can judge from the screenshot, font sizes can be easily changed at run-time.

Bard Storyteller text reader

Gtk+ file dialog on Ben NanoNote

I have tried to use the gtk_widget_set_size_request function to make the dialog more compact. Fortunatelly, it works quite well, as you can see. At the moment I only have tried the old (probably deprecated) file dialog (I think that this one is better and more usefull than the new one).

Gtk+ file dialog on Ben NanoNote

The actual code is (as you may expect):


gtk_widget_set_size_request (dialog, 320, 240);

And that’s all.

Gtk+ file dialog on Ben NanoNote

Gtk+ application on NanoNote: OpenWRT vs JLime

Recently I have compiled my small Gtk+ program for both available linux systems for the Ben NanoNote: the OpenWRT and the Jlime. So below are my experiences.

OpenWRT Port

Microdef on Ben NanoNote

The OpenWRT has no X11 server and no windowing environment at all. It means that Gtk+ applications directly use the Linux framebuffer via the DirectFB library. So one can not run more than one application. This is not a big issue, I think.
But there are other issues:

  • File selection dialog does not fit the screen. I tried deprecated type of dialog and new one and both are near useless (the older one is better).
  • I have had no success in drawing of lines with different thicknesses (all have the same thickness, as you can judge from the screenshot).
  • The Gtk+ ignores numeric input on NanoNote. It’s possible to write any symbol or letter but not numbers. I use a simple but not very elegant workaround – a simple routine that transforms corrwsponding letters to numbers.

I also have had to shorten the menu in order to fit it into the screen.

Jlime port

MicroDef on Ben NanoNote

The Jlime is a different story. The program works as expected, the file dialog fits in the screen and they are useable. No code changes were needed at all. The correct thickness of the lines is respected, too.

From my point of view the main problem is the Jlime itself. It uses the X11 (the X Window System) which makes it much more “normal” and better working. But it also makes it quite slow and also somewhat unresponsible. There is also one problem which can be noticed on overloaded NanoNote: some letters written on keyboard are not passed to applications and sometimes it repeats one letter many times. This makes the Jlime uncomfortable to use. Please don’t mind the different fonts in the drawing area – I used an older (deprecated) font drawing routine when I made screenshots on the Jlime. This does not work in the OpenWRT version so I have replaced it with the more recent one. It of course works in both environments.

Conclusions

It is possible to use the Gtk+ for Ben NanoNote applications. But there are minor problems with the OpenWRT’s version of the Gtk+ which still have to be solved: the numeric input and the size of file dialogs. It will br also usefull to make a Gtk+ theme which will be more obtimised for the Ben (smaller fonts, more dark colors and so).

Gtk+ application on NanoNote: OpenWRT vs JLime

MicroDef on Ben NanoNote (almost done)

I finally have managed to do a functional port of my Microdef program to the Ben NanoNote.

Microdef on Ben NanoNote

It’s written in the Gtk+ and it was my first attempt to port Gtk+ code to the OpenWRT. So first I compiled the program for the JLime operating system (it has the X11 like all “normal” desktop Linuxess have). Then I have started to make possible to control the program exclusively from keyboard (because the Ben has no pointing device). To make the porting more easy I also have written scripts for GNU Autotools. So now I is possible to use ./configure ; make ; make install, too.

I have experienced several problems: the first one was the method of text rendering in the drawing area. I used the deprecated procedures which don’t work in the OpenWRT version of the Gtk+ library. So now I’m using Pango library for the test. The second problem is harder: the Gtk+ ignores numerical symbols from the Ben’s keyboard. They have to be input with “fn” but it does not work. So I have written a small workaroud for this – it is now possible to enter some letters instead of numbers (for example, the “n” key should generate a “1” if used with “fn” switch; so Microdef now reads “n” as “1”).

MicroDef on Ben NanoNote (almost done)

Milkymist One

Milkymist One

Let me introduce my new toy: the Milkymist One video synthetiser. Actually, it is a reconfigurable computer which use a FPGA instead of a traditional CPU. S o it’s something really interesting. It uses the RTOS as it’s operating system. That’s also unusual (ant thus very interesting) for me.

MilkyMist One: Flickernoise GUI

The device ships with nice and easy to use GUI and with several tens of pre-created visual effects. It is very impressive, I must say. Unfortunatelly, I still didn’t find enought time to play more with the Milkymist.

Flickernoise visualization

For now, I nonly have tried to connect with the telnet; and the ftp to the Milkysist (I used it to made screenshots) and I also tried to create simple visual effect directly on the Milkymist (using the GUI). It’s surprisingly fast (the visual effects are execuded in real time) and unusually quiet (it has no moving parts – no fans and it also uses very little power).

Milkymist One