glimmer-dsl-swt 4.17.7.0 → 4.17.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -119,4 +119,4 @@ module Glimmer
119
119
  end
120
120
  end
121
121
  end
122
- end
122
+ end
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -65,7 +65,7 @@ module Glimmer
65
65
  @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
66
66
  # TODO make this an option not the default
67
67
  on_swt_show do
68
- Thread.new do
68
+ Thread.new do
69
69
  sleep(0.25)
70
70
  async_exec do
71
71
  @swt_widget.setActive unless @swt_widget.isDisposed
@@ -130,7 +130,7 @@ module Glimmer
130
130
  @swt_widget.pack
131
131
  @swt_widget.removeControlListener(listener.swt_listener)
132
132
  @swt_widget.setMinimumSize(minimum_size)
133
- elsif OS.linux?
133
+ elsif OS.linux?
134
134
  @swt_widget.layout(true, true)
135
135
  @swt_widget.setBounds(bounds)
136
136
  end
@@ -171,4 +171,4 @@ module Glimmer
171
171
  end
172
172
  end
173
173
  end
174
- end
174
+ end
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -108,7 +108,7 @@ module Glimmer
108
108
  if init_args.empty?
109
109
  selected_widget_proxy_class.new(swt_widget: swt_widget)
110
110
  else
111
- selected_widget_proxy_class.new(*init_args)
111
+ selected_widget_proxy_class.new(*init_args)
112
112
  end
113
113
  end
114
114
 
@@ -119,11 +119,11 @@ module Glimmer
119
119
  Glimmer::SWT.const_get(class_name)
120
120
  rescue
121
121
  Glimmer::SWT::WidgetProxy
122
- end
122
+ end
123
123
  end
124
124
 
125
125
  def underscored_widget_name(swt_widget)
126
- swt_widget.class.name.split(/::|\./).last.underscore
126
+ swt_widget.class.name.split(/::|\./).last.underscore
127
127
  end
128
128
  end
129
129
 
@@ -131,7 +131,7 @@ module Glimmer
131
131
 
132
132
  # Initializes a new SWT Widget
133
133
  #
134
- # It is preferred to use `::create` method instead since it instantiates the
134
+ # It is preferred to use `::create` method instead since it instantiates the
135
135
  # right subclass per widget keyword
136
136
  #
137
137
  # keyword, parent, swt_widget_args (including styles)
@@ -152,7 +152,7 @@ module Glimmer
152
152
  @parent_proxy = parent.get_data('proxy') || parent_proxy_class.new(swt_widget: parent)
153
153
  end
154
154
  if @swt_widget&.get_data('proxy').nil?
155
- @swt_widget.set_data('proxy', self)
155
+ @swt_widget.set_data('proxy', self)
156
156
  DEFAULT_INITIALIZERS[underscored_widget_name]&.call(@swt_widget)
157
157
  @parent_proxy.post_initialize_child(self)
158
158
  end
@@ -376,7 +376,7 @@ module Glimmer
376
376
  observer.call(@last_top_index)
377
377
  end
378
378
  }
379
- end,
379
+ end,
380
380
  :top_pixel => lambda do |observer|
381
381
  @last_top_pixel = @swt_widget.getTopPixel
382
382
  on_paint_control { |event|
@@ -480,13 +480,13 @@ module Glimmer
480
480
  proxy.set_attribute(:transfer, :text)
481
481
  proxy.on_drag_enter { |event|
482
482
  event.detail = DNDProxy[:drop_copy]
483
- }
483
+ }
484
484
  end
485
485
  end
486
486
 
487
487
  # TODO eliminate duplication in the following methods perhaps by relying on exceptions
488
488
 
489
- def can_handle_observation_request?(observation_request)
489
+ def can_handle_observation_request?(observation_request)
490
490
  observation_request = observation_request.to_s
491
491
  if observation_request.start_with?('on_swt_')
492
492
  constant_name = observation_request.sub(/^on_swt_/, '')
@@ -509,7 +509,7 @@ module Glimmer
509
509
  end
510
510
  rescue => e
511
511
  Glimmer::Config.logger.debug {e.full_message}
512
- false
512
+ false
513
513
  end
514
514
 
515
515
  def can_handle_drop_observation_request?(observation_request)
@@ -547,7 +547,7 @@ module Glimmer
547
547
  end
548
548
 
549
549
  def method_missing(method, *args, &block)
550
- if can_handle_observation_request?(method)
550
+ if can_handle_observation_request?(method)
551
551
  handle_observation_request(method, &block)
552
552
  else
