tkxxs 0.1.2 → 0.1.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTNlZTU3NjY4YTQ5ZWMxYmFjOTM5YjlkZDhjYWM3ZmNkODA1MTM5Yw==
4
+ N2U1NDRhZmZhOTAyMmUyNGE1MmI0NWUyMzQ5NTUzMzBlYTViMDg1MQ==
5
5
  data.tar.gz: !binary |-
6
- ZDBjMDA2MmEyODBjNzA4OWIwODdmMmJhNzNlMDc5ZTNkM2MwOWI0NQ==
6
+ NDJiZTI3NzczNTE2NmQ5OTA0MzFkOTJjZjExNzMyMjZhYzA3N2NjMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2ViN2EwY2ZkMTU1MGE1ZTI1NmI0NGQ1ZmZhZDkyMTcyNTY0OTJlOGEwMGQ3
10
- NzVlMGE1Zjk1OTBhNzVkYjkxYzkxNjBlOWQ5MjAzYjFjYTBlMjAxMmQ2NzM4
11
- NzNhZDhhYThiMzc2MzY0MzllNDhjZTAzMWRkMDVlOGNlNGVhOTE=
9
+ MTQ5MWI3NjE3ZmY5YThjMWNmYzhjNzE5ODBkOThlODkxYzNlOTcxMDk4NGQz
10
+ NmNjNmU3NWFkN2YxYTY2ZGQ0YTExOGY0ZWZjNjNkNjk0MmQ5ZTk4ZDVlMjcy
11
+ ZDViZDk1ZTFiZTIzNDI5OGU5NmI5MzFjYjQwZTUyMjFlYWI5ZjQ=
12
12
  data.tar.gz: !binary |-
13
- NTIwNGVjYThkZDdiODljYmZmMjQxMTI2ZmNkMDYxZmVkMzZkYzIzZmE0ZGYz
14
- Y2U1NjEwMmZmYjYzMDkwMjZlZTFjMGQ3ZGQxNjYzZTdiYWEzYzJmMDU2YjEz
15
- YWI4NTBhMTRlYzU3ODgzY2RiMDBhYmYyYzU5ZmM0ZWY3MmZhZGE=
13
+ MTUwNDU3ZGVkZjQwZDZlYzIxMmE5OTFmNDA1OWVhOTI4MTY4ZTY2MzY3OTM3
14
+ ZDFjMDIzZGZmNGYwN2VlM2ZmZTM5OThiMmQ4MWFlZGVjY2I4NjFhZmFlYjE3
15
+ ZjQ3OTVmZjg3NmUzZjc0YWE3NWY5NWJmNzljOGM2ZjljYzU2ZmQ=
@@ -1,3 +1,10 @@
1
+ === 0.1.3 / 2013-01-06
2
+
3
+ * Implemented OutW#p and OutW#prinf. (Many thanks to Abinoam P. Marques Jr.)
4
+ * Improved .gitignore and .gitattributes. (Abinoam P. Marques Jr., too)
5
+ * Added example. (Abinoam P. Marques Jr.)
6
+ * Fixed rakefile
7
+
1
8
  === 0.1.2 / 2013-01-05
2
9
 
3
10
  * Made it work on Ubuntu (Many thanks to Abinoam P. Marques Jr.)
@@ -17,4 +17,5 @@ lib/tkxxs/version.rb
17
17
  rdoc_developers_hanna.bat
18
18
  rdoc_users_hanna.bat
19
19
  samples/big_example.rb
20
+ samples/output_example.rb
20
21
  samples/small_example.rb
data/Rakefile CHANGED
@@ -30,8 +30,9 @@ Hoe.spec "tkxxs" do
30
30
 
31
31
 
32
32
  ary.push "-x", "lib/tkxxs/tkxxs_classes.rb"
33
- ary.push "-x", "lib/tkxxs/samples"
34
33
  ary.push "-x", "lib/tkxxs/conf.rb"
34
+ ary.push "-x", "samples"
35
+ ary.push "-x", "ext"
35
36
  end
36
37
 
37
38
  dependency "Platform", "~> 0.4.0"
@@ -14,6 +14,7 @@ require 'tkxxs/conf'
14
14
  require 'tk'
15
15
  require 'tkextlib/tile'
16
16
  require( File.dirname(DIR_OF_TKXXS) + '/ext/tkballoonhelp.rb' )
17
+ require 'stringio'
17
18
  ##/ ##require 'tkrbwidget/tkballoonhelp/tkballoonhelp.rb'
18
19
  ##/ ##require 'ext/tkballoonhelp/tkballoonhelp.rb'
19
20
  ##/ if $0 == __FILE__
@@ -118,46 +119,51 @@ module TKXXS
118
119
  @tagSel.add('0.0', :end)
119
120
  Kernel.raise TkCallbackBreak
120
121
  }
122
+ @tkxxs_buffer = StringIO.new
121
123
 
122
124
  end # initialize
123
-
125
+
126
+ def output_with(method, tag, *args)
127
+ @tkxxs_buffer.reopen
128
+ @tkxxs_buffer.send(method, *args)
129
+ self.insert(:end, @tkxxs_buffer.string, tag)
130
+ self.see :end
131
+ end
132
+
124
133
  ##################################################################
125
134
  # Like Kernel::puts. Write a String to the Output Window.
126
135
  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?
136
+ output_with(:puts, nil, *args)
132
137
  end # puts
133
138
 
134
139
  ##################################################################
135
140
  # puts, formated as heading level 2
136
- def puts_h2( str )
137
- self.insert(:end, "\n" + str.chomp("\n") + "\n", @tagH2)
141
+ def puts_h2( *args )
142
+ output_with(:puts, @tagH2, *args)
138
143
  end # puts_h2
139
144
 
140
145
  ##################################################################
141
146
  # Like Kernel::print. Print a String to the Output Window.
142
147
  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?
148
+ output_with(:print, nil, *args)
151
149
  end # print
152
-
153
- # TODO def p()
150
+
151
+ ##################################################################
152
+ # Like Kernel::p. For each object, directly writes obj.inspect
153
+ # followed by a newline to the program's standard output.
154
+ def p( arg )
155
+ output_with(:puts, nil, arg.inspect)
156
+ end # p
157
+
158
+ ##################################################################
159
+ # Like Kernel::printf. Print object based on given format string.
160
+ def printf( *args )
161
+ output_with(:printf, nil, *args)
162
+ end # printf
154
163
 
155
164
  # :nodoc:
156
165
  def write( str )
157
- ##self.insert(:end, "\n" + str)
158
- self.insert(:end, str)
159
- self.see :end
160
- ##/ self.update # N�tig?
166
+ output_with(:write, nil, str)
161
167
  end # write
162
168
 
163
169
  ##########################################################################
@@ -1,4 +1,4 @@
1
1
  module TKXXS
2
2
 
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
@@ -30,6 +30,7 @@ class MyTinyUI
30
30
 
31
31
  def explain_puts( )
32
32
  @outW.puts "'puts' writes to the Output Window."
33
+ puts "And this is from Kernel.puts (redirected stdout)."
33
34
 
34
35
  @outW.puts_h2 "@outW.puts_h2 writes formated text to the Output Window"
35
36
 
@@ -0,0 +1,24 @@
1
+ begin
2
+ require 'tkxxs'
3
+ rescue LoadError
4
+ require( File.dirname( File.dirname(__FILE__)) +'/lib/tkxxs')
5
+ end
6
+ include TKXXS
7
+
8
+ class MyTinyUI
9
+
10
+ def initialize( )
11
+ @outW = OutW.new # create Output Window
12
+ @outW.puts_h2 "Output methods demonstration: puts, puts_h2, p, printf and write"
13
+ @outW.puts "This is a call to OutW#puts with", "two strings and an array", [1, 2, 3]
14
+ @outW.puts_h2 "This is a call to OutW#puts_h2 with", "two strings and an array", [1, 2, 3]
15
+ @outW.p "This is a call to OutW#p with a string. And next line will be an array"
16
+ @outW.p [1, 2, 3]
17
+ @outW.printf "%s => %010.3f\n", "This is a call to OutW#printf with Math::PI and \"%s %010.3f\" as formatting string", Math::PI
18
+ @outW.write "This is a call to OutW#write, with one string"
19
+
20
+ Tk.mainloop # You always needs this!
21
+ end # initialize
22
+ end
23
+
24
+ MyTinyUI.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkxxs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Axel Friedrich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-05 00:00:00.000000000 Z
11
+ date: 2014-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: Platform
@@ -116,6 +116,7 @@ files:
116
116
  - rdoc_developers_hanna.bat
117
117
  - rdoc_users_hanna.bat
118
118
  - samples/big_example.rb
119
+ - samples/output_example.rb
119
120
  - samples/small_example.rb
120
121
  homepage: https://github.com/Axel2/tkxxs
121
122
  licenses:
@@ -128,9 +129,11 @@ rdoc_options:
128
129
  - -x
129
130
  - lib/tkxxs/tkxxs_classes.rb
130
131
  - -x
131
- - lib/tkxxs/samples
132
- - -x
133
132
  - lib/tkxxs/conf.rb
133
+ - -x
134
+ - samples
135
+ - -x
136
+ - ext
134
137
  require_paths:
135
138
  - lib
136
139
  required_ruby_version: !ruby/object:Gem::Requirement