Showing posts with label Tk. Show all posts
Showing posts with label Tk. Show all posts

Friday, January 27, 2023

Glimmer Ecosystem, Glimte 3rd Party Framework, PasswordStore

Traditionally, Glimmer GUI gems have been mostly a one-sided effort, with a few 3rd party contributions here and there (like Drag and Drop support for Glimmer DSL for Tk). Well, that changes with Glimte! Glimte is a 3rd party framework built on top of Glimmer (Tk flavor) by Phaengris to facilitate following a certain variation of the MVC pattern (Model-View-Controller) called MVVM (Model-View-ViewModel). It encourages a model of programming for desktop GUI views that is similar to Rails .erb and GTK .glade files, but using the Glimmer GUI DSL in .glimmer.rb files as the view format. As such, it provides a much lighter more programmer-friendly Ruby-native replacement for HTML, ERB, and Glade. Consequently, Glimte ushers in the next era of Glimmer; that is The Glimmer Ecosystem! 

The Glimmer Ecosystem enables the democratization of the style of development followed when building Glimmer desktop applications in Ruby, among many other obvious benefits. That in turn facilitates a vision similar to the Rails vision explained by Yahuda Katz in his keynote speech at RailsConf 2014 (at which I presented too), which was borrowed from Steve Jobs. What Yahuda alluded to was that by continuously building more floors for the lower levels of a building in the form of a framework and a community of open-source projects, we enable developers to start development at higher and higher levels than they would have been able to otherwise, thus helping them leapfrog earlier ways of development in ever increasing productivity!

So, what is Glimte?

"MVVM framework based on Glimmer for creating desktop apps in Ruby / Tk" 

- Source: https://github.com/Phaengris/Glimte

Are there any apps built with Glimte?

PasswordStore - "Tk-based desktop client for the Linux password store manager https://www.passwordstore.org/"
 

What is pass, the Linux password manager that PasswordStore is built for?

"Password management should be simple and follow Unix philosophy. With pass, each password lives inside of a gpg encrypted file whose filename is the title of the website or resource that requires the password. These encrypted files may be organized into meaningful folder hierarchies, copied from computer to computer, and, in general, manipulated using standard command line file management utilities.

pass makes managing these individual password files extremely easy. All passwords live in ~/.password-store, and pass provides some nice commands for adding, editing, generating, and retrieving passwords. It is a very short and simple shell script. It's capable of temporarily putting passwords on your clipboard and tracking password changes using git." 


Below is a full introduction to Glimte, taken straight from the GitHub project page.

Happy Glimmering!


Sunday, February 20, 2022

Glimmer DSL for Tk Hello, Labelframe and Scale!

Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library) v0.0.54 and v0.0.55 just got released with two new samples:

  • Hello, Labelframe!: demonstrates the `labelframe` widget, also known as the named group widget, which wraps around a group of other widgets and adds a title to them at the top-left by default
  • Hello, Scale!: demonstrates the `scale` widget, which is a scale slider that can be data-bound to a float or integer value
Hello, Labelframe! Screenshot




Hello, Labelframe! Code



Hello, Scale! Screenshot




Hello, Scale! Code

Happy Glimmering!

Saturday, February 05, 2022

2021 Was The Year of The Ruby Desktop!!!

Gerald Bauer started 2021 with a reddit post having the following question in its title: "2021 - The Year of the Ruby Desktop?"

I am happy to comfortably answer this question today with a resounding YES!!!

2021 WAS THE YEAR of THE RUBY DESKTOP!!!

In fact, 2021 was the year Desktop Development became a first-class citizen in Ruby again!


To clarify, here are all the Ruby desktop development gems that came out of Glimmer in 2021:

Yes! Every Ruby desktop toolkit out there that is worth its salt and is currently maintained has been supported by Glimmer!

Here is a summary of the forte of each supported toolkit:

  • SWT: Truly native widgets on all platforms in JRuby (in addition to non-native vector graphics). Very mature custom widget support. 
  • LibUI: Truly native widgets on all platforms in MRI Ruby (in addition to non-native vector graphics). Fast startup time.
  • Tk: Mature widgets and some native-themed widgets on all platforms (in addition to vector graphics). Fast startup time.
  • GTK: Native widgets on Linux GNOME flavors (in addition to vector graphics). Complete access to Linux GNOME features. Fast startup time.
  • FOX Toolkit: Windows binaries included out of the box. Mature library.
  • Swing: Very mature and common Java library
  • JavaFX: Rich custom widget support.

Actually, there is quite a bit of irony in Glimmer supporting JavaFX. Glimmer was initially inpsired by the earliest version of JavaFX, having a very lightweight syntax called JavaFX Script. It was completely different from the JavaFX of today, which has a heavyweight Java syntax and an even heavier-weight XML syntax sadly. Things have come full circle in 2021 when Glimmer has become the proven technology that would rescue JavaFX from its new self with the much lighter-weight Glimmer DSL syntax!

That said, Glimmer is not only rescuing JavaFX, but it is also rescuing the entire Ruby community from non-native-looking overly verbose and imperative non-Ruby-style GUI toolkits. Thankfully, Glimmer steps in to save the day whether software engineers need to run on JRuby in SWT or on CRuby in LibUI.

Additionally, Glimmer adopts a pragmatic software engineering approach by supporting numerous GUI toolkits that have different trade-offs and are used by software engineers for various reasons (like FXRuby, which in fact has the highest number of downloads out of all Ruby GUI toolkits; 900,000 downloads and counting). I mean after all, why not use a software-engineer-friendly Glimmer DSL instead of the default complicated verbose imperative code that scares developers away from desktop development!?!! Glimmer GUI DSL syntax is not only lightweight and declarative, but thanks to the one-language Ruby DSL approach, it is in fact much more convenient to use than any web technology, period.

Furthermore, Glimmer intentionally makes an effort to adopt the community standards of each GUI toolkit it supports. That way, when SWT or LibUI developers decide to use Glimmer DSLs, they feel right at home (e.g. SWT widget constructors usually receive SWT styles as the main argument whereas LibUI widget constructors usually receive the initial value as the main argument; and corresponding Glimmer DSLs behave the same way).

Glimmer is a community service. In fact, here are some of the impacts Glimmer can have on society:
  • Customers will receive desktop products in a matter of months not years, weeks not months, days not weeks, or hours not days, depending on the size of the project
  • Software engineers and customers will reap great savings in software engineering costs by not having to write and maintain complicated imperative GUI code
  • Software engineers will be maximally productive by working at the speed of thought without any technology friction, thanks to the highly expressive GUI DSL, convention over configuration, smart defaults, and being able to write the minimum amount of syntax needed to specify GUI and data-bind it.
  • The GUI DSL syntax makes it simple for newcomers to get into building desktop apps, in fact much simpler than building web apps. This will lower the barrier of entry to computer programming and encourage a lot more people in society to get into software engineering.
  • The extensibility of the GUI DSL makes it convenient for software engineers all around the world to contribute Custom Controls and help each other in meeting customer demands with open-source software

Thankfully, community members do contribute back to Glimmer too, such as vin1antme's big 2021 contribution of lightweight declarative drag and drop support for Glimmer DSL for Tk.

In fact, there are many areas where Ruby community members could contribute to Glimmer:
  • Custom widgets (though there are already some Glimmer custom widgets)
  • Text Editors & IDEs that can be customized with Ruby (I am no Text Editor developer though here is my attempt at building my own Text Editor in Glimmer: Gladiator - Glimmer Editor)
  • Hot Reloading Support given Ruby's dynamic nature
  • Smalltalk-like Editor-built-into-the-GUI App functionality
  • Visual Designer using Drag and Drop
  • Widget Inspector that enables troubleshooting/manipulating widget hierarchy
  • Scaffolding Database Table GUIs (though some Glimmer gems do have general app Scaffolding support)
  • Native Executable Packaging for CRuby (Glimmer in JRuby already has Native Executable Packaging support for building Mac APP/DMG/PKG files, Windows EXE/MSI files, and Linux DEB/RPM files)
  • Visualization Tools to make Ruby compete with Python at building GUIs for data-science visualizations (using Glimmer is so much simpler and more productive than any GUI technology in Python).
  • External Sample Applications
  • Plugin Architecture Support (and perhaps codifying Desktop Application Design Patterns)
  • Themes
  • Gaming Frameworks that uniquely take advantage of retained-mode canvas graphics with bidirectional data-binding, resulting in much shorter and simpler code than any other gaming engines (avoiding imperative frame-rate-based rendering)
  • Video and Blog Tutorials
  • More documentation (perhaps translating toolkit API references into Ruby API references, like the SWT javadoc becoming a Ruby doc instead)

In any case, I would like to conclude this celebratory blog post by sharing with you an introductory video tutorial for Glimmer's first DSL (got extracted out of Glimmer into its own project): Glimmer DSL for SWT (make sure to raise the video quality to HD, like HD1080)


Happy Glimmering!

Next Tutorial: Glimmer DSL for SWT Video Tutorial 2 - Hello, Message Box!

Monday, December 06, 2021

Glimmer DSL for Tk Contextual Menu

Glimmer DSL for Tk v0.0.49 ships with a new sample: Hello, Contextual Menu!

It demonstrates the just added explicit support for Contextual Menus. These are also known as pop-up menus, which show up when right-clicking in an application.

Screenshot:





Code:

Happy Glimmering!

Monday, September 14, 2020

Glimmer DSL for Tk 0.0.5 Hello, Computed!

 Glimmer DSL for Tk alpha 0.0.5 ships with the following changes:

  • Label text data-binding
  • Entry text data-binding
  • The `grid` geometry manager
  • Hello, Computed! sample demonstrating computed value data-binding

Below is the Glimmer code for Hello, Computed!

And here is the produced sample app screenshot.


Happy Glimmering!

Saturday, September 12, 2020

Glimmer DSL for Tk 0.0.3 Hello, Combo!

 Glimmer DSL for Tk alpha 0.0.3 has been released! 

It now supports:

  • Combo box bidirectional data-binding
  • Button command event binding

Below is Hello, Combo! implemented in Glimmer DSL for Tk.


Here is a short write-up on the newly added Glimmer Bidirectional Data-Binding features for Glimmer DSL for Tk.


Happy Glimmering!

Friday, September 11, 2020

Glimmer DSL for Tk 0.0.2 Hello, Tab!

 Glimmer DSL for Tk alpha 0.0.2 has been released! 

It now supports:

Below is Hello, Tab! implemented in Glimmer DSL for Tk.


Additionally, Glimmer GUI DSL concepts have been explained in regards to how they map to the Tk imperative syntax.


Happy Glimmering!

Thursday, September 10, 2020

Glimmer DSL for Tk has arrived!

Glimmer DSL for Tk has arrived as an experimental alpha 0.0.1 gem

Glimmer was originally created on top of SWT because Tk did not support native GUI widgets on Mac, Windows, and Linux back in 2007. Tk used to be more akin of Java Swing, having painted widgets that looked foreign on all platforms.

Tk 8.5 changed that by supporting native themed widgets.

Glimmer was also originally created on top of JRuby because standard Ruby did not have truly parallel multi-threading, required for desktop application development to run jobs in the background while letting the user interact with the GUI in the foreground.

Upcoming Ruby 3.0 changes that by finally supporting truly parallel multi-threading via Ractor (formerly known as Ruby Guilds).

SWT is a highly proven GUI toolkit in the Java world, with the best example being the Eclipse IDE.

Tcl/Tk is also a very proven and stable GUI toolkit, especially as the default toolkit for a number of languages like Ruby and Python.

The trade-off is that while SWT provides a plethora of high quality reusable widgets (such as Nebula) for the Enterprise, Tk enables very fast startup time via MRI Ruby.

Below is the project README with a Hello, World! GUI code sample.


Happy Glimmering!