tk 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/thread_tk.rb +13 -0
- data/lib/tk.rb +6 -57
- 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/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.rb
CHANGED
@@ -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 = true
|
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))
|
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: []
|