Description
Glimmer DSL for GTK enables building desktop applications with Ruby-GNOME. GTK (aka GIMP-Toolkit or [incorrectly] GNOME-Toolkit) is the premiere desktop GUI toolkit on Linux, which also runs on Mac (Quartz GTK+) and Windows. Glimmer DSL for GTK aims to supercharge productivity and maintainability in developing Ruby-GNOME applications by providing a DSL similar to Glimmer DSL for SWT having a declarative DSL syntax that visually maps to the GUI widget hierarchy, convention over configuration via smart defaults and automation of low-level details, requiring the least amount of syntax possible to build GUI, custom keyword support, bidirectional data-binding to declaratively wire and automatically synchronize GUI with business models, scaffolding for new custom widgets, apps, and gems, and native-executable packaging on Mac, Windows, and Linux.
Glimmer DSL for GTK alternatives and similar gems
Based on the "GUI" category.
Alternatively, view glimmer-dsl-gtk alternatives based on common mentions on social networks and blogs.
-
Glimmer
DSL Framework consisting of a DSL Engine and a Data-Binding Library used in Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI), Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library), Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library), Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for XML (& HTML), and Glimmer DSL for CSS -
Glimmer DSL for LibUI
Glimmer DSL for LibUI - Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library - The Quickest Way From Zero To GUI - If You Liked Shoes, You'll Love Glimmer! - No need to pre-install any prerequisites. Just install the gem and have platform-independent GUI that just works on Mac, Windows, and Linux. -
Glimmer DSL for SWT
Glimmer DSL for SWT (JRuby Desktop Development Cross-Platform Native GUI Framework) - The Quickest Way From Zero To GUI - If You Liked Shoes, You'll Love Glimmer! -
Gladiator (Glimmer Editor)
Gladiator (short for Glimmer Editor) is a Glimmer DSL for SWT sample project under on-going development that demonstrates how to build a text editor in Ruby using Glimmer DSL for SWT (JRuby Desktop Development GUI Library). It is not intended to be a full-fledged editor by any means, yet mostly a fun educational exercise in using Glimmer. Gladiator is also a personal tool for shaping an editor exactly the way I like, with all the keyboard shortcuts I prefer. I leave building truly professional text editors to software tooling experts who would hopefully use Glimmer one day. Otherwise, I have been happily using Gladiator to develop all my open-source projects since May of 2020. -
Glimmer DSL for WX
Glimmer DSL for WX - Ruby Desktop Development GUI Library for the wxWidgets GUI toolkit and wxruby3 binding -
Glimmer DSL for Swing
Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library) - Enables development of desktop applications using Java Swing and Java 2D, including vector graphics and AWT geometry.
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Glimmer DSL for GTK or a related project?
README
Glimmer DSL for GTK 0.0.1
Ruby-GNOME Desktop Development GUI Library
Glimmer DSL for GTK enables building desktop applications with Ruby-GNOME.
GTK (aka GIMP-Toolkit or [incorrectly] GNOME-Toolkit) is the premiere desktop GUI toolkit on Linux, which also runs on Mac (Quartz GTK+) and Windows.
Glimmer DSL for GTK aims to supercharge productivity and maintainability in developing Ruby-GNOME applications by providing a DSL similar to Glimmer DSL for SWT having:
- Declarative DSL syntax that visually maps to the GUI widget hierarchy
- Convention over configuration via smart defaults and automation of low-level details
- Requiring the least amount of syntax possible to build GUI
- Custom Keyword support
- Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
- Scaffolding for new custom widgets, apps, and gems
- Native-Executable packaging on Mac, Windows, and Linux.
Hello, World!
window {
title 'Hello, World!'
label('Hello, World!')
}.show
Mac Screenshot:
NOTE: Glimmer DSL for GTK is currently in early alpha mode (incomplete proof-of-concept). Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
Other Glimmer DSL gems you might be interested in:
- glimmer-dsl-swt: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
- glimmer-dsl-opal: Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
- glimmer-dsl-tk: Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
- glimmer-dsl-libui: Glimmer DSL for Tk (Prerequisite-Free Ruby Desktop Development GUI Library)
- glimmer-dsl-xml: Glimmer DSL for XML (& HTML)
- glimmer-dsl-css: Glimmer DSL for CSS
Setup
Option 1: Install
Run this command to install directly:
gem install glimmer-dsl-gtk
Option 2: Bundler
Add the following to Gemfile
:
gem 'glimmer-dsl-gtk', '~> 0.0.1'
And, then run:
bundle
Usage
Require the library and mixin the Glimmer
module to utilize the Glimmer GUI DSL for GTK:
require 'glimmer-dsl-gtk'
include Glimmer
window {
title 'Demo'
on(:destroy) do
puts 'Bye Bye'
::Gtk.main_quit
end
}.show
For actual application development outside of simple demos, mixin the Glimmer
module into an application class instead:
require 'glimmer-dsl-gtk'
class SomeGlimmerApplication
include Glimmer
def launch
application('org.glimmer.hello-application', :flags_none) {
on(:activate) do |app|
application_window(app) {
title 'Actual Application'
}.present
end
}.run
end
end
SomeGlimmerApplication.new.launch
Glimmer GUI DSL
- Keywords: All GTK widgets are supported via lowercase underscored names accepting their constructor args (e.g.
application_window(app)
forGtk::ApplicationWindow.new(app)
). Keywords can be nested under other keywords to represent the true hierarchy of nested widgets on the screen (e.g.window { label('Hello') }
is alabel
nested under awindow
). Note that widget objects returned are proxies of the GTK widget counterparts. This shields consumers of GTK from its lower-level details via composition (Proxy Design Pattern). To access lower-level GTK widget, simply call#gtk
method on widget proxy object (e.g.@w = window {...}; @w.gtk # Gtk::Window widget object
). - Content: widget keywords can have a block of content that could contain nested widget keywords, properties, and signals. The block can optionally receive one argument representing the widget (e.g.
window {|w| ... }
):- Properties: All GTK widget properties can be set via lowercase underscored names (without the 'set_' prefix) nested under widget keywords (e.g.
window {title 'Hello, World'}
setstitle
property ofwindow
) - Signals: All GTK signals can be wired with
on(signal) { ... }
syntax (e.g.on(:activate) { do_something }
)
- Properties: All GTK widget properties can be set via lowercase underscored names (without the 'set_' prefix) nested under widget keywords (e.g.
Girb (Glimmer IRB)
You can run the girb
command (bin/girb
if you cloned the project locally):
girb
This gives you irb
with the glimmer-dsl-gtk
gem loaded and the Glimmer
module mixed into the main object for easy experimentation with GUI.
Gotcha: On the Mac, when you close a window opened in girb
, it remains open until you enter exit or open another GUI window.
Samples
Hello Samples
Hello, World!
Mac Screenshot:
Run (via installed gem):
ruby -r glimmer-dsl-gtk -e "require 'samples/hello/hello_world'"
Run (via locally cloned project):
ruby -r ./lib/glimmer-dsl-gtk.rb samples/hello/hello_world.rb
Code:
window {
title 'Hello, World!'
label('Hello, World!')
}.show
Hello, Application!
samples/hello/hello_application.rb
Mac Screenshot:
Run (via installed gem):
ruby -r glimmer-dsl-gtk -e "require 'samples/hello/hello_application'"
Run (via locally cloned project):
ruby -r ./lib/glimmer-dsl-gtk.rb samples/hello/hello_application.rb
Code:
require 'glimmer-dsl-gtk'
include Glimmer
application('org.glimmer.hello-application', :flags_none) {
on(:activate) do |app|
application_window(app) {
title 'Hello, Application!'
}.present
end
}.run
Hello, Button!
Mac Screenshot:
Run (via installed gem):
ruby -r glimmer-dsl-gtk -e "require 'samples/hello/hello_button'"
Run (via locally cloned project):
ruby -r ./lib/glimmer-dsl-gtk.rb samples/hello/hello_button.rb
Code:
require 'glimmer-dsl-gtk'
include Glimmer
window { |w|
title 'Hello, Button!'
button('Button') {
on(:clicked) do
message_dialog(w) { |md|
title 'Information'
text 'You clicked the button'
on(:response) do
md.destroy
end
}.show
end
}
}.show
Hello, Entry!
Mac Screenshot:
Run (via installed gem):
ruby -r glimmer-dsl-gtk -e "require 'samples/hello/hello_entry'"
Run (via locally cloned project):
ruby -r ./lib/glimmer-dsl-gtk.rb samples/hello/hello_entry.rb
Code:
require 'glimmer-dsl-gtk'
include Glimmer
window { |w|
title 'Hello, Entry!'
default_size 300, 50
box(:vertical) {
e = entry {
on(:changed) do
puts e.text
$stdout.flush # For Windows
end
}
button('Button') {
on(:clicked) do
message_dialog(w) { |md|
title 'You entered'
text e.text
on(:response) do
md.destroy
end
}.show
end
}
}
}.show
Contributing
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
- Fork the project.
- Start a feature/bugfix branch.
- Commit and push until you are happy with your contribution.
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Planned Features and Feature Suggestions
These features have been planned or suggested. You might see them in a future version of Glimmer DSL for GTK. You are welcome to contribute more feature suggestions.
[TODO.md](TODO.md)
Change Log
[CHANGELOG.md](CHANGELOG.md)
Contributors
- Andy Maleh (Founder)
Click here to view contributor commits.
Copyright
[MIT](LICENSE.txt)
Copyright (c) 2021 Andy Maleh.
--
Built for Glimmer (DSL Framework).
*Note that all licence references and agreements mentioned in the Glimmer DSL for GTK README section above
are relevant to that project's source code only.