The Accidental Rubyist

invalid byte sequence in UTF-8

The Future of rbcurse (ruby ncurses)

with 7 comments

A year back I had split rbcurse into rbcurse-core and extras and experimental. Of late, I have been working on a widget called *textpad* to replace textview. It uses pads (which i earlier abhored and avoided) and this really simplifies the logic. I have also used the same textpad as a list, so that now obviates having a separate list class (unless I need to do multiple selection).
I have tested textpad as a textview and a list and a popup in a gem called cygnus. It is the ncurses version of the cetus gem which uses the terminal (I actually use cetus, cygnus is mostly to test out textpad).

I am also working on a replacement for tabular_widget using the same textpad. It extends textpad and only adds a minimal amount of code, but allows most of what tabular_widget allowed, while making it easier to override the rendering. I will release it after using it a little more in my current project. That mostly leaves replacing tree with a pad version.

However, my issue then is how to release these. I could replace the old widgets, but that won’t be backward compatible, and I have made things simpler, so i cannot be totally backward compatible. I could add these to the current project and request people to move over to these new widgets. I could release these as a separate gem….

My next goal after that is to seriously trim down the base. That is form and widget, and also Window, utils etc. This will definitely break everything and require a new gem. There is a lot of stuff that makes the base complex but may never be used. There is also code that really needs a rewrite such as Button and Menu.

About these ads

Written by totalrecall

April 10, 2013 at 5:22 pm

Posted in ruby

7 Responses

Subscribe to comments with RSS.

  1. I just discovered this project and I feel like I just discovered the world. Keep the good job ;) This is awesome!

    alexandernst

    May 29, 2013 at 6:57 pm

  2. I’ve been working on a curses music player (i’ve been using moc for a few _years_ but want something a bit “better”. I found your libraries but i couldn’t make much sense of the documentation. Lots of stuff that needed definition that i couldn’t figure out. The comment i want to make, though, relates to your saying that one of your prime goals is to maintain backward compatibility (as well as simplify the code base). How many people currently use these libraries? If it were hardly anyone, really, then i wouldn’t waste my time and energy maintaining backward compatibility. Just a thought.

    craig

    July 16, 2013 at 4:04 am

  3. You are right, there are very few users. I guess I would have to bump the major version or just create a new gem so there is no confusion if an older user updates his gem. Or if a user distributes a gem that depends on rbcurse and the new version breaks compatibility, then his users would not be able to use his product.

    This is preventing me from moving the changes into rbcurse-core for some of the improvements i have made.

    totalrecall

    July 16, 2013 at 11:17 am

  4. You are obviously at the alpha stage. You should separate your current work from whatever existed before, that worked. (?) and devote all your time and energy to doing the development work that is your primary interest and of the greatest importance to you. If you have any users who depend upon previous code and yet you have no awareness of their existence, then they should be of no concern to you. They are being served by the old code, as it is, as well as can be expected. The whole issue is one of focusing limited time and energy to accomplish something that, if too much time and energy are diverted, may not get done satisfactorily, or at all. A higher level curses library would be a nice thing to have. Ncurses is very stable and something equally stable on top of that would have value for years to come. However, it needs to be well-designed.

    After reading some of what you’d written about how your development is proceeding, i decided not to take a shot at using it because what exists at the moment seems to be a mish-mash of old and in-process (and the documentation was incomprehensible).

    Personally, i don’t think a higher level library on top of ncurses should be too complicated. Looking at what you’ve got, it seems like there is far too much junk there, relative to the amount of good, solid, well-designed code that is implemented and available. (Some good functionatliy may be available now, but, in my view, not cleanly, because of the way things are packaged.)

    I used a library called stfl to implement what i could for my project. It’s pretty well-designed and easy to use, and works well for what it does. It seems to be completely abandoned at this point, though, and i dropped it because it didn’t have any means for doing certain basic things, like being able to change the color of a line in a list. Other widgets had a style property (including color) but not list _items_.

    If i were you, i’d start by packaging together the functionality that you now have that you’re happy with and make your top priority working on those things that are then missing from what you have that is most urgently needed. Package this up and release it as soon as possible and from there, that will be your work in progress. It needs to be functional, though, for anyone else to use it and therefore help you with further development (if only as testers).

    Take that all for what it’s worth. Finally, if you feel you _do_ have something that is usable which you could package cleanly, i’d be willing to give a shot at using it to implement my player program. This will be a relatively (but not overly) simple application which should exercise most of the functionality needed from a higher level curses library without getting into a lot of bells and whistles that aren’t appropriate for a library that doesn’t even have a stable release yet. Of course, you’d have to explain your mysterious documentation to me. :-)

    craig

    July 16, 2013 at 9:12 pm

  5. Your comments are correct and extremely valuable. I have always been afraid of cutting out the cruft and cleaning it up due to backward compatibility. I will read your post several times and then decide exactly how to go about it.

    The only way you can use this is to study the examples and use the code from there. The documentation is mostly useless. That is how others have used it.

    I essentially messed it up trying to implement something very complicated – the ability to have things like splitpanes within splitpanes and scrollpanes etc. This complicated the entire code. Finally, i gave that up and tried to remove all the stuff I had added to get that functional, but i never could clean it totally since many other things got added and fixed along side.

    That is why i tried to cut out stuff into rbcurse-core but even that has stuff i want to cut out. If i can forgo backward compat as you suggest, then it is easy for me. I have implemented much better and cleaner widgets but cannot replace them for the compat issue.

    If we ditch back-compat then i can replace older widgets with cleaner ones. I can cut out lots of code from the basic widget and form. Maybe even Window.

    Thanks for your candid feedback. Anything more you want to say is most welcome. Be free to be blunt and critical.

    totalrecall

    July 17, 2013 at 1:46 am

  6. really great job totalrecall
    i try tu use rbcurse-core i creat a function ( load_avg ) for print the load on my server
    but i cant find how to print the output ?
    could you help me please

    olivier

    January 21, 2014 at 10:54 pm

  7. You wish to print the load avg on what. A list ? Or a textarea ? or a textbox or label ?

    What kind of screen / form do you have ? Is this something that keeps updating ?

    Create a LABEL and place it on the form. Keep updating the value of the label whenever your avg changes or periodically.

    Please check examples in the examples folder such as test2.rb

    totalrecall

    January 21, 2014 at 11:29 pm


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: