glimmer-dsl-tk 0.0.25 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,246 @@
1
+ # Copyright (c) 2020-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-dsl-tk'
23
+
24
+ class HelloText
25
+ include Glimmer
26
+
27
+ COLOR_OPTIONS = %w[black purple blue green orange yellow red white].map(&:capitalize)
28
+ FONT_FAMILY_OPTIONS = ::TkFont.families
29
+ FOREGROUND_PROMPT = '<foreground>'
30
+ BACKGROUND_PROMPT = '<background>'
31
+ FONT_FAMILY_PROMPT = '<font family>'
32
+ FONT_SIZE_PROMPT = '<font size>'
33
+
34
+ def initialize
35
+ @foreground = FOREGROUND_PROMPT
36
+ @background = BACKGROUND_PROMPT
37
+ @font_family = FONT_FAMILY_PROMPT
38
+ @font_size = FONT_SIZE_PROMPT
39
+ @document = <<~MULTI_LINE_STRING
40
+ According to the National Post, a heavy metal-loving high school principal in Canada will be allowed to keep her job, days after a public campaign to oust her made headlines around the globe.
41
+
42
+ Parents at Eden High School in St. Catharines, Ontario launched a petition to remove principal Sharon Burns after discovering she's an IRON MAIDEN fan.
43
+
44
+ The petition, titled "Eden High School Principal, Sharon Burns, Needs to Be Transferred Immediately!" read, "We are deeply disturbed that the principal assigned to the school blatantly showed Satanic symbols and her allegiance to Satanic practices on her public social media platforms where all the students can see them under @edenprincipal (not her personal account)."
45
+
46
+ More than 500 people signed the petition to transfer Burns after she posted a picture of herself flashing the "devil horns" hand sign with a doll of the MAIDEN zombie mascot Eddie behind her as well as a personalized license plate reading "IRNMADEN" and a handwritten note that reads "Eddie 666" on a car's dashboard.
47
+
48
+
49
+ The number 666 is used to represent the devil, and is featured prominently in MAIDEN's artwork by the band, whose classic third album is titled "The Number Of The Beast".
50
+
51
+ The petition was later updated to state that the demand for her transfer is not because of her love for metal, but for "openly displaying her own handmade sign with the 666 clearly displayed on it".
52
+
53
+ The creator of the original petition wrote: "Sharon knows full well what she did was simply inappropriate, unnecessary and not professional but has yet to publicly admit so and is willing to allow people to believe a completely different story, making very real concerns seem petty."
54
+
55
+ Meanwhile, a counter-petition supporting Burns garnered over 20,000 signatures.
56
+
57
+ "It is ridiculous that a couple of parents judge her role as a principal only based on an Instagram post. (About liking the band IRON MAIDEN. That's it.) Eden High School is a public school. Not a Christian school," the petition titled "We need Mrs Burns" stated. "She has made Eden a safe space for so many people. She spreads nothing but love and kindness."
58
+
59
+ After the complaints were aired, the District School Board of Niagara spoke with Burns and the parents who launched the petition, and the issue is over as far as the board is concerned, Kim Sweeney, the board's chief communications officer, told the National Post. No disciplinary action or policy changes were needed.
60
+
61
+ "Our belief is that taste in music is subjective and we support that both students and staff enjoy a wide variety of genres," Sweeney said.
62
+
63
+ The original petition has since been removed.
64
+ MULTI_LINE_STRING
65
+ end
66
+
67
+ attr_accessor :document
68
+
69
+ attr_accessor :foreground
70
+
71
+ def foreground_options
72
+ [FOREGROUND_PROMPT] + COLOR_OPTIONS
73
+ end
74
+
75
+ attr_accessor :background
76
+
77
+ def background_options
78
+ [BACKGROUND_PROMPT] + COLOR_OPTIONS
79
+ end
80
+
81
+ attr_accessor :font_family
82
+
83
+ def font_family_options
84
+ [FONT_FAMILY_PROMPT] + FONT_FAMILY_OPTIONS
85
+ end
86
+
87
+ attr_accessor :font_size
88
+
89
+ def font_size_options
90
+ [FONT_SIZE_PROMPT] + (9..64).to_a.map(&:to_s)
91
+ end
92
+
93
+ def launch
94
+ root {
95
+ title 'Hello, Text!'
96
+
97
+ frame {
98
+ grid row: 0, column: 0
99
+
100
+ label {
101
+ grid row: 0, column: 0, columnspan: 17
102
+ text 'Select a region of text and then apply formatting from the toolbar'
103
+ }
104
+
105
+ column_index = -1
106
+
107
+ combobox {
108
+ grid row: 1, column: column_index += 1, column_weight: 1
109
+ readonly true
110
+ text <=> [self, :font_family, after_write: ->(value) { @text.toggle_selection_font_format('family', value == FONT_FAMILY_PROMPT ? 'Courier New' : value) }]
111
+ }
112
+
113
+ combobox {
114
+ grid row: 1, column: column_index += 1, column_weight: 1
115
+ readonly true
116
+ text <=> [self, :font_size, after_write: ->(value) { @text.toggle_selection_font_format('size', value == FONT_SIZE_PROMPT ? 13 : value) }]
117
+ }
118
+
119
+ combobox {
120
+ grid row: 1, column: column_index += 1, column_weight: 1
121
+ readonly true
122
+ text <=> [self, :foreground, after_write: ->(value) { @text.add_selection_format('foreground', value == FOREGROUND_PROMPT ? 'black' : value) }]
123
+ }
124
+
125
+ combobox {
126
+ grid row: 1, column: column_index += 1, column_weight: 1
127
+ readonly true
128
+ text <=> [self, :background, after_write: ->(value) { @text.add_selection_format('background', value == BACKGROUND_PROMPT ? 'white' : value) }]
129
+ }
130
+
131
+ separator {
132
+ grid row: 1, column: column_index += 1, column_weight: 0
133
+ orient 'vertical'
134
+ }
135
+
136
+ button {
137
+ grid row: 1, column: column_index += 1, column_weight: 0
138
+ text 'B'
139
+ style font: {weight: 'bold'}
140
+
141
+ on('command') do
142
+ @text.toggle_selection_font_format('weight', 'bold')
143
+ end
144
+ }
145
+
146
+ button {
147
+ grid row: 1, column: column_index += 1, column_weight: 0
148
+ text 'I'
149
+ style font: {slant: 'italic'}
150
+
151
+ on('command') do
152
+ @text.toggle_selection_font_format('slant', 'italic')
153
+ end
154
+ }
155
+
156
+ button {
157
+ grid row: 1, column: column_index += 1, column_weight: 0
158
+ text 'U'
159
+ style font: {underline: true}
160
+
161
+ on('command') do
162
+ @text.toggle_selection_font_format('underline', true)
163
+ end
164
+ }
165
+
166
+ separator {
167
+ grid row: 1, column: column_index += 1, column_weight: 0
168
+ orient 'vertical'
169
+ }
170
+
171
+ button {
172
+ grid row: 1, column: column_index += 1, column_weight: 0
173
+ image File.expand_path("images/cut.png", __dir__), subsample: 32
174
+
175
+ on('command') do
176
+ @text.text_cut
177
+ end
178
+ }
179
+
180
+ button {
181
+ grid row: 1, column: column_index += 1, column_weight: 0
182
+ image File.expand_path("images/copy.png", __dir__), subsample: 32
183
+
184
+ on('command') do
185
+ @text.text_copy
186
+ end
187
+ }
188
+
189
+ button {
190
+ grid row: 1, column: column_index += 1, column_weight: 0
191
+ image File.expand_path("images/paste.png", __dir__), subsample: 32
192
+
193
+ on('command') do
194
+ @text.text_paste
195
+ end
196
+ }
197
+
198
+ separator {
199
+ grid row: 1, column: column_index += 1, column_weight: 0
200
+ orient 'vertical'
201
+ }
202
+
203
+ button {
204
+ grid row: 1, column: column_index += 1, column_weight: 0
205
+ image File.expand_path("images/undo.png", __dir__), subsample: 32
206
+
207
+ on('command') do
208
+ @text.edit_undo
209
+ end
210
+ }
211
+
212
+ button {
213
+ grid row: 1, column: column_index += 1, column_weight: 0
214
+ image File.expand_path("images/redo.png", __dir__), subsample: 32
215
+
216
+ on('command') do
217
+ @text.edit_redo
218
+ end
219
+ }
220
+
221
+ separator {
222
+ grid row: 1, column: column_index += 1, column_weight: 0
223
+ orient 'vertical'
224
+ }
225
+
226
+ button {
227
+ grid row: 1, column: column_index += 1, column_weight: 0
228
+ image File.expand_path("images/picture.png", __dir__), subsample: 32
229
+
230
+ on('command') do
231
+ @text.get_open_file_to_insert_image
232
+ end
233
+ }
234
+ }
235
+
236
+ @text = text {
237
+ grid row: 1, column: 0, row_weight: 1
238
+ wrap 'word'
239
+ undo true
240
+ value <=> [self, :document]
241
+ }
242
+ }.open
243
+ end
244
+ end
245
+
246
+ HelloText.new.launch
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-tk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-16 00:00:00.000000000 Z
11
+ date: 2021-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.1.2
19
+ version: 2.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.1.2
26
+ version: 2.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: puts_debuggerer
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -191,7 +191,7 @@ dependencies:
191
191
  - !ruby/object:Gem::Version
