glimmer-dsl-libui 0.11.4 → 0.11.6

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: 587e29f6be24b8a3f01a9872faa7f421531b36a9534fe4b241d52339dbca503c
4
- data.tar.gz: d1fe047970b1c482aba434f9c1a3d010099aacca1d9ba320cf0ed07967ac3b83
3
+ metadata.gz: e595d6ac3d153abe32d9148d5984261d1c6673f1e501ab3f280e139e268d75ee
4
+ data.tar.gz: caf883ace7e4a19e5a7f3ee288ad4726ad84b5b79a722320855591c21421d793
5
5
  SHA512:
6
- metadata.gz: 32da548dc373cef2214ce2af6ca329d01691cfdeeda8d9f6f5d85c6878c2d7b02ad1892d50e9f0a443256ef3e54932208c638635f8167e3906500af1eb328c28
7
- data.tar.gz: 206732983531c55d879818e1ec92c3bba276a8430d5c2785dd80349078145dc3b8e961b31f3510cf10a7cdbfc1e57e15688858b03b91a80baa3bbe00a06b15c0
6
+ metadata.gz: cdfca8b76f1b14b0fa2c88bb5ef8262b946158e68ba55cc5777bb908d14c7ae0698d3438ef2bcf3c5db0767987ca64613a24344c59badf831dfec3766c8fcabf
7
+ data.tar.gz: 5dd802c7de992b79055d616431b8d43d817fc06186d1c14852d3e6e8eecdad18b16af69d89e63f33a558c907a56e7bf6d240387ec405fff58efec36cea4fa89b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.11.6
4
+
5
+ - Organize scaffolded application menus under a `menu_bar` method
6
+ - Avoid loading `facets` gem completely in scaffold and list tasks, yet load used part of facets only ('facets/string/titlecase')
7
+ - Avoid loading `perfect-shape` gem until area canvas graphics are used
8
+ - Avoid loading `color` gem until used by `Glimmer::LibUI.interpret_color` method
9
+ - Fix issue with `listener_expression.rb` failing for `TextProxy` due to not having `can_handle_listener?` method.
10
+ - Fix issue with `TextProxy.can_handle_listener?` crashing when `text` is nested under `area` `on_draw`
11
+
12
+ ## 0.11.5
13
+
14
+ - Support table explicit data-binding with a model attribute that returns an Enumerator (instead of an Array)
15
+
3
16
  ## 0.11.4
4
17
 
5
18
  - Fix issue with Content Data-Binding not working
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.11.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.11.6
2
2
  ## Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library ([Fukuoka Award Winning](http://www.digitalfukuoka.jp/topics/187?locale=ja))
3
3
  ### The Quickest Way From Zero To GUI
4
4
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
@@ -8,6 +8,8 @@
8
8
 
9
9
  (**[Fukuoka Ruby Award Competition 2022 Special Award Winner](https://andymaleh.blogspot.com/2022/02/glimmer-dsl-for-libui-wins-fukuoka-ruby.html)** [[Award Announcement]](http://www.digitalfukuoka.jp/topics/187?locale=ja))
10
10
 
11
+ (**[***RubyConf 2023 Workshop - How To Build Desktop Applications in Ruby***](https://github.com/AndyObtiva/how-to-build-desktop-applications-in-ruby)**)
12
+
11
13
  (**[***RubyConf 2022 Talk - Building Native GUI Apps in Ruby***](https://andymaleh.blogspot.com/2023/02/rubyconf-2022-talk-video-for-building.html)**)
12
14
 
13
15
  [**(Ruby Rogues Podcast Interview - Desktop Apps in Ruby ft. Andy)**](https://andymaleh.blogspot.com/2022/05/ruby-rogues-podcast-interview-desktop.html)
@@ -431,7 +433,7 @@ gem install glimmer-dsl-libui
431
433
  Or install via Bundler `Gemfile`:
432
434
 
433
435
  ```ruby
434
- gem 'glimmer-dsl-libui', '~> 0.11.4'
436
+ gem 'glimmer-dsl-libui', '~> 0.11.6'
435
437
  ```
436
438
 
437
439
  Test that installation worked by running the [Glimmer Meta-Example](#examples):
@@ -463,7 +465,9 @@ Afterwards, to access the Glimmer GUI DSL:
463
465
 
464
466
  You may learn more about the different options above with basic examples in the following subsections: [Experimentation Usage](#experimentation-usage), [Prototyping Usage](#prototyping-usage), [Serious Usage](#serious-usage).
465
467
 
466
- If you are new to [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) (beginner), after going through the subsections below, check out the RubyConf 2022 talk ["Building Native GUI Apps in Ruby"](https://andymaleh.blogspot.com/2023/02/rubyconf-2022-talk-video-for-building.html), [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts), [Glimmer Command](#glimmer-command) (just the basics, how to run an app, and how to run examples to start), [Girb](#girb-glimmer-irb) and [Examples](#examples) to quickly learn through copy/paste. It is very important for beginners to go through all the [Examples](#examples) from the most basic to the most advanced while reading the README topics that relate to the examples. You may refer to the [API](#api) on once you have gotten your feet wet with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) and need more detailed reference information.
468
+ If you are new to [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) (beginner), after going through the subsections below, check out the RubyConf 2022 talk ["Building Native GUI Apps in Ruby"](https://andymaleh.blogspot.com/2023/02/rubyconf-2022-talk-video-for-building.html), [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts), [Glimmer Command](#glimmer-command) (just the basics, how to run an app, and how to run examples to start), [Girb](#girb-glimmer-irb) and [Examples](#examples) to quickly learn through copy/paste. It is very important for beginners to go through all the [Examples](#examples) from the most basic to the most advanced while reading the README topics that relate to the examples. Alternatively, beginners can learn from the RubyConf 2023 workshop ["How To Build Desktop Applications in Ruby"](https://github.com/AndyObtiva/how-to-build-desktop-applications-in-ruby), which includes 27 step-by-step exercises. You may refer to the [API](#api) once you have gotten your feet wet with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) and need a more detailed reference.
469
+
470
+ If you encounter any issues with the documentation, get stuck with code you do not understand, or notice some out-of-date information, you may contact the project maintainers on the [Glimmer Gitter Chat](https://app.gitter.im/#/room/#AndyObtiva_glimmer:gitter.im). Also, this could be your opportunity to be a good steward of Open-Source Software by contributing a documentation fix in a GitHub Pull Request or reporting a GitHub Issue at least.
467
471
 
468
472
  ### Experimentation Usage
469
473
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.4
1
+ 0.11.6
Binary file
@@ -34,6 +34,7 @@ module Glimmer
34
34
  parent.is_a?(Glimmer::LibUI::CustomShape)
35
35
  ) and
36
36
  block_given? and
37
+ parent.respond_to?(:can_handle_listener?) and
37
38
  parent.can_handle_listener?(keyword)
38
39
  end
39
40
 
@@ -167,6 +167,7 @@ module Glimmer
167
167
  end
168
168
 
169
169
  def perfect_shape
170
+ require 'perfect-shape'
170
171
  the_perfect_shape_dependencies = perfect_shape_dependencies
171
172
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
172
173
  draw_fill_mode, _ = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -243,7 +243,11 @@ module Glimmer
243
243
  model_attribute_observer = model_attribute_observer_registration = nil
244
244
  model_attribute_observer = Glimmer::DataBinding::Observer.proc do
245
245
  new_value = model_binding.evaluate_property
246
- if model_binding.binding_options[:column_attributes] || (!new_value.nil? && (!new_value.is_a?(String) || !new_value.empty?) && (!new_value.is_a?(Array) || !new_value.first.is_a?(Array)))
246
+ if !new_value.is_a?(Enumerator) &&
247
+ (
248
+ model_binding.binding_options[:column_attributes] ||
249
+ (!new_value.nil? && (!new_value.is_a?(String) || !new_value.empty?) && (!new_value.is_a?(Array) || !new_value.first.is_a?(Array)))
250
+ )
247
251
  @model_attribute_array_observer_registration&.deregister
248
252
  @model_attribute_array_observer_registration = model_attribute_observer.observe(new_value, column_attributes, ignore_frozen: true, attribute_writer_type: [:attribute=, :set_attribute])
249
253
  model_attribute_observer.add_dependent(model_attribute_observer_registration => @model_attribute_array_observer_registration)
@@ -174,7 +174,7 @@ module Glimmer
174
174
  end
175
175
 
176
176
  def can_handle_listener?(listener_name)
177
- area_proxy.can_handle_listener?(listener_name)
177
+ area_proxy&.can_handle_listener?(listener_name)
178
178
  end
179
179
 
180
180
  def handle_listener(listener_name, &listener)
@@ -184,6 +184,7 @@ module Glimmer
184
184
  end
185
185
 
186
186
  def perfect_shape
187
+ require 'perfect-shape'
187
188
  the_perfect_shape_dependencies = perfect_shape_dependencies
188
189
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
189
190
  absolute_x, absolute_y, width, height = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -51,6 +51,7 @@ module Glimmer
51
51
  end
52
52
 
53
53
  def perfect_shape
54
+ require 'perfect-shape'
54
55
  the_perfect_shape_dependencies = perfect_shape_dependencies
55
56
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
56
57
  absolute_x_center, absolute_y_center, radius, start_angle, sweep, is_negative = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -62,6 +62,7 @@ module Glimmer
62
62
  end
63
63
 
64
64
  def perfect_shape
65
+ require 'perfect-shape'
65
66
  the_perfect_shape_dependencies = perfect_shape_dependencies
66
67
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
67
68
  absolute_x, absolute_y, absolute_c1_x, absolute_c1_y, absolute_c2_x, absolute_c2_y, absolute_end_x, absolute_end_y = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -51,6 +51,7 @@ module Glimmer
51
51
  end
52
52
 
53
53
  def perfect_shape
54
+ require 'perfect-shape'
54
55
  the_perfect_shape_dependencies = perfect_shape_dependencies
55
56
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
56
57
  absolute_x_center, absolute_y_center, radius = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -87,6 +87,7 @@ module Glimmer
87
87
  end
88
88
 
89
89
  def perfect_shape
90
+ require 'perfect-shape'
90
91
  perfect_shape_dependencies = [x, y, children.map(&:perfect_shape_dependencies)]
91
92
  if perfect_shape_dependencies != @perfect_shape_dependencies
92
93
  x, y, _ = @perfect_shape_dependencies = perfect_shape_dependencies
@@ -58,6 +58,7 @@ module Glimmer
58
58
  end
59
59
 
60
60
  def perfect_shape
61
+ require 'perfect-shape'
61
62
  the_perfect_shape_dependencies = perfect_shape_dependencies
62
63
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
63
64
  absolute_x, absolute_y, closed, draw_fill_mode, children = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -61,6 +61,7 @@ module Glimmer
61
61
  end
62
62
 
63
63
  def perfect_shape
64
+ require 'perfect-shape'
64
65
  the_perfect_shape_dependencies = perfect_shape_dependencies
65
66
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
66
67
  absolute_x, absolute_y, absolute_end_x, absolute_end_y = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -45,6 +45,7 @@ module Glimmer
45
45
  end
46
46
 
47
47
  def perfect_shape
48
+ require 'perfect-shape'
48
49
  the_perfect_shape_dependencies = perfect_shape_dependencies
49
50
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
50
51
  absolute_point_array = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -46,6 +46,7 @@ module Glimmer
46
46
  end
47
47
 
48
48
  def perfect_shape
49
+ require 'perfect-shape'
49
50
  the_perfect_shape_dependencies = perfect_shape_dependencies
50
51
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
51
52
  absolute_point_array = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -45,6 +45,7 @@ module Glimmer
45
45
  end
46
46
 
47
47
  def perfect_shape
48
+ require 'perfect-shape'
48
49
  the_perfect_shape_dependencies = perfect_shape_dependencies
49
50
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
50
51
  absolute_point_array = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -39,6 +39,7 @@ module Glimmer
39
39
  end
40
40
 
41
41
  def perfect_shape
42
+ require 'perfect-shape'
42
43
  the_perfect_shape_dependencies = perfect_shape_dependencies
43
44
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
44
45
  absolute_x, absolute_y, width, height = @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -41,6 +41,7 @@ module Glimmer
41
41
  end
42
42
 
43
43
  def perfect_shape
44
+ require 'perfect-shape'
44
45
  the_perfect_shape_dependencies = perfect_shape_dependencies
45
46
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
46
47
  @perfect_shape_dependencies = the_perfect_shape_dependencies
@@ -182,6 +182,7 @@ module Glimmer
182
182
  return unless respond_to?(:point_array)
183
183
 
184
184
  point_array = self.point_array || []
185
+ require 'perfect-shape'
185
186
  point_array = PerfectShape::MultiPoint.normalize_point_array(point_array)
186
187
  point_array.map do |point|
187
188
  if composite_shape
data/lib/glimmer/libui.rb CHANGED
@@ -92,6 +92,7 @@ module Glimmer
92
92
  value[:a] = value.delete(:alpha) if value[:alpha]
93
93
  value
94
94
  elsif value.is_a?(String) && !value.start_with?('0x') && !value.start_with?('#') && !value.downcase.match(/^((([1-9a-f]){6})|(([1-9a-f]){3}))$/)
95
+ require 'color'
95
96
  color = Color::RGB.extract_colors(value).first
96
97
  color.nil? ? {} : {
97
98
  r: color.red,
@@ -194,6 +195,7 @@ module Glimmer
194
195
  end
195
196
 
196
197
  def x11_colors
198
+ require 'color'
197
199
  Color::RGB.constants.reject {|c| c.to_s.upcase == c.to_s}.map(&:to_s).map(&:underscore).map(&:to_sym)
198
200
  end
199
201
 
@@ -19,8 +19,8 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- require 'facets'
23
22
  require 'text-table'
23
+ require 'facets/string/titlecase'
24
24
 
25
25
  module Glimmer
26
26
  module RakeTask
@@ -21,7 +21,7 @@
21
21
 
22
22
  require 'fileutils'
23
23
  require 'os'
24
- require 'facets'
24
+ require 'facets/string/titlecase'
25
25
 
26
26
  # TODO refactor to nest under RakeTask namespace
27
27
 
@@ -578,32 +578,7 @@ require '#{window_type == :app ? current_dir_name : namespace}/model/greeting'
578
578
  custom_window_file_content += <<-MULTI_LINE_STRING
579
579
  before_body do
580
580
  @greeting = Model::Greeting.new
581
-
582
- menu('File') {
583
- menu_item('Preferences...') {
584
- on_clicked do
585
- display_preferences_dialog
586
- end
587
- }
588
-
589
- # Enables quitting with CMD+Q on Mac with Mac Quit menu item
590
- quit_menu_item if OS.mac?
591
- }
592
- menu('Help') {
593
- if OS.mac?
594
- about_menu_item {
595
- on_clicked do
596
- display_about_dialog
597
- end
598
- }
599
- end
600
-
601
- menu_item('About') {
602
- on_clicked do
603
- display_about_dialog
604
- end
605
- }
606
- }
581
+ menu_bar
607
582
  end
608
583
  MULTI_LINE_STRING
609
584
  elsif window_type == :gem
@@ -670,6 +645,39 @@ require '#{window_type == :app ? current_dir_name : namespace}/model/greeting'
670
645
  }
671
646
  MULTI_LINE_STRING
672
647
 
648
+ if %i[app].include?(window_type)
649
+ custom_window_file_content += <<-MULTI_LINE_STRING
650
+
651
+ def menu_bar
652
+ menu('File') {
653
+ menu_item('Preferences...') {
654
+ on_clicked do
655
+ display_preferences_dialog
656
+ end
657
+ }
658
+
659
+ # Enables quitting with CMD+Q on Mac with Mac Quit menu item
660
+ quit_menu_item if OS.mac?
661
+ }
662
+ menu('Help') {
663
+ if OS.mac?
664
+ about_menu_item {
665
+ on_clicked do
666
+ display_about_dialog
667
+ end
668
+ }
669
+ end
670
+
671
+ menu_item('About') {
672
+ on_clicked do
673
+ display_about_dialog
674
+ end
675
+ }
676
+ }
677
+ end
678
+ MULTI_LINE_STRING
679
+ end
680
+
673
681
  if %i[gem app].include?(window_type)
674
682
  custom_window_file_content += <<-MULTI_LINE_STRING
675
683
 
@@ -23,11 +23,9 @@ $LOAD_PATH.unshift(File.expand_path('..', __FILE__))
23
23
 
24
24
  # External requires
25
25
  require 'glimmer'
26
- require 'perfect-shape'
27
26
  # require 'logging'
28
27
  require 'puts_debuggerer' if (ENV['PD'] || ENV['pd']).to_s.downcase == 'true'
29
28
  # require 'super_module'
30
- require 'color'
31
29
  require 'os'
32
30
  require 'equalizer'
33
31
  require 'array_include_methods'
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.11.4
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-20 00:00:00.000000000 Z
11
+ date: 2023-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer