glimmer-dsl-libui 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5098a4f3a6ab5f314440a317cc77cc4d1c7fc65f2f190261d83710ffa9554dea
4
- data.tar.gz: 7387058961fb36e05c598d8ef5c5e6ef109ce06eebac3626bed0628bc37511af
3
+ metadata.gz: 4aa989bad8bba6c9e59285e38a699b7842eb7f089a976782ac75363debfd829e
4
+ data.tar.gz: '081812a749e0ab795dfafcac60b58ab639f50933580f5ed3e404354691dd3d94'
5
5
  SHA512:
6
- metadata.gz: 40f5597274951ddcf6b96d26923d2012b2a5d59cacbb53e384b14e2bf619609b11f3d9c035768dcf9a4e38fe2608106eee15e91e0b5f72f282d7e009f05ebacd
7
- data.tar.gz: b8bfe79a0acb9def38d25682c04f17c8fcfebc44af81c12e20368654381e81ac902e29329470d2888d69fca0d1ebdd9ee505898164ef7dcc168281c349a06724
6
+ metadata.gz: 2e189f2db6399f9f718a06ca68b82665c7d9b54031dc62a76af1a4bb056f1299f40fe9993940163594157bdfcd649635cc27967aaadb7b709286d0b630d9b584
7
+ data.tar.gz: 5289461f384cf3237add39dba3fba83448c117d63ca53ac8e5dcc0af33cb4683179e077a712e927615825fc226bf94b234b4088e45b3f8de6c7b97a0d480c3a4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.9
4
+
5
+ - Build a meta-example (example of examples)
6
+
3
7
  ## 0.0.8
4
8
 
5
9
  - Add `?` suffixed aliases to all boolean property methods
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.0.8
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.0.9
2
2
  ## Prerequisite-Free Ruby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/ce2853efdbecf6ebdc73/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-libui/maintainability)
