glimmer 0.7.2 → 0.7.3

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: a991d3df0f065a0caa7cd20d43c026561b99b334b4db9d67d37d54a9aa125a70
4
- data.tar.gz: c9660908ac2b7b8d2c00a8af33c793ad8f2789bb513553fb1e8e2b4abf2f3db1
3
+ metadata.gz: 3682b8fe5b49d283cd803bf1c3bece41e8ca38c54d75836591cdefacc3674ac0
4
+ data.tar.gz: 1bfa3019ab0281f603a2e63a6044025cbb338d865cc75b3c517c7fef02429441
5
5
  SHA512:
6
- metadata.gz: 289e423f490a3bb338fa91ab5502b03936c5e03088f48dafbb74aa4b31e606637e873c8b26a46167cb10306cab22ae09a733318ef98382ff424207fb06c93fac
7
- data.tar.gz: d6d865f226ab24151983c5c9a3c0dc18bd73d7d4c8ca02a4e99fe4d231500ade3215d245add615e11d1713e39b8a9da5e47006bc13d8406ad4b7208679e38d07
6
+ metadata.gz: 973bf3fa1920c64d8bdda424513471120790040d362f3a2b32e7f30180220a0993b65875c6dffc5e6a6efa5ae6ce030c51a94da31b9c3fba16d2fce335552049
7
+ data.tar.gz: b001f5dbce277aff4ee1dbc9eb4b27a424c4b92a08a6ba98e13006a1a2bff8009cde411c88430f0f763d9acc03890cb9fac40d9bb46bfe9ad453cc576e4c2084
@@ -1,4 +1,4 @@
1
- # Glimmer 0.7.2 Beta (JRuby Desktop UI DSL + Data-Binding)
1
+ # Glimmer 0.7.3 Beta (JRuby Desktop UI DSL + Data-Binding)
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
3
3
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer?branch=master)
4
4
 
@@ -6,7 +6,7 @@ Glimmer is a native-UI cross-platform desktop development library written in Rub
6
6
 
7
7
  ## Examples
8
8
 
9
- ### Hello World
9
+ ### Hello, World!
10
10
 
11
11
  Glimmer code (from `samples/hello/hello_world.rb`):
12
12
  ```ruby
@@ -71,7 +71,7 @@ NOTE: Glimmer is in beta mode. Please help make better by adopting for small or
71
71
  ## Table of Contents
72
72
 
73
73
  <!-- TOC START min:1 max:3 link:true asterisk:false update:true -->
74
- - [Glimmer 0.7.2 Beta (JRuby Desktop UI DSL + Data-Binding)](#glimmer-058-beta-jruby-desktop-ui-dsl--data-binding)
74
+ - [Glimmer 0.7.3 Beta (JRuby Desktop UI DSL + Data-Binding)](#glimmer-058-beta-jruby-desktop-ui-dsl--data-binding)
75
75
  - [Examples](#examples)
76
76
  - [Hello World](#hello-world)
77
77
  - [Tic Tac Toe](#tic-tac-toe)
@@ -164,7 +164,7 @@ Please follow these instructions to make the `glimmer` command available on your
164
164
 
165
165
  Run this command to install directly:
166
166
  ```
167
- jgem install glimmer -v 0.7.2
167
+ jgem install glimmer -v 0.7.3
168
168
  ```
169
169
 
170
170
  `jgem` is JRuby's version of `gem` command.
@@ -175,7 +175,7 @@ Otherwise, you may also run `jruby -S gem install ...`
175
175
 
176
176
  Add the following to `Gemfile`:
177
177
  ```
