This document introduces Glimmer DSL for SWT, a Ruby GUI framework that allows building native graphical user interfaces in Ruby. It discusses the motivation for building native GUIs, provides examples of sample apps built with Glimmer, and outlines the basics of the GUI DSL syntax. Key aspects covered include widgets, properties, listeners, operations, software architecture patterns like MVC and MVP, data binding, custom components, drag and drop, and scaffolding tools. It also mentions the ability to package apps into various native executable formats like DMG, PKG, EXE, MSI, DEB, and RPM for different platforms.
Project Based Learning (A.I).pptx detail explanation
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI Framework
1. Glimmer DSL for SWT
Ruby Desktop Development GUI Framework
Andy Maleh (Senior Software Developer at Lexop)
Montreal.rb • 2022-10-05
2. We Want Native GUI
● We want to build a native Graphical User Interface in Ruby to:
○ Productively build apps that support visual user interaction
○ Build online applications for specific users w/o needing browser
○ Quickly build offline applications that do not need Internet
○ Report and summarize data from databases securely locally
○ Provide user-friendly platform-conforming native user interfaces
3. We Want Native GUI
● We want to build a native Graphical User Interface in Ruby to:
○ Avoid writing many layers of complex web code
○ Avoid wasting time fine-tuning graphical user interfaces
○ Provide fast performance for graphical widget input/output
○ Quickly invent brand new visual concepts for user interaction
○ Build local games
32. GUI DSL Basics
● 4) Widget Operations
○ Invoked through Ruby Methods
○ Match SWT widget API
○ Proxy calls to SWT wrapped widget objects
○ JRuby provides ruby-friendly versions of SWT API methods
○ Behavior is sometimes augmented with smart defaults
■ e.g. shell.open starts GUI event loop
59. Custom Components
● Custom Shells (Hello, Custom Shell!)
○ include Glimmer::UI::CustomShell
○ Or include Glimmer::UI::CustomWindow
○ Or include Glimmer::UI::Application
○ Apps or Reusable custom windows
○ Custom shells are also custom widgets
61. Drag and Drop
● drag_source
● drop_target
● on_drag_detected
● on_drag_start
● on_drag_set_data
● on_drop
● Hello, Drag and Drop!
● Hello, Canvas Drag and Drop!
62. Canvas Drag and Drop
● drag_source
● on_drop
● drag_and_move
63. ● Run glimmer command to get instructions:
○ glimmer
glimmer scaffold[app_name]
glimmer scaffold:customshape[name,namespace]
glimmer scaffold:customshell[name,namespace]
glimmer scaffold:customwidget[name,namespace]
Scaffolding
64. Scaffolding
● Run glimmer command to get instructions:
○ glimmer
glimmer scaffold:desktopify[app_name,website]
glimmer scaffold:gem:customshape[name,namespace]
glimmer scaffold:gem:customshell[name,namespace]
glimmer scaffold:gem:customwidget[name,namespace]
65. Scaffolding - Application
● glimmer scaffold[app] will generate a full app
● Models live in app/app_name/model namespace
● Views live in app/app_name/view namespace
● App can be run with bin/script or this command:
○ glimmer run
● App can be packaged as a Ruby gem out of the box using Juwelier
● App main window entry point is:
app/app_name/view/app_view.rb
66. Native Executable Packaging
● Make sure to have MSI packaging prerequisites on Windows only
● Run packaging command:
○ glimmer package
● Run specialized packaging command:
○ glimmer package[dmg]
○ glimmer package[pkg]
○ glimmer package[msi]
○ glimmer package[deb]
○ glimmer package[rpm]
67. Native Executable Packaging
● On Mac, it will generate under packages:
○ DMG file format
○ PKG file format
● On Windows, it will generate under packages:
○ EXE file format
○ MSI file format
● On Linux, it will generate under packages:
○ DEB file format
○ RPM file format
71. Summary
● We Want Native GUI
● Intro GUI Samples
● Real World Apps
● GUI DSL Basics
● Data-Binding
● Software Architecture
● Widget Samples
● Canvas Graphics
● Custom Components
● Drag and Drop
● Scaffolding
● Native Executable Packaging
72. Other Glimmer GUI
DSLs
● Glimmer DSL for LibUI (CRuby)
[Fukuoka Ruby 2022 Special
Award Winner]
● Glimmer DSL for Tk (CRuby)
● Glimmer DSL for GTK (CRuby)
● Glimmer DSL for FX (CRuby)
● Glimmer DSL for Swing (JRuby)
● Glimmer DSL for JavaFX (JRuby)