@@ -17,7 +17,7 @@ The main trade-off in using [Glimmer DSL for LibUI](https://rubygems.org/gems/gl
17
17
  - Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
18
18
  - Custom Widget support
19
19
  - Scaffolding for new custom widgets, apps, and gems
20
- - Native-Executable packaging on Mac, Windows, and Linux
20
+ - Native-Executable packaging on Mac, Windows, and Linux.
21
21
 
22
22
  Example:
23
23
 
@@ -43,7 +43,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
43
43
 
44
44
  ## Table of Contents
45
45
 
46
- - [Glimmer DSL for LibUI 0.0.8](#-glimmer-dsl-for-libui-008)
46
+ - [Glimmer DSL for LibUI 0.0.9](#-glimmer-dsl-for-libui-009)
47
47
  - [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
48
48
  - [Usage](#usage)
49
49
  - [API](#api)
@@ -149,7 +149,7 @@ gem install glimmer-dsl-libui
149
149
  Or install via Bundler `Gemfile`:
150
150
 
151
151
  ```ruby
152
- gem 'glimmer-dsl-libui', '~> 0.0.8'
152
+ gem 'glimmer-dsl-libui', '~> 0.0.9'
153
153
  ```
154
154
 
155
155
  Add `require 'glimmer-dsl-libui'` at the top, and then `include Glimmer` into the top-level main object for testing or into an actual class for serious usage.
@@ -265,9 +265,9 @@ Control(Args) | Properties | Listeners
265
265
 
266
266
  ### Smart Defaults and Conventions
267
267
 
268
- - `horizontal_box` and `vertical_box` controls have `padded` as `1` upon instantiation to ensure more user-friendly GUI by default
269
- - `group` controls have `margined` as `1` upon instantiation to ensure more user-friendly GUI by default
270
- - All controls nested under a `horizontal_box` or `vertical_box` have `stretchy` property (passed to `box_append` method) as `1` by default (filling maximum space)
268
+ - `horizontal_box` and `vertical_box` controls have `padded` as `true` upon instantiation to ensure more user-friendly GUI by default
269
+ - `group` controls have `margined` as `true` upon instantiation to ensure more user-friendly GUI by default
270
+ - All controls nested under a `horizontal_box` or `vertical_box` have `stretchy` property (passed to `box_append` method) as `true` by default (filling maximum space)
271
271
  - `window` constructor args can be left off and have the following defaults when unspecified: `title` as `'Glimmer'`, `width` as `150`, `height` as `150`, and `has_menubar` as `true`)
272
272
  - `window` has an `on_closing` listener by default that quits application upon hitting the close button (can be overridden with a manual `on_closing` implementation that returns integer `0` for success)
273
273
  - `quit_menu_item` has an `on_clicked` listener by default that quits application upon selecting the quit menu item (can be overridden with a manual `on_clicked` implementation that returns integer `0` for success)
@@ -296,7 +296,92 @@ Gotcha: On the Mac, when you close a window opened in `girb`, it remains open un
296
296
 
297
297
  ## Examples
298
298
 
299
- These examples reimplement the ones in the [LibUI](https://github.com/kojix2/LibUI) project utilizing the [Glimmer GUI DSL](#glimmer-gui-dsl-concepts).
299
+ These examples include reimplementions of the examples in the [LibUI](https://github.com/kojix2/LibUI) project utilizing the [Glimmer GUI DSL](#glimmer-gui-dsl-concepts).
300
+
301
+ To browse all examples, simply launch the [Meta-Example](examples/meta_example.rb), which lists all examples and displays each example's code when selected.
302
+
303
+ [examples/meta_example.rb](examples/meta_example.rb)
304
+
305
+ Run with this command from the root of the project if you cloned the project:
306
+
307
+ ```
308
+ ruby -r './lib/glimmer-dsl-libui' examples/meta_example.rb
309
+ ```
310
+
311
+ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
312
+
313
+ ```
314
+ ruby -r glimmer-dsl-libui -e "require 'examples/meta_example'"
315
+ ```
316
+
317
+ Mac
318
+
319
+ ![glimmer-dsl-libui-mac-meta-example.png](images/glimmer-dsl-libui-mac-meta-example.png)
320
+
321
+ Linux
322
+
323
+ ![glimmer-dsl-libui-linux-meta-example.png](images/glimmer-dsl-libui-linux-meta-example.png)
324
+
325
+ [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
326
+
327
+ ```ruby
328
+ require 'glimmer-dsl-libui'
329
+ require 'facets'
330
+
331
+ class MetaExample
332
+ include Glimmer
333
+
334
+ def examples
335
+ if @examples.nil?
336
+ example_files = Dir.glob(File.join(File.expand_path('.', __dir__), '**', '*.rb'))
337
+ example_file_names = example_files.map { |f| File.basename(f, '.rb') }
338
+ example_file_names = example_file_names.reject { |f| f == 'meta_example' }
339
+ @examples = example_file_names.map { |f| f.underscore.titlecase }
340
+ end
341
+ @examples
342
+ end
343
+
344
+ def file_path_for(example)
345
+ File.join(File.expand_path('.', __dir__), "#{example.underscore}.rb")
346
+ end
347
+
348
+ def launch
349
+ window('Meta-Example', 700, 500) { |w|
350
+ margined true
351
+
352
+ horizontal_box {
353
+ vertical_box {
354
+ @rbs = radio_buttons {
355
+ stretchy false
356
+ items examples
357
+ selected 0
358
+
359
+ on_selected do
360
+ @nwme.text = File.read(file_path_for(@examples[@rbs.selected]))
361
+ end
362
+ }
363
+ button('Launch') {
364
+ stretchy false
365
+
366
+ on_clicked do
367
+ system "ruby -r puts_debuggerer -r #{File.expand_path('../lib/glimmer-dsl-libui', __dir__)} #{file_path_for(@examples[@rbs.selected])}"
368
+ end
369
+ }
370
+ }
371
+ vertical_box {
372
+ @nwme = non_wrapping_multiline_entry {
373
+ read_only true
374
+ text File.read(file_path_for(@examples[@rbs.selected]))
375
+ }
376
+ }
377
+ }
378
+ }.show
379
+ end
380
+ end
381
+
382
+ MetaExample.new.launch
383
+ ```
384
+
300
385
 
301
386
  ### Basic Window
302
387
 
@@ -424,7 +509,7 @@ require 'glimmer-dsl-libui'
424
509
 
425
510
  include Glimmer
426
511
 
427
- window('hello world', 300, 200) { |w|
512
+ window('hello world', 300, 200, true) { |w|
428
513
  button('Button') {
429
514
  on_clicked do
430
515
  msg_box(w, 'Information', 'You clicked the button')
@@ -444,7 +529,7 @@ require 'glimmer-dsl-libui'
444
529
 
445
530
  include Glimmer
446
531
 
447
- window { # args can alternatively be set via properties with 4th arg has_menubar=true by default
532
+ window { # first 3 args can be set via properties with 4th arg has_menubar=true by default
448
533
  title 'hello world'
449
534
  content_size 300, 200
450
535
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -4,7 +4,7 @@ require 'glimmer-dsl-libui'
4
4
 
5
5
  include Glimmer
6
6
 
7
- window { # args can alternatively be set via properties with 4th arg has_menubar=true by default
7
+ window { # first 3 args can be set via properties with 4th arg has_menubar=true by default
8
8
  title 'hello world'
9
9
  content_size 300, 200
10
10
 
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'glimmer-dsl-libui'
4
+ require 'facets'
5
+
6
+ class MetaExample
7
+ include Glimmer
8
+
9
+ def examples
10
+ if @examples.nil?
11
+ example_files = Dir.glob(File.join(File.expand_path('.', __dir__), '**', '*.rb'))
12
+ example_file_names = example_files.map { |f| File.basename(f, '.rb') }
13
+ example_file_names = example_file_names.reject { |f| f == 'meta_example' }
14
+ @examples = example_file_names.map { |f| f.underscore.titlecase }
15
+ end
16
+ @examples
17
+ end
18
+
19
+ def file_path_for(example)
20
+ File.join(File.expand_path('.', __dir__), "#{example.underscore}.rb")
21
+ end
22
+
23
+ def launch
24
+ window('Meta-Example', 700, 500) { |w|
25
+ margined true
26
+
27
+ horizontal_box {
28
+ vertical_box {
29
+ @rbs = radio_buttons {
30
+ stretchy false
31
+ items examples
32
+ selected 0
33
+
34
+ on_selected do
35
+ @nwme.text = File.read(file_path_for(@examples[@rbs.selected]))
36
+ end
37
+ }
38
+ button('Launch') {
39
+ stretchy false
40
+
41
+ on_clicked do
42
+ system "ruby -r puts_debuggerer -r #{File.expand_path('../lib/glimmer-dsl-libui', __dir__)} #{file_path_for(@examples[@rbs.selected])}"
43
+ end
44
+ }
45
+ }
46
+ vertical_box {
47
+ @nwme = non_wrapping_multiline_entry {
48
+ read_only true
49
+ text File.read(file_path_for(@examples[@rbs.selected]))
50
+ }
51
+ }
52
+ }
53
+ }.show
54
+ end
55
+ end
56
+
57
+ MetaExample.new.launch
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-19 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -165,6 +165,7 @@ files:
165
165
  - examples/basic_window.rb
166
166
  - examples/basic_window2.rb
167
167
  - examples/control_gallery.rb
168
+ - examples/meta_example.rb
168
169
  - examples/midi_player.rb
169
170
  - examples/simple_notepad.rb
170
171
  - glimmer-dsl-libui.gemspec