The Accidental Rubyist

invalid byte sequence in UTF-8

First real app with Ruby-Curses (rbcurse)

leave a comment »

I decided to start doing a small app to test out the widgets (VIDEO). More real life than the eye-candy I’ve been posting till now. Its a TODO like app which will actually manage my TODO, FIXME, DONE list that I am using for this. The base is a YAML file – not the best idea compared to a database, I know, since the list will grow with time.

So a lot of minor issues and bugs or gaps are getting taken care of. Yes, occasionally a bug creeps in too!
I am realizing that for real-life table sorting and filtering is required — without touching the table model, else I wont be able to write back to disk. I have it in mind, an intermediate view that maps to the table model.

I will be adding more options or customizations so the widgets suit real needs rather than just look cute.
Here’s the first rough screen-shot after half a day of work. I _am_ using it! This link will have an updated screenshot, updated daily once. Another.

Todo app with cursor on category combo list

Todo app with cursor on category combo list

Briefly, Category is a combo and refreshes the table with items for that category such as TODO, DONE, FIXME etc.
The :CHANGED event is bound to refresh the table.
Within the table, Module and Status are combos too. Priority is numeric, and Task is wider than displayed and will horizontally scroll. Within the table, TAB and backtab will go from cell to cell. After the last cell, they go to next row. When no more row, they go to next field. Alt-Tab and Alt-backtab immediately moved to next/previous field.

Down and UP arrow, C-n and C-p, do vertical navigation or paging. Interestingly, combos use UP and DOWN for changing the value, however, this app unbinds the combos UP and DOWN so it can be used by Table for navigation. One can still change combo values using M-Down (alt-down). One rarely modifies Module anyway. This is one example of actual usage making me change or tweak widgets.

Editing automatically happens on entering a cell. In the demo video, editing on a cell required hitting ENTER. Otherwise the cells were readonly, and navigation was fast. This is optional now. Tables that have very little editing such as a Finder/File Explorer can require user to press ENTER to make a cell editable.

Hopefully, by Jan end, I can release a V0.1.

Check todo.yml and testtodo.rb on github. VIDEO LINK.

Update: I have added an ApplicationHeader class and KeyLabels like alpine (email client) has at top and bottom. See latest screenshot. In this image, cursor moves to the Tasks Table and the keys printed below change. Table Row is updated as you scroll down the table.


Written by totalrecall

January 18, 2009 at 8:25 pm

Posted in ncurses, rbcurse, ruby

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: