glimmer-dsl-swt 4.18.4.0 → 4.18.4.1

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: e3d59d0d54c7528a521c07263fa47768f172e49ea2d5bee86c376d0425b8a5f8
4
- data.tar.gz: 0da445293890975f23fbf5cce1af49ea4e8b54e2d86a99b6d0f4cfa7fe6559bd
3
+ metadata.gz: ed016ed2527818f682cb4247d294bf16ddcc8ccddb81f5bd26fa518b0592d4a1
4
+ data.tar.gz: 2c2d0e7fdc9921ab9861d1151686907d809cd072e0e5651889b4f08851c19791
5
5
  SHA512:
6
- metadata.gz: a51c136d719ebe688209fa1a3bf8509dee32f1c90d535b06c08b6f5d835a0872c9487f437f06c7985007c210bf7aef3ecb29c6a11819e9ee48ffed77ea5ee40f
7
- data.tar.gz: 8c285b55812b44969dbe3ab527b1ad1d5cc2325d2455cdf676412bfdc41f1094ce7402c3f0f5181546be9d539299f5c669de553c0b04339c3ffa3ef5c81c3fbb
6
+ metadata.gz: 646cec122f5b18ffdd57be914bdd84f7a5af7729cf66aa98ecfe35477d7bb9c445bb6c0b00436c7aa06a40052cd5d96613a4d3b4470d97990ebb60cf6813323d
7
+ data.tar.gz: c6af13d3fe035da72d5e60b88cbe1c6ab498e07cd061113c46a248c110f2044349b99050fd576ebc4f2923efa49965a0539da512325e9a76d0512c4c6816c88c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.4.1
4
+
5
+ - Support data-binding of `code_text` with lines enabled.
6
+ - Upgrade the Glimmer Meta-Sample with code_text lines: {width: 2}
7
+ - With code_text lines enabled, support setting/data-binding properties on root composite via nesting `root { }` underneath
8
+ - With code_text lines enabled, support setting/data-binding properties on line numbers styled text widget via nesting `line_numbers { }` underneath
9
+ - Update the Hello, Code Text! sample to remove borders and line numbers background in the JavaScript example
10
+ - Fix issue with updating layout upon later reopening layout/layout data via `proxy.content {}` method
11
+
3
12
  ### 4.18.4.0
4
13
 
5
14
  - Extract line numbers part of text_editor widget from Gladiator into Glimmer code_text and make it an option (e.g. lines: true or lines: {width: 4})
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 SWT 4.18.4.0
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 SWT 4.18.4.1
2
2
  ## JRuby Desktop Development GUI Framework
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -360,6 +360,7 @@ If you see anything that needs to be improved, please do not hesitate to contact
360
360
  - [Hello, Button!](#hello-button)
361
361
  - [Hello, Link!](#hello-link)
362
362
  - [Hello, Dialog!](#hello-dialog)
363
+ - [Hello, Code Text!](#hello-code-text)
363
364
  - [Hello, Canvas!](#hello-canvas)
364
365
  - [Hello, Canvas Animation!](#hello-canvas-animation)
365
366
  - [Hello, Canvas Transform!](#hello-canvas-transform)
@@ -489,9 +490,7 @@ jgem install glimmer-dsl-swt
489
490
 
490
491
  Or this command if you want a specific version:
491
492
  ```
492
- jgem install glimmer-dsl-swt -v 4.18.4.0
493
-
494
-
493
+ jgem install glimmer-dsl-swt -v 4.18.4.1
495
494
  ```
496
495
 
497
496
  `jgem` is JRuby's version of `gem` command.
@@ -509,8 +508,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
509
508
 
510
509
  Add the following to `Gemfile`:
511
510
  ```
512
- gem 'glimmer-dsl-swt', '~> 4.18.4.0
513
- '
511
+ gem 'glimmer-dsl-swt', '~> 4.18.4.1'
514
512
  ```
515
513
 
516
514
  And, then run:
@@ -568,9 +566,7 @@ bin/glimmer samples
568
566
  Below are the full usage instructions that come up when running `glimmer` without args.
569
567
 
570
568
  ```
571
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.4.0
572
-
573
-
569
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.4.1
574
570
 
575
571
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
576
572
 
@@ -1049,9 +1045,7 @@ Output:
1049
1045
 
1050
1046
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1051
1047
  Opal glimmer-dsl-opal 0.10.2 AndyMaleh Glimmer DSL for Opal
1052
- Swt glimmer-dsl-swt 4.18.4.0
1053
-
1054
- AndyMaleh Glimmer DSL for SWT
1048
+ Swt glimmer-dsl-swt 4.18.4.1 AndyMaleh Glimmer DSL for SWT
1055
1049
  Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
1056
1050
  Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
1057
1051
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.18.4.0
1
+ 4.18.4.1
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-dsl-swt 4.18.4.0 ruby lib
5
+ # stub: glimmer-dsl-swt 4.18.4.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.18.4.0"
9
+ s.version = "4.18.4.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["AndyMaleh".freeze]
14
- s.date = "2021-02-02"
14
+ s.date = "2021-02-03"
15
15
  s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI cross-platform desktop development library written in JRuby, an OS-threaded faster JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets, but it also supports drawing Canvas Graphics like Shapes and Animations. To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable packaging support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.executables = ["glimmer".freeze, "girb".freeze]
@@ -34,21 +34,42 @@ module Glimmer
34
34
 
35
35
  alias lines? lines
36
36
  attr_accessor :styled_text_proxy_text, :styled_text_proxy_top_pixel
37
- attr_reader :styled_text_proxy, :lines_width
37
+ attr_reader :styled_text_proxy, :lines_width, :line_numbers_styled_text_proxy
38
38
 
39
- def text=(value)
40
- @styled_text_proxy&.swt_widget&.text = value
39
+ def method_missing(method_name, *args, &block)
40
+ dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
41
+ if dsl_mode
42
+ args.pop if args.last.is_a?(Hash) && args.last[:dsl]
43
+ super(method_name, *args, &block)
44
+ elsif @styled_text_proxy&.respond_to?(method_name, *args, &block)
45
+ @styled_text_proxy&.send(method_name, *args, &block)
46
+ else
47
+ super
48
+ end
41
49
  end
42
50
 
43
- def text(*args, dsl: false, &block)
44
- # If dsl: true is passed, operate using Glimmer DSL (which is the default that happens through super method_missing)
45
- if dsl
46
- super(*args, &block)
51
+ def respond_to?(method_name, *args, &block)
52
+ dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
53
+ if dsl_mode
54
+ args = args[0...-1] if args.last.is_a?(Hash) && args.last[:dsl]
55
+ super(method_name, *args, &block)
47
56
  else
48
- @styled_text_proxy&.swt_widget&.text
57
+ super || @styled_text_proxy&.respond_to?(method_name, *args, &block)
49
58
  end
50
59
  end
51
60
 
61
+ def has_instance_method?(method_name)
62
+ respond_to?(method_name)
63
+ end
64
+
65
+ def root_block=(block)
66
+ body_root.content(&block)
67
+ end
68
+
69
+ def line_numbers_block=(block)
70
+ @line_numbers_styled_text_proxy.content(&block)
71
+ end
72
+
52
73
  before_body {
53
74
  require 'rouge'
54
75
  require 'ext/rouge/themes/glimmer'
@@ -59,6 +80,11 @@ module Glimmer
59
80
  elsif lines.is_a?(Hash)
60
81
  @lines_width = lines[:width]
61
82
  end
83
+ @dsl_mode = true
84
+ }
85
+
86
+ after_body {
87
+ @dsl_mode = nil
62
88
  }
63
89
 
64
90
  body {
@@ -67,10 +93,10 @@ module Glimmer
67
93
  composite {
68
94
  grid_layout(2, false)
69
95
 
70
- @line_numbers_text = styled_text(:multi, :border) {
96
+ @line_numbers_styled_text_proxy = styled_text(swt(swt(swt_style), :h_scroll!, :v_scroll!)) {
71
97
  layout_data(:right, :fill, false, true)
72
98
  text ' '*lines_width.to_i
73
- text(bind(self, :styled_text_proxy_text, read_only: true) { |text_value|
99
+ text bind(self, :styled_text_proxy_text, read_only: true) { |text_value|
74
100
  line_count = text_value.to_s.split("\n").count
75
101
  line_count = 1 if line_count == 0
76
102
  lines_text_size = [line_count.to_s.size, @lines_width].max
@@ -79,7 +105,7 @@ module Glimmer
79
105
  @lines_width = lines_text_size
80
106
  end
81
107
  line_count.times.map {|n| (' ' * (lines_text_size - (n+1).to_s.size)) + (n+1).to_s }.join("\n") + "\n"
82
- }, dsl: true)
108
+ }
83
109
  top_pixel bind(self, :styled_text_proxy_top_pixel, read_only: true)
84
110
  font name: @font_name, height: OS.mac? ? 15 : 12
85
111
  background color(:widget_background)
@@ -110,8 +136,9 @@ module Glimmer
110
136
 
111
137
  def code_text_widget
112
138
  @styled_text_proxy = styled_text(swt_style) {
139
+ # custom_widget_property_owner # TODO implement to route properties here without declaring method_missing
113
140
  layout_data :fill, :fill, true, true if lines
114
- text(bind(self, :styled_text_proxy_text), dsl: true) if lines
141
+ text bind(self, :styled_text_proxy_text) if lines
115
142
  top_pixel bind(self, :styled_text_proxy_top_pixel) if lines
116
143
  font name: @font_name, height: 15
117
144
  foreground rgb(75, 75, 75)
@@ -72,7 +72,9 @@ module Glimmer
72
72
  @swt_layout.marginRight = 0 if @swt_layout.respond_to?(:marginRight)
73
73
  @swt_layout.marginBottom = 0 if @swt_layout.respond_to?(:marginBottom)
74
74
  @swt_layout.marginLeft = 0 if @swt_layout.respond_to?(:marginLeft)
75
+ old_layout = @widget_proxy.swt_widget.getLayout
75
76
  @widget_proxy.swt_widget.setLayout(@swt_layout)
77
+ @widget_proxy.swt_widget.layout if old_layout
76
78
  end
77
79
 
78
80
  def has_attribute?(attribute_name, *args)
@@ -83,7 +85,8 @@ module Glimmer
83
85
  apply_property_type_converters(attribute_name, args)
84
86
  if args.first != @swt_layout.send(attribute_getter(attribute_name))
85
87
  @swt_layout.send(attribute_setter(attribute_name), *args)
86
- @widget_proxy.swt_widget.getShell.pack
88
+ @widget_proxy.swt_widget.layout
89
+ @widget_proxy.swt_widget.getShell.layout
87
90
  end
88
91
  end
89
92
 
@@ -165,6 +165,7 @@ module Glimmer
165
165
  DEFAULT_INITIALIZERS[underscored_widget_name.to_s.to_sym]&.call(@swt_widget)
166
166
  @parent_proxy.post_initialize_child(self)
167
167
  end
168
+ @keyword = underscored_widget_name.to_s
168
169
  if respond_to?(:on_widget_disposed)
169
170
  on_widget_disposed {
170
171
  clear_shapes
@@ -264,9 +264,12 @@ class MetaSampleApplication
264
264
  }
265
265
  }
266
266
 
267
- @code_text = code_text {
267
+ @code_text = code_text(lines: {width: 2}) {
268
268
  text bind(SampleDirectory, 'selected_sample.code', read_only: true)
269
269
  editable bind(SampleDirectory, 'selected_sample.editable')
270
+ line_numbers {
271
+ background :white
272
+ }
270
273
  }
271
274
 
272
275
  weights 4, 11
@@ -49,7 +49,19 @@ shell {
49
49
  tab_item {
50
50
  fill_layout
51
51
  text 'JavaScript (pastie theme)'
52
- code_text(language: 'javascript', theme: 'pastie', lines: {width: 2}) {
52
+ # No border (SWT styles are passed explicitly)
53
+ code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'pastie', lines: {width: 2}) {
54
+ # With lines, the custom widget has a root composite, which can be configured separately
55
+ root {
56
+ grid_layout(2, false) {
57
+ margin_width 2
58
+ }
59
+ background :white
60
+ }
61
+ # With lines, the line numbers widget can be configured separately
62
+ line_numbers {
63
+ background :white
64
+ }
53
65
  text <<~CODE
54
66
  function greet(greeting) {
55
67
  alert(greeting);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.4.0
4
+ version: 4.18.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-02 00:00:00.000000000 Z
11
+ date: 2021-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement