tkxxs 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CONTRIBUTORS +2 -1
- data/History.txt +10 -0
- data/Manifest.txt +1 -1
- data/{README.txt → README.rdoc} +36 -4
- data/ext/tkballoonhelp.rb +332 -332
- data/ext/tkballoonhelp_ORIGINAL.rb +208 -208
- data/lib/tkxxs.rb +710 -708
- data/lib/tkxxs/conf.rb +259 -259
- data/lib/tkxxs/tkxxs_classes.rb +1567 -1571
- data/lib/tkxxs/version.rb +1 -1
- data/rdoc_developers_hanna.bat +14 -14
- data/rdoc_users_hanna.bat +16 -16
- data/samples/big_example.rb +521 -521
- metadata +12 -13
- data/.gemtest +0 -0
@@ -1,208 +1,208 @@
|
|
1
|
-
#
|
2
|
-
# tkballoonhelp.rb : simple balloon help widget
|
3
|
-
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
4
|
-
#
|
5
|
-
# Add a balloon help to a widget.
|
6
|
-
# This widget has only poor featureas. If you need more useful features,
|
7
|
-
# please try to use the Tix extension of Tcl/Tk under Ruby/Tk.
|
8
|
-
#
|
9
|
-
# The interval time to display a balloon help is defined 'interval' option
|
10
|
-
# (default is 750ms).
|
11
|
-
#
|
12
|
-
require 'tk'
|
13
|
-
|
14
|
-
module Tk
|
15
|
-
module RbWidget
|
16
|
-
class BalloonHelp<TkLabel
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
class Tk::RbWidget::BalloonHelp<TkLabel
|
21
|
-
DEFAULT_FOREGROUND = 'black'
|
22
|
-
DEFAULT_BACKGROUND = 'white'
|
23
|
-
DEFAULT_INTERVAL = 750
|
24
|
-
|
25
|
-
def _balloon_binding(interval)
|
26
|
-
@timer = TkAfter.new(interval, 1, proc{show})
|
27
|
-
def @timer.interval(val)
|
28
|
-
@sleep_time = val
|
29
|
-
end
|
30
|
-
@bindtag = TkBindTag.new
|
31
|
-
@bindtag.bind('Enter', proc{@timer.start})
|
32
|
-
@bindtag.bind('Motion', proc{@timer.restart; erase})
|
33
|
-
@bindtag.bind('Any-ButtonPress', proc{@timer.restart; erase})
|
34
|
-
@bindtag.bind('Leave', proc{@timer.stop; erase})
|
35
|
-
tags = @parent.bindtags
|
36
|
-
idx = tags.index(@parent)
|
37
|
-
unless idx
|
38
|
-
ppath = TkComm.window(@parent.path)
|
39
|
-
idx = tags.index(ppath) || 0
|
40
|
-
end
|
41
|
-
tags[idx,0] = @bindtag
|
42
|
-
@parent.bindtags(tags)
|
43
|
-
end
|
44
|
-
private :_balloon_binding
|
45
|
-
|
46
|
-
def initialize(parent=nil, keys={})
|
47
|
-
@parent = parent || Tk.root
|
48
|
-
|
49
|
-
@frame = TkToplevel.new(@parent)
|
50
|
-
@frame.withdraw
|
51
|
-
@frame.overrideredirect(true)
|
52
|
-
@frame.transient(TkWinfo.toplevel(@parent))
|
53
|
-
@epath = @frame.path
|
54
|
-
|
55
|
-
if keys
|
56
|
-
keys = _symbolkey2str(keys)
|
57
|
-
else
|
58
|
-
keys = {}
|
59
|
-
end
|
60
|
-
|
61
|
-
@command = keys.delete('command')
|
62
|
-
|
63
|
-
@interval = keys.delete('interval'){DEFAULT_INTERVAL}
|
64
|
-
_balloon_binding(@interval)
|
65
|
-
|
66
|
-
# @label = TkLabel.new(@frame, 'background'=>'bisque').pack
|
67
|
-
@label = TkLabel.new(@frame,
|
68
|
-
'foreground'=>DEFAULT_FOREGROUND,
|
69
|
-
'background'=>DEFAULT_BACKGROUND).pack
|
70
|
-
@label.configure(_symbolkey2str(keys)) unless keys.empty?
|
71
|
-
@path = @label
|
72
|
-
end
|
73
|
-
|
74
|
-
def epath
|
75
|
-
@epath
|
76
|
-
end
|
77
|
-
|
78
|
-
def interval(val)
|
79
|
-
if val
|
80
|
-
@timer.interval(val)
|
81
|
-
else
|
82
|
-
@interval
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def command(cmd = Proc.new)
|
87
|
-
@command = cmd
|
88
|
-
self
|
89
|
-
end
|
90
|
-
|
91
|
-
def show
|
92
|
-
x = TkWinfo.pointerx(@parent)
|
93
|
-
y = TkWinfo.pointery(@parent)
|
94
|
-
@frame.geometry("+#{x+1}+#{y+1}")
|
95
|
-
|
96
|
-
if @command
|
97
|
-
case @command.arity
|
98
|
-
when 0
|
99
|
-
@command.call
|
100
|
-
when 2
|
101
|
-
@command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent))
|
102
|
-
when 3
|
103
|
-
@command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent),
|
104
|
-
self)
|
105
|
-
else
|
106
|
-
@command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent),
|
107
|
-
self, @parent)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
@frame.deiconify
|
112
|
-
@frame.raise
|
113
|
-
|
114
|
-
@org_cursor = @parent['cursor']
|
115
|
-
@parent.cursor('crosshair')
|
116
|
-
end
|
117
|
-
|
118
|
-
def erase
|
119
|
-
@parent.cursor(@org_cursor)
|
120
|
-
@frame.withdraw
|
121
|
-
end
|
122
|
-
|
123
|
-
def destroy
|
124
|
-
@frame.destroy
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
################################################
|
129
|
-
# test
|
130
|
-
################################################
|
131
|
-
if __FILE__ == $0
|
132
|
-
TkButton.new('text'=>'This button has a balloon help') {|b|
|
133
|
-
pack('fill'=>'x')
|
134
|
-
Tk::RbWidget::BalloonHelp.new(b, 'text'=>' Message ')
|
135
|
-
}
|
136
|
-
TkButton.new('text'=>'This button has another balloon help') {|b|
|
137
|
-
pack('fill'=>'x')
|
138
|
-
Tk::RbWidget::BalloonHelp.new(b,
|
139
|
-
'text'=>"CONFIGURED MESSAGE\nchange colors, and so on",
|
140
|
-
'interval'=>200, 'font'=>'courier',
|
141
|
-
'background'=>'gray', 'foreground'=>'red')
|
142
|
-
}
|
143
|
-
|
144
|
-
sb = TkScrollbox.new.pack(:fill=>:x)
|
145
|
-
sb.insert(:end, *%w(aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm))
|
146
|
-
=begin
|
147
|
-
# CASE1 : command takes no arguemnt
|
148
|
-
bh = Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
149
|
-
:relief=>:ridge, :background=>'white',
|
150
|
-
:command=>proc{
|
151
|
-
y = TkWinfo.pointery(sb) - TkWinfo.rooty(sb)
|
152
|
-
bh.text "current index == #{sb.nearest(y)}"
|
153
|
-
})
|
154
|
-
=end
|
155
|
-
=begin
|
156
|
-
# CASE2 : command takes 2 arguemnts
|
157
|
-
bh = Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
158
|
-
:relief=>:ridge, :background=>'white',
|
159
|
-
:command=>proc{|x, y|
|
160
|
-
bh.text "current index == #{sb.nearest(y)}"
|
161
|
-
})
|
162
|
-
=end
|
163
|
-
=begin
|
164
|
-
# CASE3 : command takes 3 arguemnts
|
165
|
-
Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
166
|
-
:relief=>:ridge, :background=>'white',
|
167
|
-
:command=>proc{|x, y, bhelp|
|
168
|
-
bhelp.text "current index == #{sb.nearest(y)}"
|
169
|
-
})
|
170
|
-
=end
|
171
|
-
=begin
|
172
|
-
# CASE4a : command is a Proc object and takes 4 arguemnts
|
173
|
-
cmd = proc{|x, y, bhelp, parent|
|
174
|
-
bhelp.text "current index == #{parent.nearest(y)}"
|
175
|
-
}
|
176
|
-
|
177
|
-
Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
178
|
-
:relief=>:ridge, :background=>'white',
|
179
|
-
:command=>cmd)
|
180
|
-
|
181
|
-
sb2 = TkScrollbox.new.pack(:fill=>:x)
|
182
|
-
sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM))
|
183
|
-
Tk::RbWidget::BalloonHelp.new(sb2, :interval=>500,
|
184
|
-
:padx=>5, :relief=>:raised,
|
185
|
-
:background=>'gray25', :foreground=>'white',
|
186
|
-
:command=>cmd)
|
187
|
-
=end
|
188
|
-
#=begin
|
189
|
-
# CASE4b : command is a Method object and takes 4 arguemnts
|
190
|
-
def set_msg(x, y, bhelp, parent)
|
191
|
-
bhelp.text "current index == #{parent.nearest(y)}"
|
192
|
-
end
|
193
|
-
cmd = self.method(:set_msg)
|
194
|
-
|
195
|
-
Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
196
|
-
:relief=>:ridge, :background=>'white',
|
197
|
-
:command=>cmd)
|
198
|
-
|
199
|
-
sb2 = TkScrollbox.new.pack(:fill=>:x)
|
200
|
-
sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM))
|
201
|
-
Tk::RbWidget::BalloonHelp.new(sb2, :interval=>500,
|
202
|
-
:padx=>5, :relief=>:raised,
|
203
|
-
:background=>'gray25', :foreground=>'white',
|
204
|
-
:command=>cmd)
|
205
|
-
#=end
|
206
|
-
|
207
|
-
Tk.mainloop
|
208
|
-
end
|
1
|
+
#
|
2
|
+
# tkballoonhelp.rb : simple balloon help widget
|
3
|
+
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
4
|
+
#
|
5
|
+
# Add a balloon help to a widget.
|
6
|
+
# This widget has only poor featureas. If you need more useful features,
|
7
|
+
# please try to use the Tix extension of Tcl/Tk under Ruby/Tk.
|
8
|
+
#
|
9
|
+
# The interval time to display a balloon help is defined 'interval' option
|
10
|
+
# (default is 750ms).
|
11
|
+
#
|
12
|
+
require 'tk'
|
13
|
+
|
14
|
+
module Tk
|
15
|
+
module RbWidget
|
16
|
+
class BalloonHelp<TkLabel
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
class Tk::RbWidget::BalloonHelp<TkLabel
|
21
|
+
DEFAULT_FOREGROUND = 'black'
|
22
|
+
DEFAULT_BACKGROUND = 'white'
|
23
|
+
DEFAULT_INTERVAL = 750
|
24
|
+
|
25
|
+
def _balloon_binding(interval)
|
26
|
+
@timer = TkAfter.new(interval, 1, proc{show})
|
27
|
+
def @timer.interval(val)
|
28
|
+
@sleep_time = val
|
29
|
+
end
|
30
|
+
@bindtag = TkBindTag.new
|
31
|
+
@bindtag.bind('Enter', proc{@timer.start})
|
32
|
+
@bindtag.bind('Motion', proc{@timer.restart; erase})
|
33
|
+
@bindtag.bind('Any-ButtonPress', proc{@timer.restart; erase})
|
34
|
+
@bindtag.bind('Leave', proc{@timer.stop; erase})
|
35
|
+
tags = @parent.bindtags
|
36
|
+
idx = tags.index(@parent)
|
37
|
+
unless idx
|
38
|
+
ppath = TkComm.window(@parent.path)
|
39
|
+
idx = tags.index(ppath) || 0
|
40
|
+
end
|
41
|
+
tags[idx,0] = @bindtag
|
42
|
+
@parent.bindtags(tags)
|
43
|
+
end
|
44
|
+
private :_balloon_binding
|
45
|
+
|
46
|
+
def initialize(parent=nil, keys={})
|
47
|
+
@parent = parent || Tk.root
|
48
|
+
|
49
|
+
@frame = TkToplevel.new(@parent)
|
50
|
+
@frame.withdraw
|
51
|
+
@frame.overrideredirect(true)
|
52
|
+
@frame.transient(TkWinfo.toplevel(@parent))
|
53
|
+
@epath = @frame.path
|
54
|
+
|
55
|
+
if keys
|
56
|
+
keys = _symbolkey2str(keys)
|
57
|
+
else
|
58
|
+
keys = {}
|
59
|
+
end
|
60
|
+
|
61
|
+
@command = keys.delete('command')
|
62
|
+
|
63
|
+
@interval = keys.delete('interval'){DEFAULT_INTERVAL}
|
64
|
+
_balloon_binding(@interval)
|
65
|
+
|
66
|
+
# @label = TkLabel.new(@frame, 'background'=>'bisque').pack
|
67
|
+
@label = TkLabel.new(@frame,
|
68
|
+
'foreground'=>DEFAULT_FOREGROUND,
|
69
|
+
'background'=>DEFAULT_BACKGROUND).pack
|
70
|
+
@label.configure(_symbolkey2str(keys)) unless keys.empty?
|
71
|
+
@path = @label
|
72
|
+
end
|
73
|
+
|
74
|
+
def epath
|
75
|
+
@epath
|
76
|
+
end
|
77
|
+
|
78
|
+
def interval(val)
|
79
|
+
if val
|
80
|
+
@timer.interval(val)
|
81
|
+
else
|
82
|
+
@interval
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def command(cmd = Proc.new)
|
87
|
+
@command = cmd
|
88
|
+
self
|
89
|
+
end
|
90
|
+
|
91
|
+
def show
|
92
|
+
x = TkWinfo.pointerx(@parent)
|
93
|
+
y = TkWinfo.pointery(@parent)
|
94
|
+
@frame.geometry("+#{x+1}+#{y+1}")
|
95
|
+
|
96
|
+
if @command
|
97
|
+
case @command.arity
|
98
|
+
when 0
|
99
|
+
@command.call
|
100
|
+
when 2
|
101
|
+
@command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent))
|
102
|
+
when 3
|
103
|
+
@command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent),
|
104
|
+
self)
|
105
|
+
else
|
106
|
+
@command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent),
|
107
|
+
self, @parent)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
@frame.deiconify
|
112
|
+
@frame.raise
|
113
|
+
|
114
|
+
@org_cursor = @parent['cursor']
|
115
|
+
@parent.cursor('crosshair')
|
116
|
+
end
|
117
|
+
|
118
|
+
def erase
|
119
|
+
@parent.cursor(@org_cursor)
|
120
|
+
@frame.withdraw
|
121
|
+
end
|
122
|
+
|
123
|
+
def destroy
|
124
|
+
@frame.destroy
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
################################################
|
129
|
+
# test
|
130
|
+
################################################
|
131
|
+
if __FILE__ == $0
|
132
|
+
TkButton.new('text'=>'This button has a balloon help') {|b|
|
133
|
+
pack('fill'=>'x')
|
134
|
+
Tk::RbWidget::BalloonHelp.new(b, 'text'=>' Message ')
|
135
|
+
}
|
136
|
+
TkButton.new('text'=>'This button has another balloon help') {|b|
|
137
|
+
pack('fill'=>'x')
|
138
|
+
Tk::RbWidget::BalloonHelp.new(b,
|
139
|
+
'text'=>"CONFIGURED MESSAGE\nchange colors, and so on",
|
140
|
+
'interval'=>200, 'font'=>'courier',
|
141
|
+
'background'=>'gray', 'foreground'=>'red')
|
142
|
+
}
|
143
|
+
|
144
|
+
sb = TkScrollbox.new.pack(:fill=>:x)
|
145
|
+
sb.insert(:end, *%w(aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm))
|
146
|
+
=begin
|
147
|
+
# CASE1 : command takes no arguemnt
|
148
|
+
bh = Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
149
|
+
:relief=>:ridge, :background=>'white',
|
150
|
+
:command=>proc{
|
151
|
+
y = TkWinfo.pointery(sb) - TkWinfo.rooty(sb)
|
152
|
+
bh.text "current index == #{sb.nearest(y)}"
|
153
|
+
})
|
154
|
+
=end
|
155
|
+
=begin
|
156
|
+
# CASE2 : command takes 2 arguemnts
|
157
|
+
bh = Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
158
|
+
:relief=>:ridge, :background=>'white',
|
159
|
+
:command=>proc{|x, y|
|
160
|
+
bh.text "current index == #{sb.nearest(y)}"
|
161
|
+
})
|
162
|
+
=end
|
163
|
+
=begin
|
164
|
+
# CASE3 : command takes 3 arguemnts
|
165
|
+
Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
166
|
+
:relief=>:ridge, :background=>'white',
|
167
|
+
:command=>proc{|x, y, bhelp|
|
168
|
+
bhelp.text "current index == #{sb.nearest(y)}"
|
169
|
+
})
|
170
|
+
=end
|
171
|
+
=begin
|
172
|
+
# CASE4a : command is a Proc object and takes 4 arguemnts
|
173
|
+
cmd = proc{|x, y, bhelp, parent|
|
174
|
+
bhelp.text "current index == #{parent.nearest(y)}"
|
175
|
+
}
|
176
|
+
|
177
|
+
Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
178
|
+
:relief=>:ridge, :background=>'white',
|
179
|
+
:command=>cmd)
|
180
|
+
|
181
|
+
sb2 = TkScrollbox.new.pack(:fill=>:x)
|
182
|
+
sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM))
|
183
|
+
Tk::RbWidget::BalloonHelp.new(sb2, :interval=>500,
|
184
|
+
:padx=>5, :relief=>:raised,
|
185
|
+
:background=>'gray25', :foreground=>'white',
|
186
|
+
:command=>cmd)
|
187
|
+
=end
|
188
|
+
#=begin
|
189
|
+
# CASE4b : command is a Method object and takes 4 arguemnts
|
190
|
+
def set_msg(x, y, bhelp, parent)
|
191
|
+
bhelp.text "current index == #{parent.nearest(y)}"
|
192
|
+
end
|
193
|
+
cmd = self.method(:set_msg)
|
194
|
+
|
195
|
+
Tk::RbWidget::BalloonHelp.new(sb, :interval=>500,
|
196
|
+
:relief=>:ridge, :background=>'white',
|
197
|
+
:command=>cmd)
|
198
|
+
|
199
|
+
sb2 = TkScrollbox.new.pack(:fill=>:x)
|
200
|
+
sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM))
|
201
|
+
Tk::RbWidget::BalloonHelp.new(sb2, :interval=>500,
|
202
|
+
:padx=>5, :relief=>:raised,
|
203
|
+
:background=>'gray25', :foreground=>'white',
|
204
|
+
:command=>cmd)
|
205
|
+
#=end
|
206
|
+
|
207
|
+
Tk.mainloop
|
208
|
+
end
|
data/lib/tkxxs.rb
CHANGED
@@ -1,708 +1,710 @@
|
|
1
|
-
# encoding: Windows-1252 :encoding=Windows-1252:
|
2
|
-
# Copyright (c) 2010-2014 Axel Friedrich
|
3
|
-
|
4
|
-
$stdout.sync = true
|
5
|
-
$stderr.sync = true
|
6
|
-
STDOUT.sync = true
|
7
|
-
STDERR.sync = true
|
8
|
-
DIR_OF_TKXXS = File.dirname( File.expand_path( __FILE__ ) ).gsub('\\', '/')
|
9
|
-
$: << DIR_OF_TKXXS
|
10
|
-
$:.uniq!
|
11
|
-
$FILE_SEP = File::ALT_SEPARATOR || File::SEPARATOR
|
12
|
-
|
13
|
-
require 'tkxxs/conf'
|
14
|
-
require 'tk'
|
15
|
-
require 'tkextlib/tile'
|
16
|
-
require( File.dirname(DIR_OF_TKXXS) + '/ext/tkballoonhelp.rb' )
|
17
|
-
##/ ##require 'tkrbwidget/tkballoonhelp/tkballoonhelp.rb'
|
18
|
-
##/ ##require 'ext/tkballoonhelp/tkballoonhelp.rb'
|
19
|
-
##/ if $0 == __FILE__
|
20
|
-
##/ ##/ require 'ext/conf/conf'
|
21
|
-
##/ require 'axel/conf'
|
22
|
-
CONF = Conf.new unless defined?(CONF)
|
23
|
-
STDOUT.puts "CONFIG-FILENAME is: #{ CONF.filename.gsub('/',$FILE_SEP) }"
|
24
|
-
##/ end
|
25
|
-
require '
|
26
|
-
require 'tkxxs/version'
|
27
|
-
require 'tkxxs/tkxxs_classes'
|
28
|
-
|
29
|
-
|
30
|
-
##########################################################################
|
31
|
-
|
32
|
-
|
33
|
-
include Tk::
|
34
|
-
|
35
|
-
|
36
|
-
CONF[:
|
37
|
-
|
38
|
-
|
39
|
-
##########################################################################
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
:
|
51
|
-
:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
##########################################################################
|
60
|
-
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
CONF.
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
@
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
#
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
#
|
152
|
-
|
153
|
-
#
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
self.
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
#
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
#
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
##/ root.
|
191
|
-
##/ root.
|
192
|
-
|
193
|
-
#
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
root.
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
$tkxxs_[:
|
222
|
-
$tkxxs_[:
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
# :
|
253
|
-
|
254
|
-
# :
|
255
|
-
#
|
256
|
-
#
|
257
|
-
#
|
258
|
-
#
|
259
|
-
#
|
260
|
-
#
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
:
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
# *
|
278
|
-
# * +
|
279
|
-
#
|
280
|
-
#
|
281
|
-
# * <tt>:
|
282
|
-
#
|
283
|
-
#
|
284
|
-
#
|
285
|
-
#
|
286
|
-
#
|
287
|
-
#
|
288
|
-
# *
|
289
|
-
#
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
#
|
303
|
-
#
|
304
|
-
#
|
305
|
-
#
|
306
|
-
# * [
|
307
|
-
#
|
308
|
-
#
|
309
|
-
#
|
310
|
-
#
|
311
|
-
#
|
312
|
-
# * <tt>:
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
# * <tt>:
|
318
|
-
# * <tt>:
|
319
|
-
#
|
320
|
-
#
|
321
|
-
#
|
322
|
-
# *
|
323
|
-
# * +
|
324
|
-
#
|
325
|
-
# *
|
326
|
-
#
|
327
|
-
#
|
328
|
-
#
|
329
|
-
#
|
330
|
-
#
|
331
|
-
# [ "You want
|
332
|
-
#
|
333
|
-
#
|
334
|
-
#
|
335
|
-
#
|
336
|
-
#
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
#
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
# * [
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
352
|
-
#
|
353
|
-
#
|
354
|
-
# * <tt>:
|
355
|
-
#
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
# * <tt>:
|
360
|
-
# * <tt>:
|
361
|
-
# * <tt>:
|
362
|
-
#
|
363
|
-
#
|
364
|
-
#
|
365
|
-
# *
|
366
|
-
# * +
|
367
|
-
#
|
368
|
-
# *
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
# [ "You want
|
375
|
-
#
|
376
|
-
#
|
377
|
-
#
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
#
|
386
|
-
#
|
387
|
-
#
|
388
|
-
# * +
|
389
|
-
#
|
390
|
-
# * +
|
391
|
-
#
|
392
|
-
#
|
393
|
-
# * <tt>:
|
394
|
-
# * <tt>:
|
395
|
-
# * <tt>:
|
396
|
-
# * <tt>:
|
397
|
-
# * <tt>:
|
398
|
-
#
|
399
|
-
# * <tt>:
|
400
|
-
#
|
401
|
-
#
|
402
|
-
#
|
403
|
-
#
|
404
|
-
#
|
405
|
-
# *
|
406
|
-
#
|
407
|
-
#
|
408
|
-
#
|
409
|
-
#
|
410
|
-
#
|
411
|
-
#
|
412
|
-
#
|
413
|
-
#
|
414
|
-
#
|
415
|
-
#
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
#
|
424
|
-
#
|
425
|
-
#
|
426
|
-
#
|
427
|
-
#
|
428
|
-
#
|
429
|
-
# * +
|
430
|
-
#
|
431
|
-
# * +
|
432
|
-
#
|
433
|
-
#
|
434
|
-
# * <tt>:
|
435
|
-
# * <tt>:
|
436
|
-
# * <tt>:
|
437
|
-
# * <tt>:
|
438
|
-
# * <tt>:
|
439
|
-
# * <tt>:
|
440
|
-
#
|
441
|
-
# * <tt>:
|
442
|
-
#
|
443
|
-
#
|
444
|
-
#
|
445
|
-
#
|
446
|
-
#
|
447
|
-
#
|
448
|
-
# *
|
449
|
-
# *
|
450
|
-
#
|
451
|
-
#
|
452
|
-
#
|
453
|
-
# ['
|
454
|
-
# ['
|
455
|
-
# ['
|
456
|
-
# ['
|
457
|
-
# ['
|
458
|
-
# ['
|
459
|
-
# ['Image Files', [
|
460
|
-
# ['
|
461
|
-
#
|
462
|
-
#
|
463
|
-
#
|
464
|
-
# *
|
465
|
-
#
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
469
|
-
#
|
470
|
-
#
|
471
|
-
#
|
472
|
-
#
|
473
|
-
#
|
474
|
-
#
|
475
|
-
#
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
487
|
-
#
|
488
|
-
#
|
489
|
-
# * +
|
490
|
-
#
|
491
|
-
# * +
|
492
|
-
#
|
493
|
-
#
|
494
|
-
# * <tt>:
|
495
|
-
# * <tt>:
|
496
|
-
# * <tt>:
|
497
|
-
# * <tt>:
|
498
|
-
# * <tt>:
|
499
|
-
# * <tt>:
|
500
|
-
#
|
501
|
-
# * <tt>:
|
502
|
-
#
|
503
|
-
#
|
504
|
-
#
|
505
|
-
#
|
506
|
-
#
|
507
|
-
#
|
508
|
-
# *
|
509
|
-
# *
|
510
|
-
#
|
511
|
-
#
|
512
|
-
#
|
513
|
-
# ['
|
514
|
-
# ['
|
515
|
-
# ['
|
516
|
-
# ['
|
517
|
-
# ['
|
518
|
-
# ['
|
519
|
-
# ['Image Files', [
|
520
|
-
# ['
|
521
|
-
#
|
522
|
-
#
|
523
|
-
#
|
524
|
-
# *
|
525
|
-
#
|
526
|
-
#
|
527
|
-
#
|
528
|
-
#
|
529
|
-
#
|
530
|
-
#
|
531
|
-
#
|
532
|
-
#
|
533
|
-
#
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
#
|
542
|
-
#
|
543
|
-
#
|
544
|
-
#
|
545
|
-
#
|
546
|
-
#
|
547
|
-
# * +
|
548
|
-
#
|
549
|
-
# * +
|
550
|
-
#
|
551
|
-
#
|
552
|
-
# * <tt>:
|
553
|
-
#
|
554
|
-
#
|
555
|
-
#
|
556
|
-
#
|
557
|
-
# * <tt>:
|
558
|
-
# * <tt>:
|
559
|
-
# * <tt>:
|
560
|
-
# * <tt>:
|
561
|
-
#
|
562
|
-
# * <tt>:
|
563
|
-
#
|
564
|
-
#
|
565
|
-
#
|
566
|
-
#
|
567
|
-
#
|
568
|
-
#
|
569
|
-
#
|
570
|
-
# *
|
571
|
-
# *
|
572
|
-
#
|
573
|
-
#
|
574
|
-
#
|
575
|
-
# ['
|
576
|
-
# ['
|
577
|
-
# ['
|
578
|
-
# ['
|
579
|
-
# ['
|
580
|
-
# ['
|
581
|
-
# ['Image Files', [
|
582
|
-
# ['
|
583
|
-
#
|
584
|
-
#
|
585
|
-
#
|
586
|
-
#
|
587
|
-
# *
|
588
|
-
#
|
589
|
-
#
|
590
|
-
#
|
591
|
-
#
|
592
|
-
#
|
593
|
-
#
|
594
|
-
#
|
595
|
-
#
|
596
|
-
#
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
# *
|
605
|
-
# *
|
606
|
-
# *
|
607
|
-
# *
|
608
|
-
|
609
|
-
|
610
|
-
end #
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
choices =
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
choices =
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
#p
|
693
|
-
|
694
|
-
#
|
695
|
-
|
696
|
-
#p
|
697
|
-
|
698
|
-
#p
|
699
|
-
|
700
|
-
#p
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
1
|
+
# encoding: Windows-1252 :encoding=Windows-1252:
|
2
|
+
# Copyright (c) 2010-2014 Axel Friedrich
|
3
|
+
|
4
|
+
$stdout.sync = true
|
5
|
+
$stderr.sync = true
|
6
|
+
STDOUT.sync = true
|
7
|
+
STDERR.sync = true
|
8
|
+
DIR_OF_TKXXS = File.dirname( File.expand_path( __FILE__ ) ).gsub('\\', '/')
|
9
|
+
$: << DIR_OF_TKXXS
|
10
|
+
$:.uniq!
|
11
|
+
$FILE_SEP = File::ALT_SEPARATOR || File::SEPARATOR
|
12
|
+
|
13
|
+
require 'tkxxs/conf'
|
14
|
+
require 'tk'
|
15
|
+
require 'tkextlib/tile'
|
16
|
+
require( File.dirname(DIR_OF_TKXXS) + '/ext/tkballoonhelp.rb' )
|
17
|
+
##/ ##require 'tkrbwidget/tkballoonhelp/tkballoonhelp.rb'
|
18
|
+
##/ ##require 'ext/tkballoonhelp/tkballoonhelp.rb'
|
19
|
+
##/ if $0 == __FILE__
|
20
|
+
##/ ##/ require 'ext/conf/conf'
|
21
|
+
##/ require 'axel/conf'
|
22
|
+
CONF = Conf.new unless defined?(CONF)
|
23
|
+
STDOUT.puts "CONFIG-FILENAME is: #{ CONF.filename.gsub('/',$FILE_SEP) }"
|
24
|
+
##/ end
|
25
|
+
require 'platform' unless defined?(Platform::OS)
|
26
|
+
require 'tkxxs/version'
|
27
|
+
require 'tkxxs/tkxxs_classes'
|
28
|
+
##require 'pry'
|
29
|
+
|
30
|
+
##########################################################################
|
31
|
+
##########################################################################
|
32
|
+
module TKXXS
|
33
|
+
include Tk::RbWidget
|
34
|
+
include Tk::Tile
|
35
|
+
$tkxxs_ = Hash.new unless defined?( $tkxxs_ )
|
36
|
+
CONF[:recentDirsSize] = CONF[:recentDirsSize] || 100
|
37
|
+
CONF[:recentFilesSize] = CONF[:recentFilesSize] || 100
|
38
|
+
|
39
|
+
##########################################################################
|
40
|
+
##########################################################################
|
41
|
+
#
|
42
|
+
class Tk::RbWidget::BalloonHelp # :nodoc:
|
43
|
+
|
44
|
+
alias :orig_initialize :initialize
|
45
|
+
|
46
|
+
##################################################################
|
47
|
+
# Setting defaults
|
48
|
+
def initialize( parent=nil, keys={} )
|
49
|
+
keys = {
|
50
|
+
:interval=>300, # ms
|
51
|
+
:background=>'LightYellow',
|
52
|
+
:relief=>:ridge, :justify=>:left,
|
53
|
+
}.merge(keys)
|
54
|
+
orig_initialize(parent, keys)
|
55
|
+
end # initialize
|
56
|
+
|
57
|
+
end # class Tk::RbWidget::BalloonHelp
|
58
|
+
|
59
|
+
##########################################################################
|
60
|
+
##########################################################################
|
61
|
+
# You create an Output Window like this:
|
62
|
+
# @outW = OutW.new
|
63
|
+
# You can write to the Output Window like this:
|
64
|
+
# @outW.puts "Hallo"
|
65
|
+
# OR, you can redirect stdout to @outW:
|
66
|
+
# $stdout = @outW
|
67
|
+
# Then you can simply write:
|
68
|
+
# puts "Hallo"
|
69
|
+
# to write to the Output Window.
|
70
|
+
# This means, if you have an existing application which uses +puts+
|
71
|
+
# to write to the console, you can easily make it to write to the
|
72
|
+
# Output Window!
|
73
|
+
# BUT: Unfortunately, this is not compatible with OCRA and pry (as
|
74
|
+
# of 2013-12). When you want to use OCRA or pry, you cannot use this
|
75
|
+
# redirection of stdout.
|
76
|
+
class OutW < TKXXS_CLASSES::TextW
|
77
|
+
CONF = nil unless defined?(CONF)
|
78
|
+
|
79
|
+
def initialize( hash={} )
|
80
|
+
@alive = true
|
81
|
+
teardownDone = false
|
82
|
+
at_exit { self.destroy }
|
83
|
+
|
84
|
+
#---- Root
|
85
|
+
img = TkPhotoImage.new(:file=>"#{ DIR_OF_TKXXS }/icon.gif")
|
86
|
+
@root = TkRoot.new(:iconphoto_default=>img )
|
87
|
+
|
88
|
+
userscreen(@root) unless $tkxxs_[:userscreenx]
|
89
|
+
if CONF
|
90
|
+
@root.geometry =
|
91
|
+
CONF.or_default( :outWGeom, '400x300+100+0' )
|
92
|
+
end
|
93
|
+
#---- Root-bindings
|
94
|
+
@root.bind('Destroy') {
|
95
|
+
unless teardownDone
|
96
|
+
notify_dying
|
97
|
+
if CONF
|
98
|
+
CONF[:outWGeom] = @root.geometry
|
99
|
+
STDOUT.puts "Saving config to #{ CONF.filename.gsub('/', $FILE_SEP) }"
|
100
|
+
CONF.save
|
101
|
+
end
|
102
|
+
teardownDone = true
|
103
|
+
end # unless
|
104
|
+
}
|
105
|
+
|
106
|
+
#---- TopFrame
|
107
|
+
top = Frame.new.pack(:expand=>true, :fill=>:both)
|
108
|
+
|
109
|
+
#---- outWindow
|
110
|
+
##/ @outW = TextW.new(top)
|
111
|
+
super(top, hash)
|
112
|
+
@tagH2 = TkTextTag.new(self, :font=>"Courier 14 bold")
|
113
|
+
@tagSel = TkTextTagSel.new(self)
|
114
|
+
bind('Control-Key-a') {
|
115
|
+
# From:
|
116
|
+
# "Using Control-a to select all text in a text widget : TCL",
|
117
|
+
# http://objectmix.com/tcl/35276-using-control-select-all-text-text-widget.html
|
118
|
+
@tagSel.add('0.0', :end)
|
119
|
+
Kernel.raise TkCallbackBreak
|
120
|
+
}
|
121
|
+
|
122
|
+
end # initialize
|
123
|
+
|
124
|
+
##################################################################
|
125
|
+
# Like Kernel::puts. Write a String to the Output Window.
|
126
|
+
def puts( *args )
|
127
|
+
args = args.join("\n") if args.class == Array
|
128
|
+
str = args.chomp("\n") + "\n"
|
129
|
+
self.insert(:end, str)
|
130
|
+
self.see :end
|
131
|
+
##/ self.update # N�tig?
|
132
|
+
end # puts
|
133
|
+
|
134
|
+
##################################################################
|
135
|
+
# puts, formated as heading level 2
|
136
|
+
def puts_h2( str )
|
137
|
+
self.insert(:end, "\n" + str.chomp("\n") + "\n", @tagH2)
|
138
|
+
end # puts_h2
|
139
|
+
|
140
|
+
##################################################################
|
141
|
+
# Like Kernel::print. Print a String to the Output Window.
|
142
|
+
def print( *args )
|
143
|
+
if args.class == Array
|
144
|
+
args.map! {|a| a.to_s }
|
145
|
+
args = args.join(" ")
|
146
|
+
end
|
147
|
+
str = args.chomp("\n") + "\n"
|
148
|
+
self.insert('end', str)
|
149
|
+
self.see :end
|
150
|
+
##/ self.update # N�tig?
|
151
|
+
end # print
|
152
|
+
|
153
|
+
# TODO def p()
|
154
|
+
|
155
|
+
# :nodoc:
|
156
|
+
def write( str )
|
157
|
+
##self.insert(:end, "\n" + str)
|
158
|
+
self.insert(:end, str)
|
159
|
+
self.see :end
|
160
|
+
##/ self.update # N�tig?
|
161
|
+
end # write
|
162
|
+
|
163
|
+
##########################################################################
|
164
|
+
# :nodoc:
|
165
|
+
# Does nothing, just for compatibility
|
166
|
+
def sync=( x )
|
167
|
+
# nothing to do
|
168
|
+
end # sync=
|
169
|
+
|
170
|
+
# :nodoc:
|
171
|
+
def flush
|
172
|
+
self.update
|
173
|
+
end #
|
174
|
+
|
175
|
+
# :nodoc:
|
176
|
+
def tty?( )
|
177
|
+
false
|
178
|
+
end # tty?
|
179
|
+
|
180
|
+
|
181
|
+
# :nodoc:
|
182
|
+
def private____________________________( )
|
183
|
+
end # private____________________________
|
184
|
+
|
185
|
+
##################################################################
|
186
|
+
# "private"
|
187
|
+
def userscreen( root )
|
188
|
+
if Platform::OS == :win32
|
189
|
+
root.state('zoomed') # OK on Windows
|
190
|
+
##/ root.wm_state('zoomed') # OK on Windows
|
191
|
+
##/ root.wm_zoomed # method missing
|
192
|
+
##/ root.wm_attributes('zoomed')
|
193
|
+
##/ root.wm_maximized # method missing
|
194
|
+
else
|
195
|
+
# Linux: works
|
196
|
+
# Other: not tested
|
197
|
+
root.height = root.winfo_screenheight
|
198
|
+
root.width = root.winfo_screenwidth
|
199
|
+
end
|
200
|
+
root.update
|
201
|
+
|
202
|
+
root.winfo_geometry =~ /(\d+)x(\d+)\+([+-]?\d+)\+([+-]?\d+)/
|
203
|
+
xwg = $3.to_i
|
204
|
+
ywg = $4.to_i
|
205
|
+
root.geometry =~ /(\d+)x(\d+)\+([+-]?\d+)\+([+-]?\d+)/
|
206
|
+
gw = $1.to_i
|
207
|
+
gh = $2.to_i
|
208
|
+
|
209
|
+
## sw = root.winfo_screenwidth
|
210
|
+
## sh = root.winfo_screenheight
|
211
|
+
|
212
|
+
rx = root.winfo_rootx
|
213
|
+
ry = root.winfo_rooty # maybe, taskbar height
|
214
|
+
|
215
|
+
border = -[xwg,ywg].min
|
216
|
+
userscreenx = xwg + border
|
217
|
+
userscreeny= ywg + border
|
218
|
+
userscreenwidth = gw
|
219
|
+
userscreenheight = gh + ry - ywg - border
|
220
|
+
|
221
|
+
$tkxxs_[:userscreenx ] = userscreenx
|
222
|
+
$tkxxs_[:userscreeny ] = userscreeny
|
223
|
+
$tkxxs_[:userscreenwidth ] = userscreenwidth
|
224
|
+
$tkxxs_[:userscreenheight] = userscreenheight
|
225
|
+
|
226
|
+
root.state('normal')
|
227
|
+
nil
|
228
|
+
end # userscreen
|
229
|
+
|
230
|
+
##################################################################
|
231
|
+
# "private"
|
232
|
+
def notify_dying( )
|
233
|
+
@alive = false
|
234
|
+
end # notify_dying
|
235
|
+
|
236
|
+
##################################################################
|
237
|
+
# "private"
|
238
|
+
def alive?( )
|
239
|
+
@alive
|
240
|
+
end # alive?
|
241
|
+
end # class OutW
|
242
|
+
|
243
|
+
##################################################################
|
244
|
+
##################################################################
|
245
|
+
# Depreciated (replaced by OutW).
|
246
|
+
class LogW < OutW # :nodoc:
|
247
|
+
end
|
248
|
+
|
249
|
+
##########################################################################
|
250
|
+
##########################################################################
|
251
|
+
def messageBoxExamples
|
252
|
+
# TODO: Is this usefull?
|
253
|
+
##################################################################
|
254
|
+
# :type: :abortretryignore, :ok, :okcancel, :retrycancel, :yesno, :yesnocancel
|
255
|
+
# :icon: :error, :info, :question or :warning (default: info)
|
256
|
+
# :detail: Specifies an auxiliary message to the main message given by
|
257
|
+
# the -message option. Where supported by the underlying OS, the
|
258
|
+
# message detail will be presented in a less emphasized font than the
|
259
|
+
# main message.
|
260
|
+
# Returns: A String describing the pressed button ("ok", "cancel", "retry", "ignore", ...)
|
261
|
+
# Balloonhelp funktioniert damit nicht (oder?).
|
262
|
+
#
|
263
|
+
ans = Tk.messageBox( :type=>:yesno,:icon=>:question,
|
264
|
+
:title=>"Next",
|
265
|
+
:message=>"xxx",
|
266
|
+
:detail=>"xxx"
|
267
|
+
)
|
268
|
+
#
|
269
|
+
# puts sprintf("--DEBUG: button: %1s ", button.inspect) #loe
|
270
|
+
end # class MessageBoxExamples
|
271
|
+
|
272
|
+
##########################################################################
|
273
|
+
# ask_single_line(question=nil, help=nil, hash=nil)
|
274
|
+
#
|
275
|
+
# Ask for a single line of text.
|
276
|
+
#
|
277
|
+
# *Params*:
|
278
|
+
# * +question+ - (String, optional) Your question; +nil+ => Default question
|
279
|
+
# * +help+ - (String, optional) Text used in the BalloonHelp; +nil+ => No help text
|
280
|
+
# * +hash+ - (Hash, optional)
|
281
|
+
# * <tt>:question</tt> - Like above.
|
282
|
+
# * <tt>:help</tt> - Like above.
|
283
|
+
# * <tt>:configSection</tt> - (any String, Integer, Float or nil)
|
284
|
+
# Sets the section where to store and read from config settings.
|
285
|
+
# Default = nil. If key is not given, section remains unchanged.
|
286
|
+
# * <tt>:defaultEntry</tt> - (String) Default answer.
|
287
|
+
#
|
288
|
+
# *Returns*: (String or nil) The answer of the dialog. 'Cancel' returns nil.
|
289
|
+
#
|
290
|
+
# *Example:*
|
291
|
+
# help = "This dialog is named 'ask_single_line'"
|
292
|
+
# ans = ask_single_line(
|
293
|
+
# "Want to know more?\nPoint with the mouse to the entry field!",
|
294
|
+
# help,
|
295
|
+
# :defaultEntry =>"Of course"
|
296
|
+
# )
|
297
|
+
def ask_single_line( *args )
|
298
|
+
TKXXS_CLASSES::AskSingleLineD.new(*args).answer
|
299
|
+
end # ask_single_line
|
300
|
+
|
301
|
+
##################################################################
|
302
|
+
# single_choice( aryWithChoices, help=nil, hash=nil )
|
303
|
+
#
|
304
|
+
# *Params*:
|
305
|
+
# * +aryWithChoices+ - (Array) one of the following formats:
|
306
|
+
# * [ choiceStrA, choiceStrB, ...]
|
307
|
+
# * [ [choiceStrA,objectA], [choiceStrB,objectB], ... ]
|
308
|
+
# * [ [choiceStrA,objectA,helpStrA], [choiceStrB,objectB,helpStrB], ...]
|
309
|
+
# Quite usefull: a Proc for object.
|
310
|
+
# * +help+ - (String, optional) Array, with one help-String for each choice element!; +nil+ => No help text
|
311
|
+
# * +hash+ - (Hash, optional)
|
312
|
+
# * <tt>:question</tt> - Like above.
|
313
|
+
# * <tt>:help</tt> - Like above.
|
314
|
+
# * <tt>:configSection</tt> - (any String, Integer, Float or nil)
|
315
|
+
# Sets the section where to store and read from config settings.
|
316
|
+
# Default = nil. If key is not given, section remains unchanged.
|
317
|
+
# * <tt>:title</tt> - (String) Title of the dialog window
|
318
|
+
# * <tt>:bd</tt> - (Number as String) ?
|
319
|
+
# * <tt>:searchFieldHelp</tt> - (String) Ballon help of the search field,
|
320
|
+
# * <tt>:returnChoiceAndClient</tt> - returns the right side (+false+) or both sides (+true+) of +aryWithChoices+.
|
321
|
+
#
|
322
|
+
# *Returns:*
|
323
|
+
# * The chosen right sides of +aryWithChoices+ if :returnChoiceAndClient == +false+ (default),
|
324
|
+
# * An Array of the chosen right and left side of +aryWithChoices+ if :returnChoiceAndClient == +true+,
|
325
|
+
# * +nil+, if 'Cancel' was clicked.
|
326
|
+
#
|
327
|
+
# *Example:*
|
328
|
+
# help = ['Help #1', 'Help #2', 'Help #3']
|
329
|
+
# ans = single_choice(
|
330
|
+
# [
|
331
|
+
# [ "You want 1?", 1],
|
332
|
+
# [ "You want 2?", 2],
|
333
|
+
# [ "You want 3?", 3],
|
334
|
+
# ],
|
335
|
+
# help
|
336
|
+
# )
|
337
|
+
#
|
338
|
+
# *TODO:* Choice-search field: � (ä) does not work?
|
339
|
+
def single_choice( *args )
|
340
|
+
TKXXS_CLASSES::SingleChoiceD.new(*args).answer
|
341
|
+
end # single_choice
|
342
|
+
|
343
|
+
##################################################################
|
344
|
+
# multi_choice( aryWithChoices, help=nil, hash=nil )
|
345
|
+
#
|
346
|
+
# *Params*:
|
347
|
+
# * +aryWithChoices+ - (Array) one of the following formats:
|
348
|
+
# * [ choiceStrA, choiceStrB, ...]
|
349
|
+
# * [ [choiceStrA,objectA], [choiceStrB,objectB], ... ]
|
350
|
+
# * [ [choiceStrA,objectA,helpStrA], [choiceStrB,objectB,helpStrB], ...]
|
351
|
+
# Quite usefull: a Proc for object.
|
352
|
+
# * +help+ - (String, optional) Array, with one help-String for each choice element!; +nil+ => No help text
|
353
|
+
# * +hash+ - (Hash, optional)
|
354
|
+
# * <tt>:question</tt> - (String) Your question; +nil+ -> no question.
|
355
|
+
# * <tt>:help</tt> - Like above.
|
356
|
+
# * <tt>:configSection</tt> - (any String, Integer, Float or nil)
|
357
|
+
# Sets the section where to store and read from config settings.
|
358
|
+
# Default = nil. If key is not given, section remains unchanged.
|
359
|
+
# * <tt>:title</tt> - (String) Title of the dialog window
|
360
|
+
# * <tt>:bd</tt> - (Number as String) ?
|
361
|
+
# * <tt>:selectmode => :multiple</tt> - Obsolet?
|
362
|
+
# * <tt>:searchFieldHelp</tt> - (String) Ballon help of the search field, searchField not implemented yet
|
363
|
+
# * <tt>:returnChoiceAndClient</tt> - returns the right side (+false+) or both sides (+true+) of +aryWithChoices+.
|
364
|
+
#
|
365
|
+
# *Returns:*
|
366
|
+
# * An Array of the chosen right sides of +aryWithChoices+ if :returnChoiceAndClient == +false+ (default),
|
367
|
+
# * An Array of the chosen right and left sides of +aryWithChoices+ if :returnChoiceAndClient == +true+,
|
368
|
+
# * +nil+, if 'Cancel' was clicked.
|
369
|
+
#
|
370
|
+
# *Example:*
|
371
|
+
# help = ['Help #1', 'Help #2', 'Help #3']
|
372
|
+
# ans = single_choice(
|
373
|
+
# [
|
374
|
+
# [ "You want 1?", 1],
|
375
|
+
# [ "You want 2?", 2],
|
376
|
+
# [ "You want 3?", 3],
|
377
|
+
# ],
|
378
|
+
# help
|
379
|
+
# )
|
380
|
+
def multi_choice( *args )
|
381
|
+
TKXXS_CLASSES::MultiChoiceD.new(*args).answer
|
382
|
+
end # multi_choice
|
383
|
+
|
384
|
+
##########################################################################
|
385
|
+
# choose_dir( initialdir=nil,help=nil,hash=nil )
|
386
|
+
#
|
387
|
+
# *Params*:
|
388
|
+
# * +initialdir+ - (String, optional) Initial dir; default = +nil+
|
389
|
+
# -> Working dir at the time of calling this method.
|
390
|
+
# * +help+ - (String, optional) ; Text used in the BalloonHelp;
|
391
|
+
# default = +nil+ -> No help.
|
392
|
+
# * +hash+ - (Hash, optional)
|
393
|
+
# * <tt>:initialdir</tt> - Like above.
|
394
|
+
# * <tt>:help</tt> - Like above.
|
395
|
+
# * <tt>:mode</tt> - Don't modify this!
|
396
|
+
# * <tt>:question</tt> - (String) Your question; +nil+ -> no question.
|
397
|
+
# * <tt>:title</tt> - (String) Title of the dialog window.
|
398
|
+
# * <tt>:defaultEntry</tt> - (String) Path, shown in the entry field.
|
399
|
+
# * <tt>:validate</tt> - +true+ or +false+; if true, a valid path
|
400
|
+
# must be chosen, canceling the dialog is not possible.
|
401
|
+
# * <tt>:configSection</tt> - (any String, Integer, Float or nil)
|
402
|
+
# Sets the section where to store and read from config settings.
|
403
|
+
# Default = nil. If key is not given, section remains unchanged.
|
404
|
+
#
|
405
|
+
# *Returns:* (String) Path of the chosen dir; +nil+, if 'Cancel' was clicked.
|
406
|
+
#
|
407
|
+
# *Example:*
|
408
|
+
#
|
409
|
+
# help = "Pick a dir."
|
410
|
+
# ans = choose_dir(
|
411
|
+
# 'c:\WinDows',
|
412
|
+
# help,
|
413
|
+
# :validate=>true,
|
414
|
+
# :defaultEntry=>'c:/windows/system'
|
415
|
+
# )
|
416
|
+
#
|
417
|
+
# *TODO:* How to choose multiple dirs or even dirs & files?
|
418
|
+
def choose_dir( *args ) # initialdir
|
419
|
+
TKXXS_CLASSES::ChooseDirD.new(*args).answer
|
420
|
+
end # choose_dir
|
421
|
+
|
422
|
+
##########################################################################
|
423
|
+
# open_files( initialdir=nil,help=nil,hash=nil )
|
424
|
+
#
|
425
|
+
# To get this dialog explain, run the example and point the mouse
|
426
|
+
# at each button.
|
427
|
+
#
|
428
|
+
# *Params*:
|
429
|
+
# * +initialdir+ - (String, optional) Initial dir; default = +nil+
|
430
|
+
# -> Working dir at the time of calling this method.
|
431
|
+
# * +help+ - (String, optional) ; Text used in the BalloonHelp;
|
432
|
+
# default = +nil+ -> No help.
|
433
|
+
# * +hash+ - (Hash, optional)
|
434
|
+
# * <tt>:initialdir</tt> - Like above.
|
435
|
+
# * <tt>:help</tt> - Like above.
|
436
|
+
# * <tt>:mode</tt> - Don't change this!
|
437
|
+
# * <tt>:multiple</tt> - Don't change this!
|
438
|
+
# * <tt>:question</tt> - (String) Your question; +nil+ -> no question.
|
439
|
+
# * <tt>:title</tt> - (String) Title of the dialog window.
|
440
|
+
# * <tt>:defaultEntry</tt> - (String) Path, shown in the entry field.
|
441
|
+
# * <tt>:validate</tt> - +true+ or +false+; if true, a valid path
|
442
|
+
# must be chosen, canceling the dialog is not possible.
|
443
|
+
# * <tt>:configSection</tt> - (any String, Integer, Float or nil)
|
444
|
+
# Sets the section where to store and read from config settings.
|
445
|
+
# Default = nil. If key is not given, section remains unchanged.
|
446
|
+
# * <tt>:filetypes</tt> - (Array of Arrays) Filter for the file types
|
447
|
+
# Format of the (inner) Arrays:
|
448
|
+
# * First element: (String) Name of the file type, e.g. 'Ruby files'
|
449
|
+
# * Second element: (Array) List of extensions for the file type, e.g. ['.rb','.rbw']
|
450
|
+
# * Third element: (String, optional) Mac file type(s), e.g. 'TEXT'
|
451
|
+
# * Example:
|
452
|
+
# filetypes = [
|
453
|
+
# ['Text files', ['.txt','.doc'] ],
|
454
|
+
# ['Text files', [], 'TEXT' ],
|
455
|
+
# ['Ruby Scripts', ['.rb'], 'TEXT' ],
|
456
|
+
# ['Tcl Scripts', ['.tcl'], 'TEXT' ],
|
457
|
+
# ['C Source Files', ['.c','.h'] ],
|
458
|
+
# ['All Source Files', ['.rb','.tcl','.c','.h'] ],
|
459
|
+
# ['Image Files', ['.gif'] ],
|
460
|
+
# ['Image Files', ['.jpeg','.jpg'] ],
|
461
|
+
# ['Image Files', [], ['GIFF','JPEG']],
|
462
|
+
# ['All files', '*' ]
|
463
|
+
# ]
|
464
|
+
# *Returns:* (Array) Paths of the chosen files; +nil+, if 'Cancel' was clicked.
|
465
|
+
#
|
466
|
+
# *Example:*
|
467
|
+
#
|
468
|
+
# filetypes = [
|
469
|
+
# ['Log Files', ['.log']],
|
470
|
+
# ['All Files', '*']
|
471
|
+
# ]
|
472
|
+
#
|
473
|
+
# ans = open_files('c:\Windows', :filetypes=>filetypes)
|
474
|
+
#
|
475
|
+
# *TODO:* When using "Recent"-Button > "Files" or "Favorite"-Button >
|
476
|
+
# "Files" you can choose only one from Recent and none from, for
|
477
|
+
# example "Browse"; should be multiple.
|
478
|
+
def open_files( *args )
|
479
|
+
TKXXS_CLASSES::OpenFilesD.new(*args).answer
|
480
|
+
end # open_files
|
481
|
+
|
482
|
+
##################################################################
|
483
|
+
# open_file( initialdir=nil,help=nil,hash=nil )
|
484
|
+
#
|
485
|
+
# To get this dialog explain, run the example and point the mouse
|
486
|
+
# at each button.
|
487
|
+
#
|
488
|
+
# *Params*:
|
489
|
+
# * +initialdir+ - (String, optional) Initial dir; default = +nil+
|
490
|
+
# -> Working dir at the time of calling this method.
|
491
|
+
# * +help+ - (String, optional) ; Text used in the BalloonHelp;
|
492
|
+
# default = +nil+ -> No help.
|
493
|
+
# * +hash+ - (Hash, optional)
|
494
|
+
# * <tt>:initialdir</tt> - Like above.
|
495
|
+
# * <tt>:help</tt> - Like above.
|
496
|
+
# * <tt>:mode</tt> - Don't change this!
|
497
|
+
# * <tt>:multiple</tt> - Don't change this!
|
498
|
+
# * <tt>:question</tt> - (String) Your question; +nil+ -> no question.
|
499
|
+
# * <tt>:title</tt> - (String) Title of the dialog window.
|
500
|
+
# * <tt>:defaultEntry</tt> - (String) Path, shown in the entry field.
|
501
|
+
# * <tt>:validate</tt> - +true+ or +false+; if true, a valid path
|
502
|
+
# must be chosen, canceling the dialog is not possible.
|
503
|
+
# * <tt>:configSection</tt> - (any String, Integer, Float or nil)
|
504
|
+
# Sets the section where to store and read from config settings.
|
505
|
+
# Default = nil. If key is not given, section remains unchanged.
|
506
|
+
# * <tt>:filetypes</tt> - (Array of Arrays) Filter for the file types
|
507
|
+
# Format of the (inner) Arrays:
|
508
|
+
# * First element: (String) Name of the file type, e.g. 'Ruby files'
|
509
|
+
# * Second element: (Array) List of extensions for the file type, e.g. ['.rb','.rbw']
|
510
|
+
# * Third element: (String, optional) Mac file type(s), e.g. 'TEXT'
|
511
|
+
# * Example:
|
512
|
+
# filetypes = [
|
513
|
+
# ['Text files', ['.txt','.doc'] ],
|
514
|
+
# ['Text files', [], 'TEXT' ],
|
515
|
+
# ['Ruby Scripts', ['.rb'], 'TEXT' ],
|
516
|
+
# ['Tcl Scripts', ['.tcl'], 'TEXT' ],
|
517
|
+
# ['C Source Files', ['.c','.h'] ],
|
518
|
+
# ['All Source Files', ['.rb','.tcl','.c','.h'] ],
|
519
|
+
# ['Image Files', ['.gif'] ],
|
520
|
+
# ['Image Files', ['.jpeg','.jpg'] ],
|
521
|
+
# ['Image Files', [], ['GIFF','JPEG']],
|
522
|
+
# ['All files', '*' ]
|
523
|
+
# ]
|
524
|
+
# *Returns:* (Array) Paths of the chosen files; +nil+, if 'Cancel' was clicked.
|
525
|
+
#
|
526
|
+
# *Example:*
|
527
|
+
#
|
528
|
+
# filetypes = [
|
529
|
+
# ['Log Files', ['.log']],
|
530
|
+
# ['All Files', '*']
|
531
|
+
# ]
|
532
|
+
#
|
533
|
+
# ans = open_file('c:\Windows', :filetypes=>filetypes)
|
534
|
+
#
|
535
|
+
# *TODO:* Does initialdir work?
|
536
|
+
def open_file( *args )
|
537
|
+
TKXXS_CLASSES::OpenFileD.new(*args).answer
|
538
|
+
end # open_file
|
539
|
+
|
540
|
+
##################################################################
|
541
|
+
# save_file( initialdir=nil,help=nil,hash=nil )
|
542
|
+
#
|
543
|
+
# To get this dialog explain, run the example and point the mouse
|
544
|
+
# at each button.
|
545
|
+
#
|
546
|
+
# *Params*:
|
547
|
+
# * +initialdir+ - (String, optional) Initial dir; default = +nil+
|
548
|
+
# -> Working dir at the time of calling this method.
|
549
|
+
# * +help+ - (String, optional) ; Text used in the BalloonHelp;
|
550
|
+
# default = +nil+ -> No help.
|
551
|
+
# * +hash+ - (Hash, optional)
|
552
|
+
# * <tt>:initialdir</tt> - Like above.
|
553
|
+
# * <tt>:help</tt> - Like above.
|
554
|
+
# * <tt>:initialfile</tt> - (String) Default filename, extension
|
555
|
+
# will be added automatically by filetypes-setting; default =
|
556
|
+
# 'Untitled'
|
557
|
+
# * <tt>:mode</tt> - Don't change this!
|
558
|
+
# * <tt>:multiple</tt> - Don't change this!
|
559
|
+
# * <tt>:question</tt> - (String) Your question; +nil+ -> no question.
|
560
|
+
# * <tt>:title</tt> - (String) Title of the dialog window.
|
561
|
+
# * <tt>:defaultEntry</tt> - (String) Path, shown in the entry field.
|
562
|
+
# * <tt>:validate</tt> - +true+ or +false+; if true, a valid path
|
563
|
+
# must be chosen, canceling the dialog is not possible.
|
564
|
+
# * <tt>:configSection</tt> - (any String, Integer, Float or nil)
|
565
|
+
# Sets the section where to store and read from config settings.
|
566
|
+
# Default = nil. If key is not given, section remains unchanged.
|
567
|
+
# * <tt>:defaultextension</tt> - ??? (Don't change).
|
568
|
+
# * <tt>:filetypes</tt> - (Array of Arrays) Filter for the file types
|
569
|
+
# Format of the (inner) Arrays:
|
570
|
+
# * First element: (String) Name of the file type, e.g. 'Ruby files'
|
571
|
+
# * Second element: (Array) List of extensions for the file type, e.g. ['.rb','.rbw']
|
572
|
+
# * Third element: (String, optional) Mac file type(s), e.g. 'TEXT'
|
573
|
+
# * Example:
|
574
|
+
# filetypes = [
|
575
|
+
# ['Text files', ['.txt','.doc'] ],
|
576
|
+
# ['Text files', [], 'TEXT' ],
|
577
|
+
# ['Ruby Scripts', ['.rb'], 'TEXT' ],
|
578
|
+
# ['Tcl Scripts', ['.tcl'], 'TEXT' ],
|
579
|
+
# ['C Source Files', ['.c','.h'] ],
|
580
|
+
# ['All Source Files', ['.rb','.tcl','.c','.h'] ],
|
581
|
+
# ['Image Files', ['.gif'] ],
|
582
|
+
# ['Image Files', ['.jpeg','.jpg'] ],
|
583
|
+
# ['Image Files', [], ['GIFF','JPEG']],
|
584
|
+
# ['All files', '*' ]
|
585
|
+
# ]
|
586
|
+
#
|
587
|
+
# *Returns:* (String) Paths of the chosen file; +nil+, if 'Cancel' was clicked.
|
588
|
+
#
|
589
|
+
# *Example:*
|
590
|
+
#
|
591
|
+
# filetypes = [
|
592
|
+
# ['Log Files', ['.log']],
|
593
|
+
# ['All Files', '*']
|
594
|
+
# ]
|
595
|
+
#
|
596
|
+
# ans = save_file('c:\Windows', :filetypes=>filetypes)
|
597
|
+
#
|
598
|
+
# *TODO:* Does initialdir work?
|
599
|
+
def save_file( *args )
|
600
|
+
TKXXS_CLASSES::SaveFileD.new(*args).answer
|
601
|
+
end # save_file
|
602
|
+
|
603
|
+
def todo( ) # :nodoc:
|
604
|
+
# * in all balloon-helps, remove interval, background, justify, relief (not needed) 2010-02-19
|
605
|
+
# * Build into TK a function for userscreensize, that's for Balloonhelp
|
606
|
+
# *
|
607
|
+
# *
|
608
|
+
# *
|
609
|
+
# *
|
610
|
+
end # todo
|
611
|
+
|
612
|
+
end # module TKXXS
|
613
|
+
|
614
|
+
##########################################################################
|
615
|
+
##########################################################################
|
616
|
+
if $0 == __FILE__
|
617
|
+
$VERBOSE = false
|
618
|
+
##/ require 'axel/conf'
|
619
|
+
##/ CONF = Conf.new
|
620
|
+
include TKXXS
|
621
|
+
|
622
|
+
if !true # OutWindow!
|
623
|
+
@outW = OutW.new
|
624
|
+
$stdout = @outW
|
625
|
+
else
|
626
|
+
STDOUT.puts "OUTWindow disabled !!!!!!!!!!!!!!!!!!"
|
627
|
+
end
|
628
|
+
|
629
|
+
if !true # SingleChoiceD
|
630
|
+
choices = File.open(__FILE__.strip + '_dummydata') {|f| f.read }
|
631
|
+
choices = choices*100
|
632
|
+
choices = choices.split("\n")
|
633
|
+
help = choices.unshift("abc def abc def abc def abc def abc def abc def abc def abcdef abc def abc def abc def abcdef abc def abc def abc def abcdef abc def abc def abc def abcdef abc def abc def abc def abcdef abc def abc def abc def abc \n"*40)
|
634
|
+
ans = SingleChoiceD.new(choices, help).answer
|
635
|
+
p(ans)
|
636
|
+
end
|
637
|
+
|
638
|
+
if !true # SingleChoiceD
|
639
|
+
choices = File.open(__FILE__.strip + '_dummydata') {|f| f.read }
|
640
|
+
choices = choices*100
|
641
|
+
choices = choices.split("\n")
|
642
|
+
ans = SingleChoiceD.new(choices, :title=>'Dialogs title').answer
|
643
|
+
p(ans)
|
644
|
+
end
|
645
|
+
|
646
|
+
if !true # AskSingleLineD
|
647
|
+
ans = AskSingleLineD.new("Name?", 'help name').answer
|
648
|
+
p(ans)
|
649
|
+
end
|
650
|
+
|
651
|
+
if true # MultiChoiceD
|
652
|
+
ans = multi_choice(['hund', 'katze'], ['help-hund', 'help-katze'])
|
653
|
+
p(ans)
|
654
|
+
end
|
655
|
+
|
656
|
+
if !true # AskMultiLineD
|
657
|
+
ans = AskMultiLineD.new("Name? "*100, 'my help'*30, :title=>"Dialog's Title").answer
|
658
|
+
p(ans)
|
659
|
+
end
|
660
|
+
|
661
|
+
if !true # ChooseDirD
|
662
|
+
ans = ChooseDirD.new().answer
|
663
|
+
p(ans)
|
664
|
+
end
|
665
|
+
|
666
|
+
if !true # SaveFileD
|
667
|
+
ans = SaveFileD.new().answer
|
668
|
+
p(ans)
|
669
|
+
end
|
670
|
+
|
671
|
+
if !true # ChooseDirD
|
672
|
+
ans = ChooseDirD.new().answer
|
673
|
+
p(ans)
|
674
|
+
end
|
675
|
+
|
676
|
+
if !true # OpenFilesD
|
677
|
+
ans = OpenFilesD.new(:help=>'Bitte einen Pfad aussuchen').answer
|
678
|
+
puts "Returned: #{ ans.inspect }"
|
679
|
+
end
|
680
|
+
|
681
|
+
if !true # OpenFileD
|
682
|
+
#ans = OpenFileD.new().path
|
683
|
+
ans = OpenFileD.new(:validate => true).path
|
684
|
+
p(ans)
|
685
|
+
end
|
686
|
+
|
687
|
+
if !true # SaveFileD
|
688
|
+
ans = SaveFileD.new().answer
|
689
|
+
p(ans)
|
690
|
+
end
|
691
|
+
|
692
|
+
# p ask_single_line('frage', 'tja....')
|
693
|
+
|
694
|
+
#p single_choice([ ['choiceStr1',:choice1, :helpStr1], ['choiceStr2',:choice2, :helpStr2]], :returnChoiceAndClient=>false)
|
695
|
+
|
696
|
+
# p multi_choice([ ['choiceStr1',:choice1, :helpStr1], ['choiceStr2',:choice2, :helpStr2]], :returnChoiceAndClient=>true)
|
697
|
+
|
698
|
+
#p choose_dir( 'C:\_Abfall\Thomas' )
|
699
|
+
|
700
|
+
#p open_files( 'C:\_Abfall\Thomas')
|
701
|
+
|
702
|
+
#p open_file( 'C:\_Abfall\Thomas' )
|
703
|
+
|
704
|
+
##/ p save_file( 'C:\_Abfall\Thomas' )
|
705
|
+
|
706
|
+
Tk.mainloop
|
707
|
+
end
|
708
|
+
|
709
|
+
# :mode=ruby:
|
710
|
+
|