glimmer-dsl-gtk 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +16 -0
- data/LICENSE.txt +20 -0
- data/README.md +340 -0
- data/VERSION +1 -0
- data/bin/girb +30 -0
- data/bin/girb_runner.rb +45 -0
- data/glimmer-dsl-gtk.gemspec +0 -0
- data/lib/glimmer/dsl/gtk/dsl.rb +45 -0
- data/lib/glimmer/dsl/gtk/on_expression.rb +35 -0
- data/lib/glimmer/dsl/gtk/property_expression.rb +41 -0
- data/lib/glimmer/dsl/gtk/widget_expression.rb +50 -0
- data/lib/glimmer/gtk/widget_proxy/application_proxy.rb +39 -0
- data/lib/glimmer/gtk/widget_proxy/box_proxy.rb +40 -0
- data/lib/glimmer/gtk/widget_proxy/message_dialog_proxy.rb +42 -0
- data/lib/glimmer/gtk/widget_proxy/window_proxy.rb +75 -0
- data/lib/glimmer/gtk/widget_proxy.rb +165 -0
- data/lib/glimmer/gtk.rb +39 -0
- data/lib/glimmer-dsl-gtk.rb +46 -0
- data/samples/hello/hello_application.rb +11 -0
- data/samples/hello/hello_button.rb +20 -0
- data/samples/hello/hello_entry.rb +30 -0
- data/samples/hello/hello_world.rb +9 -0
- metadata +201 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright (c) 2021 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
|
+
require 'glimmer/gtk/widget_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Gtk
|
26
|
+
class WidgetProxy
|
27
|
+
# Proxy for Gtk box objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class BoxProxy < WidgetProxy
|
31
|
+
DEFAULT_ORIENTATION = :vertical
|
32
|
+
|
33
|
+
def initialize(keyword, parent, args, &block)
|
34
|
+
args[0] = :vertical if args[0].nil?
|
35
|
+
super
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Copyright (c) 2021 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
|
+
require 'glimmer/gtk/widget_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Gtk
|
26
|
+
class WidgetProxy
|
27
|
+
# Proxy for Gtk message dialog objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class MessageDialogProxy < WidgetProxy
|
31
|
+
DEFAULT_WIDTH = 190
|
32
|
+
|
33
|
+
def post_add_content
|
34
|
+
unless @initial_content_added
|
35
|
+
@initial_content_added = true
|
36
|
+
self.set_default_width(DEFAULT_WIDTH) if default_width == -1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Copyright (c) 2021 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
|
+
require 'glimmer/gtk/widget_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Gtk
|
26
|
+
class WidgetProxy
|
27
|
+
# Proxy for Gtk window objects
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class WindowProxy < WidgetProxy
|
31
|
+
DEFAULT_WIDTH = 190
|
32
|
+
DEFAULT_HEIGHT = 150
|
33
|
+
|
34
|
+
def post_add_content
|
35
|
+
unless @initial_content_added
|
36
|
+
@initial_content_added = true
|
37
|
+
self.set_default_size(DEFAULT_WIDTH, DEFAULT_HEIGHT) if default_size.include?(-1)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def show
|
42
|
+
super
|
43
|
+
unless @shown_at_least_once
|
44
|
+
@shown_at_least_once = true
|
45
|
+
::Gtk.main
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def present
|
50
|
+
super
|
51
|
+
unless @shown_at_least_once
|
52
|
+
@shown_at_least_once = true
|
53
|
+
::Gtk.main
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def signal_connect(signal, &block)
|
58
|
+
@destroy_signal_connected = true if signal.to_s.downcase == 'destroy'
|
59
|
+
super
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def build_widget
|
65
|
+
@gtk = ::Gtk::Window.new(*(@args.empty? ? [:toplevel] : normalize_args(@args))).tap do |new_window|
|
66
|
+
new_window.signal_connect(:destroy) do
|
67
|
+
# TODO in the future, make this yield to external signal connections that do not want to quit app on hitting the window close button
|
68
|
+
::Gtk.main_quit unless @destroy_signal_connected
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
# Copyright (c) 2021 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
|
+
module Glimmer
|
23
|
+
module Gtk
|
24
|
+
# Proxy for Gtk widget objects
|
25
|
+
#
|
26
|
+
# Follows the Proxy Design Pattern
|
27
|
+
class WidgetProxy
|
28
|
+
class << self
|
29
|
+
def exists?(keyword)
|
30
|
+
::Gtk.const_get(gtk_constant_symbol(keyword)) ||
|
31
|
+
widget_proxy_class(keyword)
|
32
|
+
end
|
33
|
+
|
34
|
+
def create(keyword, parent, args, &block)
|
35
|
+
widget_proxy_class(keyword).new(keyword, parent, args, &block)
|
36
|
+
end
|
37
|
+
|
38
|
+
def widget_proxy_class(keyword)
|
39
|
+
descendant_keyword_constant_map[keyword] || WidgetProxy
|
40
|
+
end
|
41
|
+
|
42
|
+
def new_widget(keyword, args)
|
43
|
+
end
|
44
|
+
|
45
|
+
def constant_symbol(keyword)
|
46
|
+
"#{keyword.camelcase(:upper)}Proxy".to_sym
|
47
|
+
end
|
48
|
+
|
49
|
+
def gtk_constant_symbol(keyword)
|
50
|
+
keyword.camelcase(:upper).to_sym
|
51
|
+
end
|
52
|
+
|
53
|
+
def keyword(constant_symbol)
|
54
|
+
constant_symbol.to_s.underscore.sub(/_proxy$/, '')
|
55
|
+
end
|
56
|
+
|
57
|
+
def descendant_keyword_constant_map
|
58
|
+
@descendant_keyword_constant_map ||= add_aliases_to_keyword_constant_map(map_descendant_keyword_constants_for(self))
|
59
|
+
end
|
60
|
+
|
61
|
+
def reset_descendant_keyword_constant_map
|
62
|
+
@descendant_keyword_constant_map = nil
|
63
|
+
descendant_keyword_constant_map
|
64
|
+
end
|
65
|
+
|
66
|
+
def map_descendant_keyword_constants_for(klass, accumulator: {})
|
67
|
+
klass.constants.map do |constant_symbol|
|
68
|
+
[constant_symbol, klass.const_get(constant_symbol)]
|
69
|
+
end.select do |constant_symbol, constant|
|
70
|
+
constant.is_a?(Module) && !accumulator.values.include?(constant)
|
71
|
+
end.each do |constant_symbol, constant|
|
72
|
+
accumulator[keyword(constant_symbol)] = constant
|
73
|
+
map_descendant_keyword_constants_for(constant, accumulator: accumulator)
|
74
|
+
end
|
75
|
+
accumulator
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def add_aliases_to_keyword_constant_map(keyword_constant_map)
|
81
|
+
KEYWORD_ALIASES.each do |keyword, alias_keyword|
|
82
|
+
keyword_constant_map[alias_keyword] = keyword_constant_map[keyword]
|
83
|
+
end
|
84
|
+
keyword_constant_map
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
KEYWORD_ALIASES = {
|
89
|
+
# 'msg_box' => 'message_box',
|
90
|
+
}
|
91
|
+
|
92
|
+
# gtk returns the contained Gtk object
|
93
|
+
attr_reader :parent_proxy, :gtk, :args, :keyword, :block
|
94
|
+
|
95
|
+
def initialize(keyword, parent, args, &block)
|
96
|
+
@keyword = keyword
|
97
|
+
@parent_proxy = parent
|
98
|
+
@args = args
|
99
|
+
@block = block
|
100
|
+
build_widget
|
101
|
+
post_add_content if @block.nil?
|
102
|
+
end
|
103
|
+
|
104
|
+
# Subclasses may override to perform post add_content work (normally must call super)
|
105
|
+
def post_add_content
|
106
|
+
@parent_proxy&.post_initialize_child(self)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Subclasses may override to perform post initialization work on an added child (normally must also call super)
|
110
|
+
def post_initialize_child(child)
|
111
|
+
@gtk.add(child.gtk)
|
112
|
+
child.gtk.show
|
113
|
+
end
|
114
|
+
|
115
|
+
def window_proxy
|
116
|
+
found_proxy = self
|
117
|
+
until found_proxy.nil? || found_proxy.is_a?(WindowProxy)
|
118
|
+
found_proxy = found_proxy.parent_proxy
|
119
|
+
end
|
120
|
+
found_proxy
|
121
|
+
end
|
122
|
+
|
123
|
+
def respond_to?(method_name, *args, &block)
|
124
|
+
respond_to_gtk?(method_name, *args, &block) ||
|
125
|
+
super(method_name, true)
|
126
|
+
end
|
127
|
+
|
128
|
+
def respond_to_gtk?(method_name, *args, &block)
|
129
|
+
@gtk.respond_to?(method_name, true) || @gtk.respond_to?("set_#{method_name}", true)
|
130
|
+
end
|
131
|
+
|
132
|
+
def method_missing(method_name, *args, &block)
|
133
|
+
if @gtk.respond_to?("set_#{method_name}", true) && !args.empty?
|
134
|
+
send_to_gtk("set_#{method_name}", *args, &block)
|
135
|
+
elsif @gtk.respond_to?(method_name, true)
|
136
|
+
send_to_gtk(method_name, *args, &block)
|
137
|
+
else
|
138
|
+
super
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def send_to_gtk(method_name, *args, &block)
|
143
|
+
@gtk.send(method_name, *args, &block)
|
144
|
+
end
|
145
|
+
|
146
|
+
def content(&block)
|
147
|
+
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Libui::WidgetExpression.new, @keyword, &block)
|
148
|
+
end
|
149
|
+
|
150
|
+
private
|
151
|
+
|
152
|
+
def build_widget
|
153
|
+
@gtk = ::Gtk.const_get(WidgetProxy.gtk_constant_symbol(@keyword)).new(*normalize_args(@args))
|
154
|
+
end
|
155
|
+
|
156
|
+
def normalize_args(args)
|
157
|
+
args.map do |arg|
|
158
|
+
arg.is_a?(WidgetProxy) ? arg.gtk : arg
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
Dir[File.expand_path('./widget_proxy/*.rb', __dir__)].each {|f| require f}
|
data/lib/glimmer/gtk.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) 2021 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
|
+
module Glimmer
|
23
|
+
# Proxy for the original ::Gtk module (with the future option of enhancing its abilities)
|
24
|
+
module Gtk
|
25
|
+
class << self
|
26
|
+
def respond_to?(method_name, *args)
|
27
|
+
super || ::LibUI.respond_to?(method_name, *args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def method_missing(method_name, *args, &block)
|
31
|
+
if ::LibUI.respond_to?(method_name, true)
|
32
|
+
::LibUI.send(method_name, *args, &block)
|
33
|
+
else
|
34
|
+
super
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright (c) 2021 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
|
+
$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
|
23
|
+
|
24
|
+
# External requires
|
25
|
+
require 'glimmer'
|
26
|
+
# require 'logging'
|
27
|
+
# require 'puts_debuggerer' if ENV['pd'].to_s.downcase == 'true'
|
28
|
+
# require 'super_module'
|
29
|
+
require 'os'
|
30
|
+
require 'array_include_methods'
|
31
|
+
require 'facets/string/underscore'
|
32
|
+
require 'facets/string/camelcase'
|
33
|
+
require 'facets/hash/stringify_keys'
|
34
|
+
require 'gtk3'
|
35
|
+
|
36
|
+
# Internal requires
|
37
|
+
# require 'ext/glimmer/config'
|
38
|
+
# require 'ext/glimmer'
|
39
|
+
require 'glimmer/dsl/gtk/dsl'
|
40
|
+
require 'glimmer/gtk'
|
41
|
+
Glimmer::Config.loop_max_count = -1
|
42
|
+
Glimmer::Config.excluded_keyword_checkers << lambda do |method_symbol, *args|
|
43
|
+
method = method_symbol.to_s
|
44
|
+
result = false
|
45
|
+
result ||= method == 'load_iseq'
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'glimmer-dsl-gtk'
|
2
|
+
|
3
|
+
include Glimmer
|
4
|
+
|
5
|
+
window { |w|
|
6
|
+
title 'Hello, Button!'
|
7
|
+
|
8
|
+
button('Button') {
|
9
|
+
on(:clicked) do
|
10
|
+
message_dialog(w) { |md|
|
11
|
+
title 'Information'
|
12
|
+
text 'You clicked the button'
|
13
|
+
|
14
|
+
on(:response) do
|
15
|
+
md.destroy
|
16
|
+
end
|
17
|
+
}.show
|
18
|
+
end
|
19
|
+
}
|
20
|
+
}.show
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'glimmer-dsl-gtk'
|
2
|
+
|
3
|
+
include Glimmer
|
4
|
+
|
5
|
+
window { |w|
|
6
|
+
title 'Hello, Entry!'
|
7
|
+
default_size 300, 50
|
8
|
+
|
9
|
+
box(:vertical) {
|
10
|
+
e = entry {
|
11
|
+
on(:changed) do
|
12
|
+
puts e.text
|
13
|
+
$stdout.flush # For Windows
|
14
|
+
end
|
15
|
+
}
|
16
|
+
|
17
|
+
button('Button') {
|
18
|
+
on(:clicked) do
|
19
|
+
message_dialog(w) { |md|
|
20
|
+
title 'You entered'
|
21
|
+
text e.text
|
22
|
+
|
23
|
+
on(:response) do
|
24
|
+
md.destroy
|
25
|
+
end
|
26
|
+
}.show
|
27
|
+
end
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}.show
|
metadata
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: glimmer-dsl-gtk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andy Maleh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: glimmer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.4.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: os
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.0.0
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.0
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.0.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: gtk3
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.4.9
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.4.9
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 3.5.0
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 3.5.0
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rdoc
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.12'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.12'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: juwelier
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 2.1.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 2.1.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: simplecov
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: puts_debuggerer
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: rake-tui
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
description: Glimmer DSL for GTK - Ruby-GNOME Desktop Development GUI Library
|
146
|
+
email: andy.am@gmail.com
|
147
|
+
executables:
|
148
|
+
- girb
|
149
|
+
extensions: []
|
150
|
+
extra_rdoc_files:
|
151
|
+
- CHANGELOG.md
|
152
|
+
- LICENSE.txt
|
153
|
+
- README.md
|
154
|
+
files:
|
155
|
+
- CHANGELOG.md
|
156
|
+
- LICENSE.txt
|
157
|
+
- README.md
|
158
|
+
- VERSION
|
159
|
+
- bin/girb
|
160
|
+
- bin/girb_runner.rb
|
161
|
+
- glimmer-dsl-gtk.gemspec
|
162
|
+
- lib/glimmer-dsl-gtk.rb
|
163
|
+
- lib/glimmer/dsl/gtk/dsl.rb
|
164
|
+
- lib/glimmer/dsl/gtk/on_expression.rb
|
165
|
+
- lib/glimmer/dsl/gtk/property_expression.rb
|
166
|
+
- lib/glimmer/dsl/gtk/widget_expression.rb
|
167
|
+
- lib/glimmer/gtk.rb
|
168
|
+
- lib/glimmer/gtk/widget_proxy.rb
|
169
|
+
- lib/glimmer/gtk/widget_proxy/application_proxy.rb
|
170
|
+
- lib/glimmer/gtk/widget_proxy/box_proxy.rb
|
171
|
+
- lib/glimmer/gtk/widget_proxy/message_dialog_proxy.rb
|
172
|
+
- lib/glimmer/gtk/widget_proxy/window_proxy.rb
|
173
|
+
- samples/hello/hello_application.rb
|
174
|
+
- samples/hello/hello_button.rb
|
175
|
+
- samples/hello/hello_entry.rb
|
176
|
+
- samples/hello/hello_world.rb
|
177
|
+
homepage: http://github.com/AndyObtiva/glimmer-dsl-gtk
|
178
|
+
licenses:
|
179
|
+
- MIT
|
180
|
+
metadata: {}
|
181
|
+
post_install_message:
|
182
|
+
rdoc_options: []
|
183
|
+
require_paths:
|
184
|
+
- lib
|
185
|
+
- "."
|
186
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
requirements: []
|
197
|
+
rubygems_version: 3.2.22
|
198
|
+
signing_key:
|
199
|
+
specification_version: 4
|
200
|
+
summary: Glimmer DSL for GTK
|
201
|
+
test_files: []
|