forthebadge forthebadge Gem Version

Introduction

This project is my first attempt at a "unified widget language" for graphical user interfaces (GUIs).

Elements such as:

button {
}

Or:

window {
}

may be used to support as many different GUI toolkits as possible, including support for the world-wide-web.

Supported toolkits

So far (September 2021) the following toolkits are (partially) supported:

  • ruby-gtk3
  • libui # the ruby bindings to libui

More toolkits may be added in the future, as time permits. Note that the simple_widgets gem is highly experimental right now. Tons of things may change or be removed. I want to add support for the www as well, so the project is quite ambitious - but still experimental. Do not rely on it in production.

How to add support for SimpleWidgets in your project

The first step is to pull in the required code, and then either include or extend or both on the main class that you use (your GUI application).

So for example:

begin
  require 'simple_widgets'
  include SimpleWidgets
  extend SimpleWidgets
rescue LoadError; end

Then, after this was done, call the particular toolkit that you wish to use via:

use :gtk3

(That name may be changed at a later time. I wanted to use a simple name for now, though.)

Now your class has the custom code available that is part of SimpleWidgets. Of course you still have to add the logic of your GUI to your class on your own, but ideally you can define methods, put these in a module, and then work via these. This is how I tend to add support for ruby-gtk3 and libui at the same time.

Then you can pass, for instance:

InteractiveCaesarCipher --libui
InteractiveCaesarCipher --gtk

Via the commandline, and the correct variant can be used. GUIs everywhere for the win! \o/

parse_this_input_for_proper_widget_support

If you want to pass commandline arguments for your custom class, in order to determine whether to use, say, libui, or gtk, then use the following method:

parse_this_input_for_proper_widget_support(ARGV)

I normally but this right within def initialize(i = ARGV).

Support for jruby/SWING

Since as of December 2021 I am experimenting with support for jruby/SWING. This is presently incomplete, tons of things are missing - stay tuned for more updates in the long run, though.

Contact information

If your creative mind has ideas and specific suggestions to make this gem more useful in general, feel free to drop me an email at any time, via:

shevy@inbox.lt

Before that email I used an email account at Google gmail, but in 2021 I decided to slowly abandon gmail for various reasons. In part this is because the UI annoys me (on non-chrome browser loading takes too long), but also because of Google's attempt to establish mass surveillance via its federated cohorts sniffing (FLoC). I do not know what happened at Google, but enough is enough - there is only so much you can take while supporting greed. When it comes to data mining done by private groups, ultimately the user became the product.

Do keep in mind that responding to emails may take some time, depending on the amount of work I may have at that moment, due to reallife time constraints. I will, however had, read feedback eventually. Patches and code changes are welcome too, of course, as long as they are in the spirit of the project at hand, e. g. fitting to the general theme. For this I may make use of github as a discussion site, but this has a low priority right now.