553
553
  swt_widget.send(method, *args, &block)
@@ -559,7 +559,7 @@ module Glimmer
559
559
  end
560
560
 
561
561
  def respond_to?(method, *args, &block)
562
- super ||
562
+ super ||
563
563
  can_handle_observation_request?(method) ||
564
564
  swt_widget.respond_to?(method, *args, &block)
565
565
  end
@@ -567,7 +567,7 @@ module Glimmer
567
567
  private
568
568
 
569
569
  def style(underscored_widget_name, styles)
570
- styles = [styles].flatten.compact
570
+ styles = [styles].flatten.compact
571
571
  styles = default_style(underscored_widget_name) if styles.empty?
572
572
  interpret_style(*styles)
573
573
  end
@@ -603,9 +603,9 @@ module Glimmer
603
603
  end
604
604
 
605
605
  def add_listener(underscored_listener_name, &block)
606
- widget_add_listener_method, listener_class, listener_method = self.class.find_listener(@swt_widget.getClass, underscored_listener_name)
606
+ widget_add_listener_method, listener_class, listener_method = self.class.find_listener(@swt_widget.getClass, underscored_listener_name)
607
607
  widget_listener_proxy = nil
608
- safe_block = lambda { |*args| block.call(*args) unless @swt_widget.isDisposed }
608
+ safe_block = lambda { |*args| block.call(*args) unless @swt_widget.isDisposed }
609
609
  listener = listener_class.new(listener_method => safe_block)
610
610
  @swt_widget.send(widget_add_listener_method, listener)
611
611
  widget_listener_proxy = WidgetListenerProxy.new(swt_widget: @swt_widget, swt_listener: listener, widget_add_listener_method: widget_add_listener_method, swt_listener_class: listener_class, swt_listener_method: listener_method)
@@ -647,7 +647,7 @@ module Glimmer
647
647
  listener_class.define_method('initialize') do |event_method_block_mapping|
648
648
  @event_method_block_mapping = event_method_block_mapping
649
649
  end
650
- listener_type.getMethods.each do |event_method|
650
+ listener_type.getMethods.each do |event_method|
651
651
  listener_class.define_method(event_method.getName) do |*args|
652
652
  @event_method_block_mapping[event_method.getName]&.call(*args)
653
653
  end
@@ -678,9 +678,9 @@ module Glimmer
678
678
  },
679
679
  'selection_count' => {
680
680
  getter: {name: 'getSelectionCount'},
681
- setter: {name: 'setSelection', invoker: lambda { |widget, args|
681
+ setter: {name: 'setSelection', invoker: lambda { |widget, args|
682
682
  caret_position = @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getCaretOffset
683
- @swt_widget.setSelection(caret_position, caret_position + args.first) if args.first
683
+ @swt_widget.setSelection(caret_position, caret_position + args.first) if args.first
684
684
  }},
685
685
  },
686
686
  }
@@ -773,13 +773,13 @@ module Glimmer
773
773
  sleep(delayTime)
774
774
  end
775
775
  };
776
- image_proxy = nil
776
+ image_proxy = nil
777
777
  else
778
778
  on_swt_Resize do |resize_event|
779
779
  image_proxy.scale_to(@swt_widget.getSize.x, @swt_widget.getSize.y)
780
- @swt_widget.setBackgroundImage(image_proxy.swt_image)
781
- end
782
- end
780
+ @swt_widget.setBackgroundImage(image_proxy.swt_image)
781
+ end
782
+ end
783
783
 
784
784
  image_proxy&.swt_image
785
785
  end,
@@ -841,4 +841,4 @@ module Glimmer
841
841
  end
842
842
  end
843
843
  end
844
- end
844
+ end
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -64,4 +64,4 @@ module Glimmer
64
64
  end
65
65
  end
66
66
  end
67
- end
67
+ end
@@ -0,0 +1,60 @@
1
+ # Copyright (c) 2007-2020 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class HelloDirectoryDialog
23
+ include Glimmer
24
+
25
+ attr_accessor :selected_directory
26
+
27
+ def initialize
28
+ @selected_directory = 'Please select a directory.'
29
+ end
30
+
31
+ def launch
32
+ shell {
33
+ minimum_size 400, 0
34
+ grid_layout
35
+
36
+ text 'Hello, Directory Dialog!'
37
+
38
+ label {
39
+ text 'Selected Directory:'
40
+ font height: 14, style: :bold
41
+ }
42
+
43
+ label {
44
+ layout_data :fill, :center, true, false
45
+ text bind(self, :selected_directory)
46
+ font height: 14
47
+ }
48
+
49
+ button {
50
+ text "Browse..."
51
+
52
+ on_widget_selected {
53
+ self.selected_directory = directory_dialog.open
54
+ }
55
+ }
56
+ }.open
57
+ end
58
+ end
59
+
60
+ HelloDirectoryDialog.new.launch
@@ -0,0 +1,60 @@
1
+ # Copyright (c) 2007-2020 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class HelloFileDialog
23
+ include Glimmer
24
+
25
+ attr_accessor :selected_file
26
+
27
+ def initialize
28
+ @selected_file = 'Please select a file.'
29
+ end
30
+
31
+ def launch
32
+ shell {
33
+ minimum_size 400, 0
34
+ grid_layout
35
+
36
+ text 'Hello, File Dialog!'
37
+
38
+ label {
39
+ text 'Selected File:'
40
+ font height: 14, style: :bold
41
+ }
42
+
43
+ label {
44
+ layout_data :fill, :center, true, false
45
+ text bind(self, :selected_file)
46
+ font height: 14
47
+ }
48
+
49
+ button {
50
+ text "Browse..."
51
+
52
+ on_widget_selected {
53
+ self.selected_file = file_dialog.open
54
+ }
55
+ }
56
+ }.open
57
+ end
58
+ end
59
+
60
+ HelloFileDialog.new.launch
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -20,7 +20,7 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  class HelloListSingleSelection
23
- class Person
23
+ class Person
24
24
  attr_accessor :country, :country_options
25
25
 
26
26
  def initialize
@@ -56,4 +56,4 @@ class HelloListSingleSelection
56
56
  end
57
57
  end
58
58
 
59
- HelloListSingleSelection.new.launch
59
+ HelloListSingleSelection.new.launch
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -26,4 +26,4 @@ shell {
26
26
  label {
27
27
  text 'Hello, World!'
28
28
  }
29
- }.open
29
+ }.open
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.17.7.0
4
+ version: 4.17.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-29 00:00:00.000000000 Z
11
+ date: 2020-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -353,11 +353,13 @@ files:
353
353
  - lib/glimmer/dsl/swt/custom_widget_expression.rb
354
354
  - lib/glimmer/dsl/swt/data_binding_expression.rb
355
355
  - lib/glimmer/dsl/swt/dialog_expression.rb
356
+ - lib/glimmer/dsl/swt/directory_dialog_expression.rb
356
357
  - lib/glimmer/dsl/swt/display_expression.rb
357
358
  - lib/glimmer/dsl/swt/dnd_expression.rb
358
359
  - lib/glimmer/dsl/swt/dsl.rb
359
360
  - lib/glimmer/dsl/swt/exec_expression.rb
360
361
  - lib/glimmer/dsl/swt/expand_item_expression.rb
362
+ - lib/glimmer/dsl/swt/file_dialog_expression.rb
361
363
  - lib/glimmer/dsl/swt/font_expression.rb
362
364
  - lib/glimmer/dsl/swt/image_expression.rb
363
365
  - lib/glimmer/dsl/swt/layout_data_expression.rb
@@ -390,9 +392,11 @@ files:
390
392
  - lib/glimmer/swt/custom/checkbox_group.rb
391
393
  - lib/glimmer/swt/custom/code_text.rb
392
394
  - lib/glimmer/swt/custom/radio_group.rb
395
+ - lib/glimmer/swt/directory_dialog_proxy.rb
393
396
  - lib/glimmer/swt/display_proxy.rb
394
397
  - lib/glimmer/swt/dnd_proxy.rb
395
398
  - lib/glimmer/swt/expand_item_proxy.rb
399
+ - lib/glimmer/swt/file_dialog_proxy.rb
396
400
  - lib/glimmer/swt/font_proxy.rb
397
401
  - lib/glimmer/swt/image_proxy.rb
398
402
  - lib/glimmer/swt/layout_data_proxy.rb
@@ -433,8 +437,10 @@ files:
433
437
  - samples/hello/hello_computed/contact.rb
434
438
  - samples/hello/hello_custom_shell.rb
435
439
  - samples/hello/hello_custom_widget.rb
440
+ - samples/hello/hello_directory_dialog.rb
436
441
  - samples/hello/hello_drag_and_drop.rb
437
442
  - samples/hello/hello_expand_bar.rb
443
+ - samples/hello/hello_file_dialog.rb
438
444
  - samples/hello/hello_list_multi_selection.rb
439
445
  - samples/hello/hello_list_single_selection.rb
440
446
  - samples/hello/hello_menu_bar.rb