178
- gem 'glimmer', '~> 0.7.2'
178
+ gem 'glimmer', '~> 0.7.3'
179
179
  ```
180
180
 
181
181
  And, then run:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -3,8 +3,6 @@ require 'rake'
3
3
 
4
4
  require_relative 'rake_task'
5
5
 
6
- load File.expand_path('./Rakefile') if File.exist?(File.expand_path('./Rakefile'))
7
-
8
6
  module Glimmer
9
7
  class Launcher
10
8
  OPERATING_SYSTEMS_SUPPORTED = ["mac", "windows", "linux"]
@@ -137,6 +135,7 @@ module Glimmer
137
135
  private
138
136
 
139
137
  def launch_application
138
+ load File.expand_path('./Rakefile') if File.exist?(File.expand_path('./Rakefile'))
140
139
  threads = @application_paths.map do |application_path|
141
140
  Thread.new do
142
141
  self.class.launch(
@@ -20,33 +20,39 @@ module Glimmer
20
20
  alias opened_before? opened_before
21
21
 
22
22
  # Instantiates ShellProxy with same arguments expected by SWT Shell
23
- def initialize(*args)
24
- if args.first.is_a?(ShellProxy)
25
- args[0] = args[0].swt_widget
26
- end
27
- style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}
28
- if style_args.any?
29
- style_arg_start_index = args.index(style_args.first)
30
- style_arg_last_index = args.index(style_args.last)
31
- args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
32
- end
33
- if args.first.nil? || (!args.first.is_a?(Display) && !args.first.is_a?(Shell))
34
- @display = DisplayProxy.instance.swt_display
35
- args = [@display] + args
36
- end
37
- args = args.compact
38
- @swt_widget = Shell.new(*args)
39
- @display ||= @swt_widget.getDisplay
40
- @swt_widget.setLayout(FillLayout.new)
41
- @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
42
- on_event_show do
43
- Thread.new do
44
- sleep(0.25)
45
- async_exec do
46
- @swt_widget.setActive
23
+ # if swt_widget keyword arg was passed, then it is assumed the shell has already been instantiated
24
+ # and the proxy wraps it instead of creating a new one.
25
+ def initialize(*args, swt_widget: nil)
26
+ if swt_widget
27
+ @swt_widget = swt_widget
28
+ else
29
+ if args.first.is_a?(ShellProxy)
30
+ args[0] = args[0].swt_widget
31
+ end
32
+ style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}
33
+ if style_args.any?
34
+ style_arg_start_index = args.index(style_args.first)
35
+ style_arg_last_index = args.index(style_args.last)
36
+ args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
37
+ end
38
+ if args.first.nil? || (!args.first.is_a?(Display) && !args.first.is_a?(Shell))
39
+ @display = DisplayProxy.instance.swt_display
40
+ args = [@display] + args
41
+ end
42
+ args = args.compact
43
+ @swt_widget = Shell.new(*args)
44
+ @swt_widget.setLayout(FillLayout.new)
45
+ @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
46
+ on_event_show do
47
+ Thread.new do
48
+ sleep(0.25)
49
+ async_exec do
50
+ @swt_widget.setActive
51
+ end
47
52
  end
48
53
  end
49
54
  end
55
+ @display ||= @swt_widget.getDisplay
50
56
  end
51
57
 
52
58
  # Centers shell within monitor it is in
@@ -98,14 +104,15 @@ module Glimmer
98
104
  def pack_same_size
99
105
  minimum_size = @swt_widget.getMinimumSize
100
106
  bounds = @swt_widget.getBounds
107
+ width = @swt_widget.getBounds.width
108
+ height = @swt_widget.getBounds.height
109
+ x = @swt_widget.getBounds.x
110
+ y = @swt_widget.getBounds.y
101
111
  @swt_widget.setMinimumSize(bounds.width, bounds.height)
102
- listener = on_control_resized {
103
- @swt_widget.setSize(bounds.width, bounds.height)
104
- @swt_widget.setLocation(bounds.x, bounds.y)
105
- }
106
112
  @swt_widget.pack
107
- @swt_widget.removeControlListener(listener.swt_listener)
108
113
  @swt_widget.setMinimumSize(minimum_size)
114
+ @swt_widget.setSize(width, height)
115
+ @swt_widget.setLocation(x, y)
109
116
  end
110
117
 
111
118
  def content(&block)
@@ -102,6 +102,20 @@ module Glimmer
102
102
  end
103
103
  end
104
104
 
105
+ def pack_same_size
106
+ bounds = @swt_widget.getBounds
107
+ listener = on_control_resized {
108
+ @swt_widget.setSize(bounds.width, bounds.height)
109
+ @swt_widget.setLocation(bounds.x, bounds.y)
110
+ }
111
+ if @swt_widget.is_a?(Composite)
112
+ @swt_widget.layout(true, true)
113
+ else
114
+ @swt_widget.pack(true)
115
+ end
116
+ @swt_widget.removeControlListener(listener.swt_listener)
117
+ end
118
+
105
119
  def widget_property_listener_installers
106
120
  @swt_widget_property_listener_installers ||= {
107
121
  Java::OrgEclipseSwtWidgets::Control => {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -327,5 +327,5 @@ requirements: []
327
327
  rubygems_version: 3.0.6
328
328
  signing_key:
329
329
  specification_version: 4
330
- summary: Desktop application development library
330
+ summary: Desktop development library for Ruby
331
331
  test_files: []