Chromium Browser - Glimmer Custom Widget
MIT License
Chromium Browser is a Glimmer Custom Widget that brings Chromium support into the Glimmer DSL for SWT
SWT (Standard Widget Toolkit) started supporting the Chromium Browser in version 4.17 via the SWT.CHROMIUM
SWT style.
In order for it to work however, it needs the SWT Chromium support libraries and the CEF Binaries as outlined in the SWT FAQ.
The Chromium Browser Glimmer Custom Widget automates the inclusion of Chromium support libraries by relying on bundler-download gem (details under setup)
Note: Gem version numbers are in sync with the SWT Chromium library versions. The first two numbers represent the SWT Chromium version number. The last two numbers represent the minor and patch versions of the Chromium Browser Glimmer Custom Widget.
bundle install
The Chromium Browser gem includes downloads in a Downloadfile and relies on the the bundler-download Bundler plugin to automatically download extra files.
Add the following to a Glimmer application Gemfile
:
plugin 'bundler-download'
gem 'glimmer-cw-browser-chromium', '~> 4.17.0'
Run this twice (the first time to install the bundler-download
plugin and the second time to activate it and download extra files at the end):
jruby -S bundle
(or just bundle
if using RVM)
This option is useful if you want to include the Chromium Browser as a passive available option without forcing apps to download large binary files if they do not need the feature.
Add the following to a Glimmer application Gemfile
:
gem 'glimmer-cw-browser-chromium', '~> 4.17.0'
Run this:
jruby -S bundle
(or just bundle
if using RVM)
The first time you use the browser(:chromium)
widget, extra file downloads are initiated to obtain the CEF Binaries (if not downloaded already).
Both options 1 and 2 from Glimmer Application instructions are available for custom shells and custom widgets too.
When reusing in a Glimmer custom shell only (not custom widget), start by installing the bundler-download Bundler plugin manually:
bundle plugin install bundler-download
Afterwards, for both custom shells and custom widgets, add the following line to Gemfile
(especially if you're using Jeweler/Juwelier):
gem 'glimmer-cw-browser-chromium', '~> 4.17.0'
Run this to install gem and download extra files at the end via bundler-download:
jruby -S bundle
(or just bundle
if using RVM)
If not using Jeweler/Juwelier, add the following line to the gemspec:
s.add_runtime_dependency(%q<glimmer-cw-browser-chromium>.freeze, ['~> 4.17.0'])
Finally, just require the library in your code.
require 'glimmer-cw-browser-chromium'
browser(:chromium)
is the Glimmer GUI DSL keyword to use.
It is the same as the standard browser
widget but with the :chromium
SWT style.
Glimmer code (from samples/browser-chromium/hello_browser_chromium.rb):
require_relative '../../lib/glimmer-cw-browser-chromium'
include Glimmer
shell {
minimum_size 1024, 860
browser(:chromium) {
url 'https://brightonresort.com/about'
}
}.open
Run:
glimmer sample:run[hello_browser_chromium]
Glimmer app:
If the Chromium Browser widget does not work for whatever reason due to missing or corrupt CEF Binaries, you may clear and redownload manually via bundle download
commands (from bundler-download).
To show downloaded files, run:
bundle download show
This should print something like:
Showing downloaded files for /Users/User/.rvm/gems/jruby-9.2.13.0@glimmer-cw-video/gems/glimmer-cw-browser-chromium-4.17.0.3/Downloadfile
54070695 /Users/User/.rvm/gems/jruby-9.2.13.0@glimmer-cw-video/gems/glimmer-cw-browser-chromium-4.17.0.3/vendor/jars/mac/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar
To clear downloads, run:
bundle download clear
To redownload, run:
bundle download
Copyright (c) 2020 - Andy Maleh.
--
Built for Glimmer (Ruby Desktop Development GUI Library).