192
192
  version: 0.7.0
193
193
  description: Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library) - Ruby
194
- DSL for Tcl/Tk with bidirectional/unidirectional data-binding support
194
+ DSL for Tcl/Tk with bidirectional/unidirectional data-binding support.
195
195
  email: andy.am@gmail.com
196
196
  executables:
197
197
  - girb
@@ -215,6 +215,7 @@ files:
215
215
  - lib/glimmer/dsl/tk/attribute_expression.rb
216
216
  - lib/glimmer/dsl/tk/bind_expression.rb
217
217
  - lib/glimmer/dsl/tk/block_attribute_expression.rb
218
+ - lib/glimmer/dsl/tk/built_in_dialog_expression.rb
218
219
  - lib/glimmer/dsl/tk/data_binding_expression.rb
219
220
  - lib/glimmer/dsl/tk/dsl.rb
220
221
  - lib/glimmer/dsl/tk/format_expression.rb
@@ -228,6 +229,7 @@ files:
228
229
  - lib/glimmer/tk/checkbutton_proxy.rb
229
230
  - lib/glimmer/tk/combobox_proxy.rb
230
231
  - lib/glimmer/tk/commandable.rb
232
+ - lib/glimmer/tk/drag_and_drop_extension.rb
231
233
  - lib/glimmer/tk/entry_proxy.rb
