glimmer-dsl-swt 0.5.0 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/glimmer/package.rb +2 -2
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/image_proxy.rb +63 -0
- data/lib/glimmer/swt/shell_proxy.rb +1 -1
- data/lib/glimmer/swt/table_proxy.rb +4 -1
- data/lib/glimmer/swt/widget_proxy.rb +31 -13
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0281642708bc9fc3c57d913c1b1a33e4f9699e6999d290467bbaf02b706319cb'
|
4
|
+
data.tar.gz: 9499e48b14742b2034321631edc06be69212fc0c762a13727ad70cf880d86b6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ad2211fa73e076d2993e3e487547cf486c96f500406666f6e9c3a16351c87f118337478b29fea0bd469d937ae7225520fc2efb55259db94766a97313990f9cc
|
7
|
+
data.tar.gz: 66312d638303de3ed1e6c100e4d4bec21c7b6e52203cfc2ef9368b2df7bb0662d08859f96be50fa4928dad10c88b112e71510c75de71f48ee818c7818c0dbbbd
|
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 0.5.
|
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 0.5.5 (Desktop GUI)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
3
3
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-dsl-swt/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-dsl-swt?branch=master)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.5
|
data/lib/glimmer/package.rb
CHANGED
@@ -21,7 +21,7 @@ module Glimmer
|
|
21
21
|
system('warble config')
|
22
22
|
new_config = File.read('config/warble.rb').split("\n").inject('') do |output, line|
|
23
23
|
if line.include?('config.dirs =')
|
24
|
-
line = line.sub('# ', '').sub(/=[^=\n]+$/, '= %w(app config db
|
24
|
+
line = line.sub('# ', '').sub(/=[^=\n]+$/, '= %w(app bin config db docs fonts icons images lib package script sounds vendor videos)')
|
25
25
|
end
|
26
26
|
if line.include?('config.includes =')
|
27
27
|
line = line.sub('# ', '').sub(/=[^=\n]+$/, "= FileList['LICENSE.txt', 'VERSION']")
|
@@ -51,7 +51,7 @@ module Glimmer
|
|
51
51
|
license = (File.read(license_file).strip if File.exists?(license_file) && File.file?(license_file)) rescue nil
|
52
52
|
copyright = license.split("\n").first
|
53
53
|
human_name = project_name.underscore.titlecase
|
54
|
-
command = "javapackager -deploy -native -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" -BinstalldirChooser=true -Bvendor=\"#{human_name}\" -Bwin.menuGroup=\"#{human_name}\" -BsystemWide
|
54
|
+
command = "javapackager -deploy -native -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" -BinstalldirChooser=true -Bvendor=\"#{human_name}\" -Bwin.menuGroup=\"#{human_name}\" -BsystemWide=#{OS.mac?} "
|
55
55
|
command += " -BjvmOptions=-XstartOnFirstThread " if OS.mac?
|
56
56
|
command += " -BappVersion=#{version} -Bmac.CFBundleVersion=#{version} " if version
|
57
57
|
command += " -srcfiles LICENSE.txt -BlicenseFile=LICENSE.txt " if license
|
@@ -5,7 +5,7 @@ module Glimmer
|
|
5
5
|
module SWT
|
6
6
|
# Proxy for org.eclipse.swt.graphics.Color
|
7
7
|
#
|
8
|
-
# Invoking `#swt_color` returns the SWT
|
8
|
+
# Invoking `#swt_color` returns the SWT Color object wrapped by this proxy
|
9
9
|
#
|
10
10
|
# Follows the Proxy Design Pattern
|
11
11
|
class ColorProxy
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Glimmer
|
2
|
+
module SWT
|
3
|
+
# Proxy for org.eclipse.swt.graphics.Image
|
4
|
+
#
|
5
|
+
# Invoking `#swt_image` returns the SWT Image object wrapped by this proxy
|
6
|
+
#
|
7
|
+
# Follows the Proxy Design Pattern
|
8
|
+
class ImageProxy
|
9
|
+
include_package 'org.eclipse.swt.graphics'
|
10
|
+
|
11
|
+
attr_reader :jar_file_path, :image_data
|
12
|
+
|
13
|
+
# Initializes a proxy for an SWT Image object
|
14
|
+
#
|
15
|
+
# Takes the same args as the SWT Image class
|
16
|
+
# Alternatively, takes a file path string or a uri:classloader file path string (generated by JRuby when invoking `File.expand_path` inside a JAR file)
|
17
|
+
# and returns an image object.
|
18
|
+
def initialize(*args)
|
19
|
+
@args = args
|
20
|
+
@jar_file_path = @args.first if @args.first.is_a?(String) && @args.size == 1
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def swt_image
|
25
|
+
unless @swt_image
|
26
|
+
if @jar_file_path
|
27
|
+
file_path = @jar_file_path
|
28
|
+
if file_path.start_with?('uri:classloader')
|
29
|
+
file_path = file_path.sub(/^uri\:classloader\:/, '').sub('//', '/') # the latter sub is needed for Mac
|
30
|
+
object = java.lang.Object.new
|
31
|
+
file_input_stream = object.java_class.resource_as_stream(file_path)
|
32
|
+
buffered_file_input_stream = java.io.BufferedInputStream.new(file_input_stream)
|
33
|
+
end
|
34
|
+
@image_data = ImageData.new(buffered_file_input_stream || file_path)
|
35
|
+
@swt_image = Image.new(DisplayProxy.instance.swt_display, @image_data)
|
36
|
+
else
|
37
|
+
@swt_image = Image.new(*@args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
@swt_image
|
41
|
+
end
|
42
|
+
|
43
|
+
def scale_to(width, height)
|
44
|
+
return @swt_image if image_data.nil?
|
45
|
+
scaled_image_data = image_data.scaledTo(width, height)
|
46
|
+
device = swt_image.device
|
47
|
+
swt_image.dispose
|
48
|
+
@swt_image = Image.new(device, scaled_image_data)
|
49
|
+
end
|
50
|
+
|
51
|
+
def method_missing(method, *args, &block)
|
52
|
+
swt_image.send(method, *args, &block)
|
53
|
+
rescue => e
|
54
|
+
Glimmer::Config.logger.debug {"Neither ImageProxy nor #{swt_image.class.name} can handle the method ##{method}"}
|
55
|
+
super
|
56
|
+
end
|
57
|
+
|
58
|
+
def respond_to?(method, *args, &block)
|
59
|
+
super || swt_image.respond_to?(method, *args, &block)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -61,6 +61,7 @@ module Glimmer
|
|
61
61
|
combo: {
|
62
62
|
widget_value_property: :text,
|
63
63
|
editor_gui: lambda do |args, model, property, table_proxy|
|
64
|
+
first_time = true
|
64
65
|
table_proxy.table_editor.minimumHeight = 25
|
65
66
|
table_editor_widget_proxy = combo(*args) {
|
66
67
|
items model.send("#{property}_options")
|
@@ -77,7 +78,9 @@ module Glimmer
|
|
77
78
|
end
|
78
79
|
}
|
79
80
|
on_widget_selected {
|
80
|
-
|
81
|
+
if !OS.windows? || !first_time || first_time && model.send(property) != table_editor_widget_proxy.swt_widget.text
|
82
|
+
table_proxy.finish_edit!
|
83
|
+
end
|
81
84
|
}
|
82
85
|
}
|
83
86
|
table_editor_widget_proxy
|
@@ -3,6 +3,7 @@ require 'glimmer/swt/color_proxy'
|
|
3
3
|
require 'glimmer/swt/font_proxy'
|
4
4
|
require 'glimmer/swt/swt_proxy'
|
5
5
|
require 'glimmer/swt/dnd_proxy'
|
6
|
+
require 'glimmer/swt/image_proxy'
|
6
7
|
|
7
8
|
# TODO refactor to make file smaller and extract sub-widget-proxies out of this
|
8
9
|
|
@@ -22,7 +23,7 @@ module Glimmer
|
|
22
23
|
|
23
24
|
DEFAULT_STYLES = {
|
24
25
|
"text" => [:border],
|
25
|
-
"table" => [:virtual, :border],
|
26
|
+
"table" => [:virtual, :border, :full_selection],
|
26
27
|
"tree" => [:virtual, :border, :h_scroll, :v_scroll],
|
27
28
|
"spinner" => [:border],
|
28
29
|
"styled_text" => [:border],
|
@@ -590,21 +591,18 @@ module Glimmer
|
|
590
591
|
@property_type_converters ||= {
|
591
592
|
:background => color_converter,
|
592
593
|
:background_image => lambda do |value|
|
594
|
+
image_proxy = nil
|
593
595
|
if value.is_a?(String)
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
end
|
600
|
-
image_data = ImageData.new(value)
|
601
|
-
# TODO in the future, look into unregistering this listener when no longer needed
|
596
|
+
image_proxy = ImageProxy.new(value)
|
597
|
+
elsif value.is_a?(Array)
|
598
|
+
image_proxy = ImageProxy.new(*value)
|
599
|
+
end
|
600
|
+
if image_proxy
|
602
601
|
on_swt_Resize do |resize_event|
|
603
|
-
|
604
|
-
@swt_widget.
|
605
|
-
@swt_widget.setBackgroundImage(Image.new(@swt_widget.getDisplay, new_image_data))
|
602
|
+
image_proxy.scale_to(@swt_widget.getSize.x, @swt_widget.getSize.y)
|
603
|
+
@swt_widget.setBackgroundImage(image_proxy.swt_image)
|
606
604
|
end
|
607
|
-
|
605
|
+
image_proxy.swt_image
|
608
606
|
else
|
609
607
|
value
|
610
608
|
end
|
@@ -618,6 +616,26 @@ module Glimmer
|
|
618
616
|
value
|
619
617
|
end
|
620
618
|
end,
|
619
|
+
:image => lambda do |value|
|
620
|
+
if value.is_a?(String)
|
621
|
+
ImageProxy.new(value).swt_image
|
622
|
+
elsif value.is_a?(Array)
|
623
|
+
ImageProxy.new(*value).swt_image
|
624
|
+
else
|
625
|
+
value
|
626
|
+
end
|
627
|
+
end,
|
628
|
+
:images => lambda do |array|
|
629
|
+
array.to_a.map do |value|
|
630
|
+
if value.is_a?(String)
|
631
|
+
ImageProxy.new(value).swt_image
|
632
|
+
elsif value.is_a?(Array)
|
633
|
+
ImageProxy.new(*value).swt_image
|
634
|
+
else
|
635
|
+
value
|
636
|
+
end
|
637
|
+
end.to_java(Image)
|
638
|
+
end,
|
621
639
|
:items => lambda do |value|
|
622
640
|
value.to_java :string
|
623
641
|
end,
|
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: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -344,6 +344,7 @@ files:
|
|
344
344
|
- lib/glimmer/swt/display_proxy.rb
|
345
345
|
- lib/glimmer/swt/dnd_proxy.rb
|
346
346
|
- lib/glimmer/swt/font_proxy.rb
|
347
|
+
- lib/glimmer/swt/image_proxy.rb
|
347
348
|
- lib/glimmer/swt/layout_data_proxy.rb
|
348
349
|
- lib/glimmer/swt/layout_proxy.rb
|
349
350
|
- lib/glimmer/swt/menu_proxy.rb
|