tk 0.3.0 → 0.5.0
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.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/test.yml +29 -0
- data/README.macosx-aqua +1 -1
- data/ext/tk/extconf.rb +2 -2
- data/ext/tk/tkutil/tkutil.c +4 -3
- data/lib/multi-tk.rb +5 -6
- data/lib/remote-tk.rb +1 -1
- data/lib/thread_tk.rb +13 -0
- data/lib/tk/autoload.rb +3 -3
- data/lib/tk/canvastag.rb +3 -3
- data/lib/tk/entry.rb +1 -1
- data/lib/tk/grid.rb +3 -3
- data/lib/tk/itemconfig.rb +4 -4
- data/lib/tk/itemfont.rb +3 -3
- data/lib/tk/listbox.rb +1 -1
- data/lib/tk/menuspec.rb +0 -1
- data/lib/tk/namespace.rb +2 -2
- data/lib/tk/optiondb.rb +0 -1
- data/lib/tk/optionobj.rb +1 -1
- data/lib/tk/scale.rb +1 -1
- data/lib/tk/text.rb +1 -1
- data/lib/tk/validation.rb +2 -2
- data/lib/tk/variable.rb +3 -3
- data/lib/tk/winfo.rb +1 -1
- data/lib/tk.rb +13 -64
- data/lib/tkextlib/blt/component.rb +3 -3
- data/lib/tkextlib/bwidget/progressdlg.rb +2 -2
- data/lib/tkextlib/iwidgets/entryfield.rb +1 -1
- data/lib/tkextlib/iwidgets/promptdialog.rb +1 -1
- data/lib/tkextlib/iwidgets/spinner.rb +1 -1
- data/lib/tkextlib/tcllib/tablelist_core.rb +1 -1
- data/lib/tkextlib/tile/treeview.rb +2 -2
- data/lib/tkextlib/tile.rb +0 -1
- data/lib/tkextlib/tktable/tktable.rb +1 -1
- data/lib/tkextlib/treectrl/tktreectrl.rb +1 -1
- data/sample/demos-en/knightstour.rb +1 -0
- data/sample/demos-jp/knightstour.rb +1 -0
- data/sample/demos-jp/widget +4 -4
- data/sample/irbtk.rb +2 -0
- data/sample/irbtkw.rbw +13 -4
- data/sample/tktextio.rb +5 -1
- data/tk.gemspec +1 -1
- metadata +9 -7
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27203ca65a4961a7c3594cd5ec6c50d9f1440aec4640b48d3dc3a2749f599724
|
4
|
+
data.tar.gz: ec99535ddf2b33049fde77d89eee84b1665ca7252ea4ed0b6d5c2d37af87da33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d46c0686e090c00f1654ac716f19fe900d007e333fee2e88b01386093024315d30db0439765a7db95093f52f75346f3c7d9e241fa969109cfdb5d88de4b7576
|
7
|
+
data.tar.gz: bcb71a0b498617dc4fdf7a5a260923d99ecd2a8b966cc4c6de9d537b79a8153f1143c171769f06d6f05fdf452c2e059f863df430b1564a95c84e70c7e98e6d32
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
name: build (${{ matrix.ruby }}
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ 3.2, 3.1, '3.0', 2.7, head ]
|
11
|
+
runs-on: ubuntu-20.04
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v4
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
- name: Install dependencies
|
19
|
+
run: |
|
20
|
+
sudo apt install tk-dev
|
21
|
+
gem install bundler --no-document
|
22
|
+
bundle install
|
23
|
+
- name: Run test
|
24
|
+
run: |
|
25
|
+
rake compile -- --with-tcltkversion=8.6 \
|
26
|
+
--with-tcl-lib=/usr/lib/x86_64-linux-gnu \
|
27
|
+
--with-tk-lib=/usr/lib/x86_64-linux-gnu \
|
28
|
+
--with-tcl-include=/usr/include/tcl8.6 \
|
29
|
+
--with-tk-include=/usr/include/tcl8.6
|
data/README.macosx-aqua
CHANGED
data/ext/tk/extconf.rb
CHANGED
@@ -510,9 +510,9 @@ def get_tclConfig_dirs
|
|
510
510
|
'/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local',
|
511
511
|
'/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr'
|
512
512
|
].map{|dir|
|
513
|
-
Dir.glob(dir + "/{tcltk,tcl,tk}[#{TkLib_Config['major_nums']}*/lib",
|
513
|
+
Dir.glob(dir + "/{tcltk,tcl,tk}[#{TkLib_Config['major_nums']}]*/lib",
|
514
514
|
File::FNM_CASEFOLD)
|
515
|
-
Dir.glob(dir + "/{tcltk,tcl,tk}[#{TkLib_Config['major_nums']}*",
|
515
|
+
Dir.glob(dir + "/{tcltk,tcl,tk}[#{TkLib_Config['major_nums']}]*",
|
516
516
|
File::FNM_CASEFOLD)
|
517
517
|
Dir.glob(dir + '/{tcltk,tcl,tk}/lib', File::FNM_CASEFOLD)
|
518
518
|
Dir.glob(dir + '/{tcltk,tcl,tk}', File::FNM_CASEFOLD)
|
data/ext/tk/tkutil/tkutil.c
CHANGED
@@ -327,7 +327,7 @@ tk_symbolkey2str(self, keys)
|
|
327
327
|
|
328
328
|
if (NIL_P(keys)) return new_keys;
|
329
329
|
keys = rb_convert_type(keys, T_HASH, "Hash", "to_hash");
|
330
|
-
|
330
|
+
rb_hash_foreach(keys, to_strkey, new_keys);
|
331
331
|
return new_keys;
|
332
332
|
}
|
333
333
|
|
@@ -718,7 +718,7 @@ hash2kv(hash, ary, self)
|
|
718
718
|
volatile VALUE dst = rb_ary_new2(2 * RHASH_SIZE(hash));
|
719
719
|
volatile VALUE args = rb_ary_new3(2, dst, self);
|
720
720
|
|
721
|
-
|
721
|
+
rb_hash_foreach(hash, push_kv, args);
|
722
722
|
|
723
723
|
if (NIL_P(ary)) {
|
724
724
|
return dst;
|
@@ -762,7 +762,7 @@ hash2kv_enc(hash, ary, self)
|
|
762
762
|
volatile VALUE dst = rb_ary_new2(2 * RHASH_SIZE(hash));
|
763
763
|
volatile VALUE args = rb_ary_new3(2, dst, self);
|
764
764
|
|
765
|
-
|
765
|
+
rb_hash_foreach(hash, push_kv_enc, args);
|
766
766
|
|
767
767
|
if (NIL_P(ary)) {
|
768
768
|
return dst;
|
@@ -1797,6 +1797,7 @@ Init_tkutil(void)
|
|
1797
1797
|
rb_define_singleton_method(cCB_SUBST, "inspect", cbsubst_inspect, 0);
|
1798
1798
|
|
1799
1799
|
cSUBST_INFO = rb_define_class_under(cCB_SUBST, "Info", rb_cObject);
|
1800
|
+
rb_undef_alloc_func(cSUBST_INFO);
|
1800
1801
|
rb_define_singleton_method(cSUBST_INFO, "inspect", substinfo_inspect, 0);
|
1801
1802
|
|
1802
1803
|
ID_SUBST_INFO = rb_intern("SUBST_INFO");
|
data/lib/multi-tk.rb
CHANGED
@@ -266,7 +266,7 @@ class MultiTkIp
|
|
266
266
|
|
267
267
|
begin
|
268
268
|
@interp._eval_without_enc(@interp._merge_tklist('bgerror', msg))
|
269
|
-
rescue Exception
|
269
|
+
rescue Exception
|
270
270
|
warn("Warning (#{self}): " + msg)
|
271
271
|
end
|
272
272
|
end
|
@@ -659,7 +659,7 @@ class MultiTkIp
|
|
659
659
|
loop do
|
660
660
|
Thread.pass
|
661
661
|
begin
|
662
|
-
thread,
|
662
|
+
thread, _, *_ = @cmd_queue.deq(true) # non-block
|
663
663
|
rescue ThreadError
|
664
664
|
# queue is empty
|
665
665
|
retry_count -= 1
|
@@ -928,7 +928,6 @@ class MultiTkIp
|
|
928
928
|
|
929
929
|
@init_ip_env_queue = Queue.new
|
930
930
|
Thread.new{
|
931
|
-
current = Thread.current
|
932
931
|
loop {
|
933
932
|
mtx, cond, ret, table, script = @init_ip_env_queue.deq
|
934
933
|
begin
|
@@ -1917,7 +1916,7 @@ if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) ||
|
|
1917
1916
|
top.respond_to?(:pseudo_toplevel_evaluable?) &&
|
1918
1917
|
top.pseudo_toplevel_evaluable? &&
|
1919
1918
|
top.respond_to?(id)
|
1920
|
-
rescue Exception
|
1919
|
+
rescue Exception
|
1921
1920
|
has_top = false
|
1922
1921
|
end
|
1923
1922
|
|
@@ -2316,7 +2315,7 @@ class << MultiTkIp
|
|
2316
2315
|
__getip.allow_ruby_exit?
|
2317
2316
|
end
|
2318
2317
|
|
2319
|
-
def allow_ruby_exit=
|
2318
|
+
def allow_ruby_exit=(mode)
|
2320
2319
|
__getip.allow_ruby_exit = mode
|
2321
2320
|
end
|
2322
2321
|
|
@@ -2642,7 +2641,7 @@ class MultiTkIp
|
|
2642
2641
|
@interp.allow_ruby_exit?
|
2643
2642
|
end
|
2644
2643
|
|
2645
|
-
def allow_ruby_exit=
|
2644
|
+
def allow_ruby_exit=(mode)
|
2646
2645
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2647
2646
|
@interp.allow_ruby_exit = mode
|
2648
2647
|
end
|
data/lib/remote-tk.rb
CHANGED
data/lib/thread_tk.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#
|
2
|
+
# thread_tk.rb :
|
3
|
+
# The eventloop of Tk (Tk.mainloop) can run on a thread other than the
|
4
|
+
# main thread. That is, when "require 'thread_tk'" is executed instead
|
5
|
+
# of or before "require 'tk'", "Thread.new{Tk.mainloop}" works properly.
|
6
|
+
#
|
7
|
+
|
8
|
+
if defined?(TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD) && TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD
|
9
|
+
raise LoadError, "thread_tk.rb must be loaded before tk.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = false; end
|
13
|
+
require 'tk'
|
data/lib/tk/autoload.rb
CHANGED
@@ -452,7 +452,7 @@ class << Tk
|
|
452
452
|
|
453
453
|
reg = /^#{Regexp.quote(auto)}(\.rb|\.so|)$/
|
454
454
|
@TOPLEVEL_ALIAS_TABLE.each_key{|set|
|
455
|
-
if @TOPLEVEL_ALIAS_TABLE[set][sym]
|
455
|
+
if reg =~ @TOPLEVEL_ALIAS_TABLE[set][sym].to_s
|
456
456
|
@TOPLEVEL_ALIAS_TABLE[set][sym] = obj
|
457
457
|
if @TOPLEVEL_ALIAS_OWNER[sym].nil? || @TOPLEVEL_ALIAS_OWNER[sym] == set
|
458
458
|
replace_topalias(sym, obj)
|
@@ -460,10 +460,10 @@ class << Tk
|
|
460
460
|
end
|
461
461
|
end
|
462
462
|
}
|
463
|
-
if (f = Object.autoload?(sym)) &&
|
463
|
+
if (f = Object.autoload?(sym)) && reg =~ f.to_s
|
464
464
|
replace_topobj(sym, obj)
|
465
465
|
end
|
466
|
-
if (f = Tk::TOPLEVEL_ALIASES.autoload?(sym)) &&
|
466
|
+
if (f = Tk::TOPLEVEL_ALIASES.autoload?(sym)) && reg =~ f.to_s
|
467
467
|
replace_topalias(sym, obj)
|
468
468
|
end
|
469
469
|
end
|
data/lib/tk/canvastag.rb
CHANGED
@@ -187,7 +187,7 @@ module TkcTagAccess
|
|
187
187
|
# ltag = tag1 | tag2; ltag.path => "(t1)||(t2)"
|
188
188
|
# ltag = tag1 ^ tag2; ltag.path => "(t1)^(t2)"
|
189
189
|
# ltag = - tag1; ltag.path => "!(t1)"
|
190
|
-
def &
|
190
|
+
def &(tag)
|
191
191
|
if tag.kind_of? TkObject
|
192
192
|
TkcTagString.new(@c, '(' + @id + ')&&(' + tag.path + ')')
|
193
193
|
else
|
@@ -195,7 +195,7 @@ module TkcTagAccess
|
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
-
def |
|
198
|
+
def |(tag)
|
199
199
|
if tag.kind_of? TkObject
|
200
200
|
TkcTagString.new(@c, '(' + @id + ')||(' + tag.path + ')')
|
201
201
|
else
|
@@ -203,7 +203,7 @@ module TkcTagAccess
|
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
206
|
-
def ^
|
206
|
+
def ^(tag)
|
207
207
|
if tag.kind_of? TkObject
|
208
208
|
TkcTagString.new(@c, '(' + @id + ')^(' + tag.path + ')')
|
209
209
|
else
|
data/lib/tk/entry.rb
CHANGED
data/lib/tk/grid.rb
CHANGED
@@ -66,15 +66,15 @@ module TkGrid
|
|
66
66
|
params = []
|
67
67
|
args.flatten(1).each{|win|
|
68
68
|
case win
|
69
|
-
when '-',
|
69
|
+
when '-', ?-.ord # RELATIVE PLACEMENT (increase columnspan)
|
70
70
|
params.push('-')
|
71
71
|
when /^-+$/ # RELATIVE PLACEMENT (increase columnspan)
|
72
72
|
params.concat(win.to_s.split(//))
|
73
|
-
when '^',
|
73
|
+
when '^', ?^.ord # RELATIVE PLACEMENT (increase rowspan)
|
74
74
|
params.push('^')
|
75
75
|
when /^\^+$/ # RELATIVE PLACEMENT (increase rowspan)
|
76
76
|
params.concat(win.to_s.split(//))
|
77
|
-
when 'x', :x, ?x, nil, '' # RELATIVE PLACEMENT (empty column)
|
77
|
+
when 'x', :x, ?x.ord, nil, '' # RELATIVE PLACEMENT (empty column)
|
78
78
|
params.push('x')
|
79
79
|
when /^x+$/ # RELATIVE PLACEMENT (empty column)
|
80
80
|
params.concat(win.to_s.split(//))
|
data/lib/tk/itemconfig.rb
CHANGED
@@ -177,7 +177,7 @@ module TkItemConfigMethod
|
|
177
177
|
fail ArgumentError, "Invalid option `#{orig_opt.inspect}'"
|
178
178
|
end
|
179
179
|
|
180
|
-
|
180
|
+
_, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == option}
|
181
181
|
if real_name
|
182
182
|
option = real_name.to_s
|
183
183
|
end
|
@@ -324,7 +324,7 @@ module TkItemConfigMethod
|
|
324
324
|
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
|
325
325
|
end
|
326
326
|
|
327
|
-
|
327
|
+
_, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
|
328
328
|
if real_name
|
329
329
|
slot = real_name.to_s
|
330
330
|
end
|
@@ -429,7 +429,7 @@ module TkItemConfigMethod
|
|
429
429
|
if slot
|
430
430
|
slot = slot.to_s
|
431
431
|
|
432
|
-
|
432
|
+
_, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
|
433
433
|
if real_name
|
434
434
|
slot = real_name.to_s
|
435
435
|
end
|
@@ -806,7 +806,7 @@ module TkItemConfigMethod
|
|
806
806
|
if slot
|
807
807
|
slot = slot.to_s
|
808
808
|
|
809
|
-
|
809
|
+
_, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
|
810
810
|
if real_name
|
811
811
|
slot = real_name.to_s
|
812
812
|
end
|
data/lib/tk/itemfont.rb
CHANGED
@@ -101,7 +101,7 @@ module TkTreatItemFont
|
|
101
101
|
else
|
102
102
|
begin
|
103
103
|
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
|
104
|
-
rescue
|
104
|
+
rescue
|
105
105
|
# ignore
|
106
106
|
end
|
107
107
|
end
|
@@ -163,7 +163,7 @@ module TkTreatItemFont
|
|
163
163
|
else
|
164
164
|
begin
|
165
165
|
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
|
166
|
-
rescue
|
166
|
+
rescue
|
167
167
|
# ignore
|
168
168
|
end
|
169
169
|
end
|
@@ -223,7 +223,7 @@ module TkTreatItemFont
|
|
223
223
|
else
|
224
224
|
begin
|
225
225
|
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
|
226
|
-
rescue
|
226
|
+
rescue
|
227
227
|
# ignore
|
228
228
|
end
|
229
229
|
end
|
data/lib/tk/listbox.rb
CHANGED
data/lib/tk/menuspec.rb
CHANGED
data/lib/tk/namespace.rb
CHANGED
@@ -257,7 +257,7 @@ class TkNamespace < TkObject
|
|
257
257
|
if name =~ /^::/
|
258
258
|
@fullname = parent + name
|
259
259
|
else
|
260
|
-
@fullname = parent +'::'+ name
|
260
|
+
@fullname = parent + '::' + name
|
261
261
|
end
|
262
262
|
else
|
263
263
|
ancestor = __tk_call('namespace', 'current')
|
@@ -265,7 +265,7 @@ class TkNamespace < TkObject
|
|
265
265
|
if name =~ /^::/
|
266
266
|
@fullname = ancestor + '::' + parent + name
|
267
267
|
else
|
268
|
-
@fullname = ancestor + '::'+ parent +'::'+ name
|
268
|
+
@fullname = ancestor + '::' + parent + '::' + name
|
269
269
|
end
|
270
270
|
end
|
271
271
|
else # parent == nil
|
data/lib/tk/optiondb.rb
CHANGED
data/lib/tk/optionobj.rb
CHANGED
data/lib/tk/scale.rb
CHANGED
data/lib/tk/text.rb
CHANGED
@@ -326,7 +326,7 @@ class Tk::Text<TkTextWin
|
|
326
326
|
_fromUTF8(tk_send_without_enc('get', "1.0", "end - 1 char"))
|
327
327
|
end
|
328
328
|
|
329
|
-
def value=
|
329
|
+
def value=(val)
|
330
330
|
tk_send_without_enc('delete', "1.0", 'end')
|
331
331
|
tk_send_without_enc('insert', "1.0", _get_eval_enc_str(val))
|
332
332
|
val
|
data/lib/tk/validation.rb
CHANGED
@@ -303,7 +303,7 @@ class TkValidateCommand
|
|
303
303
|
args = args.join(' ')
|
304
304
|
keys = klass._get_subst_key(args)
|
305
305
|
if cmd.kind_of?(String)
|
306
|
-
id = cmd
|
306
|
+
@id = cmd
|
307
307
|
elsif cmd.kind_of?(TkCallbackEntry)
|
308
308
|
@id = install_cmd(cmd)
|
309
309
|
else
|
@@ -318,7 +318,7 @@ class TkValidateCommand
|
|
318
318
|
else
|
319
319
|
keys, args = klass._get_all_subst_keys
|
320
320
|
if cmd.kind_of?(String)
|
321
|
-
id = cmd
|
321
|
+
@id = cmd
|
322
322
|
elsif cmd.kind_of?(TkCallbackEntry)
|
323
323
|
@id = install_cmd(cmd)
|
324
324
|
else
|
data/lib/tk/variable.rb
CHANGED
@@ -27,7 +27,7 @@ class TkVariable
|
|
27
27
|
TkVar_ID_TBL.mutex.synchronize{ TkVar_ID_TBL.clear }
|
28
28
|
}
|
29
29
|
|
30
|
-
major, minor,
|
30
|
+
major, minor, _, _ = TclTkLib.get_version
|
31
31
|
USE_OLD_TRACE_OPTION_STYLE = (major < 8) || (major == 8 && minor < 4)
|
32
32
|
|
33
33
|
#TkCore::INTERP.add_tk_procs('rb_var', 'args',
|
@@ -1772,11 +1772,11 @@ module Tk
|
|
1772
1772
|
begin
|
1773
1773
|
INTERP._invoke_without_enc('global', 'auto_path')
|
1774
1774
|
auto_path = INTERP._invoke('set', 'auto_path')
|
1775
|
-
rescue
|
1775
|
+
rescue
|
1776
1776
|
begin
|
1777
1777
|
INTERP._invoke_without_enc('global', 'env')
|
1778
1778
|
auto_path = INTERP._invoke('set', 'env(TCLLIBPATH)')
|
1779
|
-
rescue
|
1779
|
+
rescue
|
1780
1780
|
auto_path = Tk::LIBRARY
|
1781
1781
|
end
|
1782
1782
|
end
|
data/lib/tk/winfo.rb
CHANGED
data/lib/tk.rb
CHANGED
@@ -818,7 +818,7 @@ end
|
|
818
818
|
|
819
819
|
def _curr_cmd_id
|
820
820
|
#id = format("c%.4d", Tk_IDs[0])
|
821
|
-
|
821
|
+
"c" + TkCore::INTERP._ip_id_ + TkComm::Tk_IDs[0]
|
822
822
|
end
|
823
823
|
def _next_cmd_id
|
824
824
|
TkComm::Tk_IDs.mutex.synchronize{
|
@@ -1158,63 +1158,15 @@ module TkCore
|
|
1158
1158
|
opts = ''
|
1159
1159
|
end
|
1160
1160
|
|
1161
|
-
|
1161
|
+
if defined? ::TK_MAINLOOP_ON_MAIN_THREAD_ONLY
|
1162
|
+
RUN_EVENTLOOP_ON_MAIN_THREAD = ::TK_MAINLOOP_ON_MAIN_THREAD_ONLY
|
1163
|
+
end
|
1162
1164
|
|
1163
1165
|
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
|
1164
|
-
if
|
1165
|
-
# *** NEED TO FIX ***
|
1166
|
-
case RUBY_PLATFORM
|
1167
|
-
when /cygwin/
|
1168
|
-
RUN_EVENTLOOP_ON_MAIN_THREAD = true
|
1169
|
-
when /darwin/ # MacOS X
|
1170
|
-
=begin
|
1171
|
-
ip = TclTkIp.new(name, opts)
|
1172
|
-
if ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' &&
|
1173
|
-
(TclTkLib.get_version<=>[8,4,TclTkLib::RELEASE_TYPE::FINAL,6]) > 0
|
1174
|
-
=end
|
1175
|
-
if TclTkLib::WINDOWING_SYSTEM == 'aqua' &&
|
1176
|
-
(TclTkLib.get_version<=>[8,4,TclTkLib::RELEASE_TYPE::FINAL,6]) > 0
|
1177
|
-
# *** KNOWN BUG ***
|
1178
|
-
# Main event loop thread of TkAqua (> Tk8.4.9) must be the main
|
1179
|
-
# application thread. So, ruby1.9 users must call Tk.mainloop on
|
1180
|
-
# the main application thread.
|
1181
|
-
#
|
1182
|
-
# *** ADD (2009/05/10) ***
|
1183
|
-
# In some cases (I don't know the description of conditions),
|
1184
|
-
# TkAqua 8.4.7 has a same kind of hang-up trouble.
|
1185
|
-
# So, if 8.4.7 or later, set RUN_EVENTLOOP_ON_MAIN_THREAD to true.
|
1186
|
-
# When you want to control this mode, please call the following
|
1187
|
-
# (set true/false as you want) before "require 'tk'".
|
1188
|
-
# ----------------------------------------------------------
|
1189
|
-
# module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = true; end
|
1190
|
-
# ----------------------------------------------------------
|
1191
|
-
#
|
1192
|
-
# *** ADD (2010/07/05) ***
|
1193
|
-
# The value of TclTkLib::WINDOWING_SYSTEM is defined at compiling.
|
1194
|
-
# If it is inconsistent with linked DLL, please call the following
|
1195
|
-
# before "require 'tk'".
|
1196
|
-
# ----------------------------------------------------------
|
1197
|
-
# require 'tcltklib'
|
1198
|
-
# module TclTkLib
|
1199
|
-
# remove_const :WINDOWING_SYSTEM
|
1200
|
-
# WINDOWING_SYSTEM = 'x11' # or 'aqua'
|
1201
|
-
# end
|
1202
|
-
# ----------------------------------------------------------
|
1203
|
-
#
|
1204
|
-
RUN_EVENTLOOP_ON_MAIN_THREAD = true
|
1205
|
-
else
|
1206
|
-
RUN_EVENTLOOP_ON_MAIN_THREAD = false
|
1207
|
-
=begin
|
1208
|
-
ip.delete
|
1209
|
-
ip = nil
|
1210
|
-
=end
|
1211
|
-
end
|
1212
|
-
else
|
1213
|
-
RUN_EVENTLOOP_ON_MAIN_THREAD = false
|
1214
|
-
end
|
1215
|
-
|
1216
|
-
else # Ruby 1.8.x
|
1166
|
+
if defined? ::IRB
|
1217
1167
|
RUN_EVENTLOOP_ON_MAIN_THREAD = false
|
1168
|
+
else
|
1169
|
+
RUN_EVENTLOOP_ON_MAIN_THREAD = WITH_RUBY_VM
|
1218
1170
|
end
|
1219
1171
|
end
|
1220
1172
|
|
@@ -1935,9 +1887,6 @@ EOS
|
|
1935
1887
|
def getSaveFile(keys = nil)
|
1936
1888
|
tk_call('tk_getSaveFile', *hash_kv(keys))
|
1937
1889
|
end
|
1938
|
-
def getMultipleSaveFile(keys = nil)
|
1939
|
-
simplelist(tk_call('tk_getSaveFile', '-multiple', '1', *hash_kv(keys)))
|
1940
|
-
end
|
1941
1890
|
|
1942
1891
|
def chooseColor(keys = nil)
|
1943
1892
|
tk_call('tk_chooseColor', *hash_kv(keys))
|
@@ -3487,7 +3436,7 @@ module TkTreatFont
|
|
3487
3436
|
else
|
3488
3437
|
begin
|
3489
3438
|
tk_call(*(__config_cmd << "-#{optkey}" << ltn))
|
3490
|
-
rescue
|
3439
|
+
rescue
|
3491
3440
|
# ignore
|
3492
3441
|
end
|
3493
3442
|
end
|
@@ -3547,7 +3496,7 @@ module TkTreatFont
|
|
3547
3496
|
else
|
3548
3497
|
begin
|
3549
3498
|
tk_call(*(__config_cmd << "-#{optkey}" << knj))
|
3550
|
-
rescue
|
3499
|
+
rescue
|
3551
3500
|
# ignore
|
3552
3501
|
end
|
3553
3502
|
end
|
@@ -3804,7 +3753,7 @@ module TkConfigMethod
|
|
3804
3753
|
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
|
3805
3754
|
end
|
3806
3755
|
|
3807
|
-
|
3756
|
+
_, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
|
3808
3757
|
if real_name
|
3809
3758
|
slot = real_name.to_s
|
3810
3759
|
end
|
@@ -3948,7 +3897,7 @@ module TkConfigMethod
|
|
3948
3897
|
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
|
3949
3898
|
end
|
3950
3899
|
|
3951
|
-
|
3900
|
+
_, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
|
3952
3901
|
if real_name
|
3953
3902
|
slot = real_name.to_s
|
3954
3903
|
end
|
@@ -4051,7 +4000,7 @@ module TkConfigMethod
|
|
4051
4000
|
if slot
|
4052
4001
|
slot = slot.to_s
|
4053
4002
|
|
4054
|
-
|
4003
|
+
_, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
|
4055
4004
|
if real_name
|
4056
4005
|
slot = real_name.to_s
|
4057
4006
|
end
|
@@ -4431,7 +4380,7 @@ module TkConfigMethod
|
|
4431
4380
|
if slot
|
4432
4381
|
slot = slot.to_s
|
4433
4382
|
|
4434
|
-
|
4383
|
+
_, real_name = __optkey_aliases.find{|k,var| k.to_s == slot}
|
4435
4384
|
if real_name
|
4436
4385
|
slot = real_name.to_s
|
4437
4386
|
end
|
@@ -84,13 +84,13 @@ module Tk::BLT
|
|
84
84
|
private :__item_pathname
|
85
85
|
|
86
86
|
def axis_cget_tkstring(id, option)
|
87
|
-
|
87
|
+
itemcget_tkstring(['axis', tagid(id)], option)
|
88
88
|
end
|
89
89
|
def axis_cget(id, option)
|
90
|
-
|
90
|
+
itemcget(['axis', tagid(id)], option)
|
91
91
|
end
|
92
92
|
def axis_cget_strict(id, option)
|
93
|
-
|
93
|
+
itemcget_strict(['axis', tagid(id)], option)
|
94
94
|
end
|
95
95
|
def axis_configure(*args)
|
96
96
|
slot = args.pop
|
@@ -37,7 +37,7 @@ class Tk::BWidget::ProgressDlg
|
|
37
37
|
@keys['textvariable'].value
|
38
38
|
end
|
39
39
|
|
40
|
-
def text=
|
40
|
+
def text=(txt)
|
41
41
|
@keys['textvariable'].value = txt
|
42
42
|
end
|
43
43
|
|
@@ -49,7 +49,7 @@ class Tk::BWidget::ProgressDlg
|
|
49
49
|
@keys['variable'].value
|
50
50
|
end
|
51
51
|
|
52
|
-
def value=
|
52
|
+
def value=(val)
|
53
53
|
@keys['variable'].value = val
|
54
54
|
end
|
55
55
|
|
@@ -32,7 +32,7 @@ module Tk::Tile::TreeviewConfig
|
|
32
32
|
if slot
|
33
33
|
slot = slot.to_s
|
34
34
|
|
35
|
-
|
35
|
+
_, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
|
36
36
|
if real_name
|
37
37
|
slot = real_name.to_s
|
38
38
|
end
|
@@ -203,7 +203,7 @@ module Tk::Tile::TreeviewConfig
|
|
203
203
|
if slot
|
204
204
|
slot = slot.to_s
|
205
205
|
|
206
|
-
|
206
|
+
_, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
|
207
207
|
if real_name
|
208
208
|
slot = real_name.to_s
|
209
209
|
end
|
data/lib/tkextlib/tile.rb
CHANGED
@@ -144,7 +144,6 @@ module Tk
|
|
144
144
|
# Tcl/Tk interpreter working under Ruby/Tk.
|
145
145
|
# Please give attention to use this method. It may conflict with
|
146
146
|
# some definitions on Tcl/Tk scripts.
|
147
|
-
klass_name = self.name
|
148
147
|
proc_name = 'LoadImages'
|
149
148
|
if Tk::Tile::USE_TTK_NAMESPACE
|
150
149
|
ns_list = ['::tile']
|
@@ -155,7 +155,7 @@ class Tk::TkTable::CellTag
|
|
155
155
|
|
156
156
|
def initialize(parent, keys=nil)
|
157
157
|
@parent = @t = parent
|
158
|
-
@tpath
|
158
|
+
@tpath = parent.path
|
159
159
|
CellTag_ID.mutex.synchronize{
|
160
160
|
@path = @id = CellTag_ID.join(TkCore::INTERP._ip_id_)
|
161
161
|
CellTag_ID[1].succ!
|
@@ -1294,7 +1294,7 @@ class Tk::TreeCtrl
|
|
1294
1294
|
|
1295
1295
|
def item_state_get(item, *args)
|
1296
1296
|
if args.empty?
|
1297
|
-
list(tk_send('item', 'state', 'get', item *args))
|
1297
|
+
list(tk_send('item', 'state', 'get', item * args))
|
1298
1298
|
else
|
1299
1299
|
bool(tk_send('item', 'state', 'get', item))
|
1300
1300
|
end
|
data/sample/demos-jp/widget
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
# 漢字コード設定 ( tk.rb のロード時の encoding 推定/設定に使われる )
|
5
5
|
#if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!!!!!
|
6
6
|
unless defined?(::Encoding.default_external)
|
7
|
-
$KCODE = '
|
7
|
+
$KCODE = 'utf-8'
|
8
8
|
else
|
9
|
-
DEFAULT_TK_ENCODING = '
|
9
|
+
DEFAULT_TK_ENCODING = 'utf-8'
|
10
10
|
end
|
11
11
|
|
12
12
|
# tk 関係ライブラリの読み込み
|
@@ -888,7 +888,7 @@ def showCode1(demo)
|
|
888
888
|
$code_window.iconname(file)
|
889
889
|
code = open([$demo_dir, file].join(File::Separator), 'r'){|fid| fid.read }
|
890
890
|
$code_text.delete('1.0', 'end')
|
891
|
-
code.force_encoding('
|
891
|
+
code.force_encoding('utf-8') if defined?(::Encoding.default_external)
|
892
892
|
$code_text.insert('1.0', code)
|
893
893
|
TkTextMarkInsert.new($code_text,'1.0')
|
894
894
|
$set_linenum.call($code_text)
|
@@ -974,7 +974,7 @@ def showCode2(demo)
|
|
974
974
|
$code_window.iconname(file)
|
975
975
|
code = open([$demo_dir, file].join(File::Separator), 'r'){|fid| fid.read }
|
976
976
|
$code_text.delete('1.0', 'end')
|
977
|
-
code.force_encoding('
|
977
|
+
code.force_encoding('utf-8') if defined?(::Encoding.default_external)
|
978
978
|
$code_text.insert('1.0', code)
|
979
979
|
TkTextMarkInsert.new($code_text,'1.0')
|
980
980
|
$set_linenum.call($code_text)
|
data/sample/irbtk.rb
CHANGED
data/sample/irbtkw.rbw
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
#
|
7
7
|
release = '2008/03/08'
|
8
8
|
|
9
|
+
require 'thread_tk'
|
9
10
|
require 'tk'
|
10
11
|
begin
|
11
12
|
require 'tktextio'
|
@@ -13,8 +14,6 @@ rescue LoadError
|
|
13
14
|
require File.join(File.dirname(File.expand_path(__FILE__)), 'tktextio.rb')
|
14
15
|
end
|
15
16
|
|
16
|
-
require 'irb'
|
17
|
-
|
18
17
|
if TkCore::WITH_ENCODING
|
19
18
|
else
|
20
19
|
# $KCODE setup
|
@@ -110,8 +109,15 @@ def STDIN.tty?
|
|
110
109
|
end
|
111
110
|
|
112
111
|
# IRB setup
|
112
|
+
require 'irb'
|
113
|
+
|
113
114
|
IRB.init_config(nil)
|
114
115
|
IRB.conf[:USE_READLINE] = false
|
116
|
+
IRB.conf[:USE_MULTILINE] = false
|
117
|
+
IRB.conf[:USE_SINGLELINE] = false
|
118
|
+
IRB.conf[:USE_COLORIZE] = false
|
119
|
+
IRB.conf[:PROMPT_MODE] = :DEFAULT
|
120
|
+
IRB.conf[:VERBOSE] = false
|
115
121
|
IRB.init_error
|
116
122
|
irb = IRB::Irb.new
|
117
123
|
IRB.conf[:MAIN_CONTEXT] = irb.context
|
@@ -152,5 +158,8 @@ console.bind('Control-c'){
|
|
152
158
|
irb_thread.join
|
153
159
|
|
154
160
|
# exit
|
155
|
-
|
156
|
-
|
161
|
+
begin
|
162
|
+
ev_loop.kill
|
163
|
+
Tk.exit
|
164
|
+
rescue
|
165
|
+
end
|
data/sample/tktextio.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
1
|
+
#!/usr/bin/env ruby -r thread_tk
|
2
2
|
# frozen_string_literal: false
|
3
3
|
#
|
4
4
|
# TkTextIO class :: handling I/O stream on a TkText widget
|
@@ -395,6 +395,10 @@ class TkTextIO < TkText
|
|
395
395
|
|
396
396
|
####################################
|
397
397
|
|
398
|
+
def set_encoding(extern, intern = nil)
|
399
|
+
# not suppot -> do nothing
|
400
|
+
end
|
401
|
+
|
398
402
|
def <<(obj)
|
399
403
|
_write(obj)
|
400
404
|
self
|
data/tk.gemspec
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SHIBATA Hiroshi
|
8
8
|
- Nobuyoshi Nakada
|
9
9
|
- Jeremy Evans
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-11-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -65,8 +65,9 @@ extensions:
|
|
65
65
|
- ext/tk/tkutil/extconf.rb
|
66
66
|
extra_rdoc_files: []
|
67
67
|
files:
|
68
|
+
- ".github/dependabot.yml"
|
69
|
+
- ".github/workflows/test.yml"
|
68
70
|
- ".gitignore"
|
69
|
-
- ".travis.yml"
|
70
71
|
- BSDL
|
71
72
|
- Gemfile
|
72
73
|
- LICENSE.txt
|
@@ -93,6 +94,7 @@ files:
|
|
93
94
|
- lib/multi-tk.rb
|
94
95
|
- lib/remote-tk.rb
|
95
96
|
- lib/tcltk.rb
|
97
|
+
- lib/thread_tk.rb
|
96
98
|
- lib/tk.rb
|
97
99
|
- lib/tk/after.rb
|
98
100
|
- lib/tk/autoload.rb
|
@@ -1120,7 +1122,7 @@ licenses:
|
|
1120
1122
|
- BSD-2-Clause
|
1121
1123
|
metadata:
|
1122
1124
|
msys2_mingw_dependencies: tk
|
1123
|
-
post_install_message:
|
1125
|
+
post_install_message:
|
1124
1126
|
rdoc_options: []
|
1125
1127
|
require_paths:
|
1126
1128
|
- lib
|
@@ -1135,8 +1137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1135
1137
|
- !ruby/object:Gem::Version
|
1136
1138
|
version: '0'
|
1137
1139
|
requirements: []
|
1138
|
-
rubygems_version: 3.
|
1139
|
-
signing_key:
|
1140
|
+
rubygems_version: 3.4.10
|
1141
|
+
signing_key:
|
1140
1142
|
specification_version: 4
|
1141
1143
|
summary: Tk interface module using tcltklib.
|
1142
1144
|
test_files: []
|