232
234
  - lib/glimmer/tk/frame_proxy.rb
233
235
  - lib/glimmer/tk/label_proxy.rb
@@ -242,11 +244,13 @@ files:
242
244
  - lib/glimmer/tk/variable_owner.rb
243
245
  - lib/glimmer/tk/widget_proxy.rb
244
246
  - samples/elaborate/meta_sample.rb
247
+ - samples/hello/hello_built_in_dialog.rb
245
248
  - samples/hello/hello_button.rb
246
249
  - samples/hello/hello_checkbutton.rb
247
250
  - samples/hello/hello_combobox.rb
248
251
  - samples/hello/hello_computed.rb
249
252
  - samples/hello/hello_computed/contact.rb
253
+ - samples/hello/hello_drag_and_drop.rb
250
254
  - samples/hello/hello_entry.rb
251
255
  - samples/hello/hello_frame.rb
252
256
  - samples/hello/hello_label.rb
@@ -256,8 +260,12 @@ files:
256
260
  - samples/hello/hello_notebook.rb
257
261
  - samples/hello/hello_radiobutton.rb
258
262
  - samples/hello/hello_root.rb
263
+ - samples/hello/hello_separator.rb
259
264
  - samples/hello/hello_spinbox.rb
265
+ - samples/hello/hello_text.rb
260
266
  - samples/hello/hello_world.rb
267
+ - samples/hello/images/copy.png
268
+ - samples/hello/images/cut.png
261
269
  - samples/hello/images/denmark.png
262
270
  - samples/hello/images/finland.png
263
271
  - samples/hello/images/france.png
@@ -266,6 +274,11 @@ files:
266
274
  - samples/hello/images/mexico.png
267
275
  - samples/hello/images/netherlands.png
268
276
  - samples/hello/images/norway.png
277
+ - samples/hello/images/paste.png
278
+ - samples/hello/images/picture.png
279
+ - samples/hello/images/redo.png
280
+ - samples/hello/images/search.png
281
+ - samples/hello/images/undo.png
269
282
  - samples/hello/images/usa.png
270
283
  homepage: http://github.com/AndyObtiva/glimmer-dsl-tk
271
284
  licenses:
@@ -287,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
300
  - !ruby/object:Gem::Version
288
301
  version: '0'
289
302
  requirements: []
290
- rubygems_version: 3.2.22
303
+ rubygems_version: 3.2.29
291
304
  signing_key:
292
305
  specification_version: 4
293
306
  summary: Glimmer DSL for Tk