canis 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -9
  3. data/CHANGES +3 -0
  4. data/README.md +5 -3
  5. data/examples/alpmenu.rb +9 -5
  6. data/examples/app.sample +2 -2
  7. data/examples/appemail.rb +15 -15
  8. data/examples/atree.rb +7 -7
  9. data/examples/bline.rb +19 -19
  10. data/examples/common/devel.rb +3 -3
  11. data/examples/dbdemo.rb +53 -49
  12. data/examples/dirtree.rb +22 -19
  13. data/examples/newtabbedwindow.rb +5 -5
  14. data/examples/newtesttabp.rb +3 -3
  15. data/examples/tabular.rb +11 -11
  16. data/examples/tasks.rb +25 -25
  17. data/examples/term2.rb +8 -8
  18. data/examples/testbuttons.rb +24 -24
  19. data/examples/testcombo.rb +5 -5
  20. data/examples/testdb.rb +6 -6
  21. data/examples/testfields.rb +16 -16
  22. data/examples/testflowlayout.rb +3 -3
  23. data/examples/testkeypress.rb +5 -5
  24. data/examples/testlistbox.rb +18 -18
  25. data/examples/testlistbox1.rb +17 -17
  26. data/examples/testmessagebox.rb +5 -5
  27. data/examples/testprogress.rb +6 -6
  28. data/examples/testree.rb +3 -3
  29. data/examples/testsplitlayout.rb +4 -4
  30. data/examples/testsplitlayout1.rb +4 -4
  31. data/examples/teststacklayout.rb +4 -4
  32. data/examples/testwsshortcuts.rb +1 -1
  33. data/examples/testwsshortcuts2.rb +4 -4
  34. data/lib/canis/core/include/colorparser.rb +4 -4
  35. data/lib/canis/core/include/io.rb +3 -3
  36. data/lib/canis/core/include/layouts/abstractlayout.rb +3 -3
  37. data/lib/canis/core/include/layouts/flowlayout.rb +2 -2
  38. data/lib/canis/core/include/layouts/stacklayout.rb +3 -3
  39. data/lib/canis/core/system/colormap.rb +3 -3
  40. data/lib/canis/core/system/window.rb +7 -4
  41. data/lib/canis/core/util/extras/padreader.rb +2 -2
  42. data/lib/canis/core/util/rcommandwindow.rb +8 -4
  43. data/lib/canis/core/util/rdialogs.rb +1 -1
  44. data/lib/canis/core/util/widgetshortcuts.rb +9 -2
  45. data/lib/canis/core/widgets/applicationheader.rb +6 -2
  46. data/lib/canis/core/widgets/divider.rb +6 -2
  47. data/lib/canis/core/widgets/rmenu.rb +8 -4
  48. data/lib/canis/core/widgets/rmessagebox.rb +2 -2
  49. data/lib/canis/core/widgets/rwidget.rb +15 -15
  50. data/lib/canis/core/widgets/scrollbar.rb +5 -2
  51. data/lib/canis/core/widgets/table.rb +2 -2
  52. data/lib/canis/core/widgets/textpad.rb +8 -8
  53. data/lib/canis/core/widgets/tree.rb +57 -39
  54. data/lib/canis/core/widgets/tree/treecellrenderer.rb +3 -3
  55. data/lib/canis/version.rb +1 -1
  56. metadata +12 -13
  57. data/lib/canis/core/include/.DS_Store +0 -0
@@ -2,7 +2,7 @@ require 'canis/core/util/app'
2
2
  require 'canis/core/include/appmethods'
3
3
  require 'canis/core/widgets/listbox'
4
4
  require 'canis/core/util/promptmenu'
5
- require './common/devel.rb'
5
+ require_relative './common/devel.rb'
6
6
 
7
7
  def my_help_text
8
8
  <<-eos
@@ -11,17 +11,17 @@ require './common/devel.rb'
11
11
  **Basic Usage**
12
12
 
13
13
  This simple example shows 2 lists inside a "flow". Each takes 50 percent
14
- of the screen's width.
14
+ of the screen's width.
15
15
 
16
16
  If you have brew installed, you can refresh the list to show actual
17
17
  brew packages on your system, using ':r'. Then you can view info, edit,
18
18
  or see the man page for that program.
19
19
 
20
20
  In the second list, you can refresh the list with your gems using ":r".
21
- Place cursor on any gem, and execute any of the ":" commands to see the
21
+ Place cursor on any gem, and execute any of the ":" commands to see the
22
22
  output. "edit" shells out to your EDITOR.
23
23
 
24
- You can try multiple selection using <v> and <V> for range
24
+ You can try multiple selection using <v> and <V> for range
25
25
  select. Check the general help screen for more [[list]] commands. The selections
26
26
  are not mapped to any command.
27
27
 
@@ -34,7 +34,7 @@ require './common/devel.rb'
34
34
 
35
35
 
36
36
  # just a simple test to ensure that rbasiclistbox is running inside a container.
37
- App.new do
37
+ App.new do
38
38
  devel_bindings
39
39
  def disp_menu
40
40
  # ideally this shuld get action_manager and add_action so these are added to widgets actions
@@ -101,12 +101,12 @@ App.new do
101
101
  res = %x[ gem which #{name} ].split("\n")
102
102
  res = res[0]
103
103
  if File.exists? res
104
- require './common/file.rb'
104
+ require_relative './common/file.rb'
105
105
  file_edit res
106
106
  end
107
107
  end
108
108
  #
109
- # general purpose command to catch miscellaneous actions that can be
109
+ # general purpose command to catch miscellaneous actions that can be
110
110
  # executed in the same way. Or even take complex command lines
111
111
  # such as what vim has.
112
112
  def execute_this *cmd
@@ -143,7 +143,7 @@ App.new do
143
143
  colors = Ncurses.COLORS
144
144
  back = :blue
145
145
  back = 234 if colors >= 256
146
- header = app_header "canis #{Canis::VERSION}", :text_center => "Basic List Demo", :text_right =>"New Improved!", :color => :white, :bgcolor => back #, :attr => :bold
146
+ header = app_header "canis #{Canis::VERSION}", :text_center => "Basic List Demo", :text_right =>"New Improved!", :color => :white, :bgcolor => back #, :attr => :bold
147
147
  message "Press F10 to escape from here"
148
148
  #install_help_text my_help_text
149
149
  @form.help_manager.help_text = my_help_text
@@ -163,14 +163,14 @@ App.new do
163
163
 
164
164
  # testing triple bindings, along with a fall-back with only two bindings.
165
165
  @form.bind_key([?\\, ?\\, ?h]){ ht = @form.current_widget.help_text || "No help for this widget"; alert ht }
166
- @form.bind_key([?\\, ?\\, ?H]){ ht = @form.current_widget.help_text || "No help for this widget";
166
+ @form.bind_key([?\\, ?\\, ?H]){ ht = @form.current_widget.help_text || "No help for this widget";
167
167
  str = get_string("Enter help text:", :default => ht);
168
168
  @form.current_widget.help_text = str
169
169
  }
170
170
  @form.bind_key([?\\, ?\\]){ alert "Enter h for seeing helptext on this widget, H for setting it"; }
171
171
 
172
- alist = File.open("data/brew.txt",'r').readlines
173
- list2 = File.open("data/gemlist.txt",'r').readlines
172
+ alist = File.open(File.expand_path("../data/brew.txt", __FILE__),'r').readlines
173
+ list2 = File.open(File.expand_path("../data/gemlist.txt", __FILE__),'r').readlines
174
174
  lb = nil
175
175
 
176
176
  flow :margin_top => 1, :height => FFI::NCurses.LINES-2 do
@@ -178,22 +178,22 @@ App.new do
178
178
  :left_margin => 0, :width_pc => 50, :name => 'lb1', :selection_mode => :single
179
179
  lb.show_selector = false
180
180
  lb.help_text = "Brew packages on your system. Use vim keys to navigate, or : to run a command"
181
-
181
+
182
182
  lb2 = listbox :list => list2, :justify => :left, :title => "[ gems ]", :suppress_borders => false,
183
183
  :left_margin => 0, :width_pc => 50, :name => 'lb2'
184
184
  end
185
-
186
-
185
+
186
+
187
187
  label({:text => "F1 Help, F10 Quit. : for menu. Press F4 and F5 to test popup, v to select", :row => Ncurses.LINES-1, :col => 0, :name => 'lab'})
188
188
 
189
189
  @form.bind(:RESIZE) { resize() }
190
- @form.bind_key(FFI::NCurses::KEY_F4, "Popup") { row = lb.visual_index+lb.row; col=lb.col+lb.current_value.length+1;
191
-
190
+ @form.bind_key(FFI::NCurses::KEY_F4, "Popup") { row = lb.visual_index+lb.row; col=lb.col+lb.current_value.length+1;
191
+
192
192
  row = [row, FFI::NCurses.LINES - 8].min
193
193
  ret = popuplist(%w[ chopin berlioz strauss tchaiko matz beethoven], :row => row, :col => col, :title => "Names", :bgcolor => :blue, :color => :white) ; alert "got #{ret} "}
194
194
 
195
195
  @form.bind_key(FFI::NCurses::KEY_F5, "Popup") { list = %x[ls].split("\n");ret = popuplist(list, :title => "Files"); alert "Got #{ret} #{list[ret]} " }
196
196
 
197
- @form.bind_key(?:, "Menu") { disp_menu;
197
+ @form.bind_key(?:, "Menu") { disp_menu;
198
198
  }
199
199
  end # app
@@ -28,7 +28,7 @@ if $0 == __FILE__
28
28
  when 1
29
29
  require 'canis/core/widgets/listbox'
30
30
  nn = "mylist"
31
- l = Listbox.new nil, :row => 2, :col => 5, :list => %w[john tim lee wong kepler edward why chad andy],
31
+ l = Listbox.new nil, :row => 2, :col => 5, :list => %w[john tim lee wong kepler edward why chad andy],
32
32
  :selection_mode => :multiple, :height => 10, :width => 20 , :selected_color => :green, :selected_bgcolor => :white, :selected_indices => [2,6], :name => nn
33
33
  #default_values %w[ lee why ]
34
34
 
@@ -85,7 +85,7 @@ if $0 == __FILE__
85
85
  button_type :ok
86
86
  end
87
87
  field = mb.widget("user")
88
- field.bind(:ENTER) do |f|
88
+ field.bind(:ENTER) do |f|
89
89
  listconfig = {:bgcolor => :blue, :color => :white,
90
90
  :relative_to => field, :col => field.col + 6, :width => field.width}
91
91
  users= %w[john tim lee wong kepler edward _why chad andy]
@@ -107,7 +107,7 @@ if $0 == __FILE__
107
107
  #listb.bind(:ENTER_ROW) { field.text listb.selected_item }
108
108
  # if you find that cursor goes into listbox while typing, then
109
109
  # i've put set_form_row in listbox list_data_changed
110
- field.bind(:CHANGE) do |f|
110
+ field.bind(:CHANGE) do |f|
111
111
  flist = Dir.glob("*"+f.getvalue+"*")
112
112
  #l.insert( 0, *flist) if flist
113
113
  listb.list flist
@@ -129,8 +129,8 @@ if $0 == __FILE__
129
129
  mb.run
130
130
  $log.debug "MBOX :1selected #{listb}"
131
131
  $log.debug "MBOX :selected #{listb.selected_value}"
132
- end
133
-
132
+ end
133
+
134
134
  end
135
135
  rescue => ex
136
136
  ensure
@@ -20,7 +20,7 @@ if $0 == __FILE__
20
20
  # Initialize curses
21
21
  Canis::start_ncurses # this is initializing colors via ColorMap.setup
22
22
  path = File.join(ENV["LOGDIR"] || "./" ,"canis14.log")
23
- file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
23
+ file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
24
24
  $log = Logger.new(path)
25
25
  $log.level = Logger::DEBUG
26
26
 
@@ -34,16 +34,16 @@ if $0 == __FILE__
34
34
  Label.new @form, {:text => "Old style and modern style progress bars", :row => 12, :col => 10}
35
35
  r = 14; fc = 12;
36
36
 
37
- pbar1 = Progress.new @form, {:width => 20, :row => r, :col => fc,
37
+ pbar1 = Progress.new @form, {:width => 20, :row => r, :col => fc,
38
38
  :name => "pbar1", :style => :old}
39
39
  #:bgcolor => :white, :color => 'red', :name => "pbar1", :style => :old}
40
- pbar = Progress.new @form, {:width => 20, :row => r+2, :col => fc,
40
+ pbar = Progress.new @form, {:width => 20, :row => r+2, :col => fc,
41
41
  :bgcolor => :white, :color => :red, :name => "pbar"}
42
-
42
+
43
43
  pbar.visible false
44
44
  pb = @form.by_name["pbar"]
45
45
  pb.visible true
46
- len = 1
46
+ len = 1
47
47
  ct = (100) * 1.00
48
48
  pb.fraction(len/ct)
49
49
  pbar1.fraction(len/ct)
@@ -61,7 +61,7 @@ if $0 == __FILE__
61
61
  # this is so there's no wait for a key, i want demo to proceed without key press, but
62
62
  # respond if there is one
63
63
  Ncurses::nodelay(@window.get_window, bf = true)
64
-
64
+
65
65
  # sleep seconds between refresh of progress
66
66
  slp = 0.1
67
67
  ##while((ch = @window.getchar()) != FFI::NCurses::KEY_F10 )
@@ -8,11 +8,11 @@ class Tester
8
8
  acolor = $reversecolor
9
9
  end
10
10
  def run
11
- @window = Canis::Window.root_window
11
+ @window = Canis::Window.root_window
12
12
  @form = Form.new @window
13
13
 
14
14
  h = 20; w = 75; t = 3; l = 4
15
- #$choice = 1
15
+ #$choice = 1
16
16
  case $choice
17
17
  when 1
18
18
  root = TreeNode.new "ROOT"
@@ -29,7 +29,7 @@ class Tester
29
29
  leaf1 << "leaf11"
30
30
  leaf1 << "leaf12"
31
31
 
32
- root.add "blocky", true do
32
+ root.add "blocky", true do
33
33
  add "block2"
34
34
  add "block3" do
35
35
  add "block31"
@@ -1,6 +1,6 @@
1
1
  # ----------------------------------------------------------------------------- #
2
- # File: testsplitlayout.rb
3
- # Description:
2
+ # File: testsplitlayout.rb
3
+ # Description:
4
4
  # Author: j kepler http://github.com/mare-imbrium/canis/
5
5
  # Date: 2014-05-09 - 20:24
6
6
  # License: MIT
@@ -19,7 +19,7 @@ if __FILE__ == $PROGRAM_NAME
19
19
  lb1 = Listbox.new @form, :list => ["bach","beethoven","mozart","gorecki", "chopin","wagner","grieg","holst"] , :name => "mylist1"
20
20
 
21
21
 
22
- alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
22
+ alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
23
23
  str = "Hello, people of Earth.\nI am HAL, a textbox.\nUse arrow keys, j/k/h/l/gg/G/C-a/C-e/C-n/C-p\n"
24
24
  str << alist.join("\n")
25
25
  tv = TextPad.new @form, :name => "text", :text => str.split("\n")
@@ -50,4 +50,4 @@ if __FILE__ == $PROGRAM_NAME
50
50
 
51
51
  st = status_line :row => -1
52
52
  end # app
53
- end # if
53
+ end # if
@@ -1,6 +1,6 @@
1
1
  # ----------------------------------------------------------------------------- #
2
- # File: testsplitlayout.rb
3
- # Description:
2
+ # File: testsplitlayout.rb
3
+ # Description:
4
4
  # Author: j kepler http://github.com/mare-imbrium/canis/
5
5
  # Date: 2014-05-09 - 20:24
6
6
  # License: MIT
@@ -19,7 +19,7 @@ if __FILE__ == $PROGRAM_NAME
19
19
  lb1 = Listbox.new @form, :list => ["bach","beethoven","mozart","gorecki", "chopin","wagner","grieg","holst"] , :name => "mylist1"
20
20
 
21
21
 
22
- alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
22
+ alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
23
23
  str = "Hello, people of Earth.\nI am HAL, a textbox.\nUse arrow keys, j/k/h/l/gg/G/C-a/C-e/C-n/C-p\n"
24
24
  str << alist.join("\n")
25
25
  tv = TextPad.new @form, :name => "text", :text => str.split("\n")
@@ -46,4 +46,4 @@ if __FILE__ == $PROGRAM_NAME
46
46
 
47
47
  st = status_line :row => -1
48
48
  end # app
49
- end # if
49
+ end # if
@@ -1,7 +1,7 @@
1
1
  # #!/usr/bin/env ruby -w
2
2
  # ----------------------------------------------------------------------------- #
3
3
  # File: teststacklayout.rb
4
- # Description:
4
+ # Description:
5
5
  # Author: j kepler http://github.com/mare-imbrium/canis/
6
6
  # Date: 2014-05-08 - 23:34
7
7
  # License: MIT
@@ -15,7 +15,7 @@ if __FILE__ == $PROGRAM_NAME
15
15
  App.new do
16
16
 
17
17
 
18
- @form.bind_key(FFI::NCurses::KEY_F3,'view log') {
18
+ @form.bind_key(FFI::NCurses::KEY_F3,'view log') {
19
19
  require 'canis/core/util/viewer'
20
20
  Canis::Viewer.view("canis14.log", :close_key => KEY_ENTER, :title => "<Enter> to close")
21
21
  }
@@ -26,7 +26,7 @@ if __FILE__ == $PROGRAM_NAME
26
26
  lb2 = Listbox.new @form, :list => `gem list --local`.split("\n") , :name => "mylist2"
27
27
  =begin
28
28
 
29
- alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
29
+ alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
30
30
  str = "Hello, people of Earth.\nI am HAL, a textbox.\nUse arrow keys, j/k/h/l/gg/G/C-a/C-e/C-n/C-p\n"
31
31
  str << alist.join("\n")
32
32
  tv = TextPad.new @form, :name => "text", :text => str.split("\n")
@@ -45,4 +45,4 @@ if __FILE__ == $PROGRAM_NAME
45
45
 
46
46
  st = status_line :row => -1
47
47
  end # app
48
- end # if
48
+ end # if
@@ -49,7 +49,7 @@ if $0 == __FILE__
49
49
  # XXX update with new color and kb
50
50
  Canis::start_ncurses # this is initializing colors via ColorMap.setup
51
51
  path = File.join(ENV["LOGDIR"] || "./" ,"canis14.log")
52
- file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
52
+ file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
53
53
  $log = Logger.new(path)
54
54
  $log.level = Logger::DEBUG
55
55
  catch(:close) do
@@ -35,7 +35,7 @@ class SetupMessagebox
35
35
  field :label => "%15s" % ["Address: "], :width => 15, :attr => :reverse
36
36
  blank
37
37
  check :text => "Using version control", :value => true, :onvalue => "yes", :offvalue => "no" do |eve|
38
- unless eve.item.value
38
+ unless eve.item.value
39
39
  alert "NO VC! We need to talk"
40
40
  end
41
41
  end
@@ -53,7 +53,7 @@ class SetupMessagebox
53
53
  radio :text => "Window", :value => "Win", :group => :os
54
54
  blank
55
55
  flow :item_width => 15 do
56
- button :text => "Install" do
56
+ button :text => "Install" do
57
57
  # you can avoid this by giving the radio buttons your own Variable (see test2.rb)
58
58
  choice = @variables[:os].value
59
59
  case choice
@@ -72,7 +72,7 @@ class SetupMessagebox
72
72
  end
73
73
  end # flow
74
74
  #button :text => "Execute"
75
- text = [" #[reverse]Unix Philosophy #[end] ",
75
+ text = [" #[reverse]Unix Philosophy #[end] ",
76
76
  "#[fg=green, underline]Eric Raymond#[end] in his book, #[fg=green, underline]The Art of Unix Programming#[end] summarized the Unix philosophy.",
77
77
  " ",
78
78
  "Rule of #[fg=yellow]Modularity#[end]: Write simple parts connected by clean interfaces.",
@@ -91,7 +91,7 @@ class SetupMessagebox
91
91
  #t.formatted_text(text, :tmux)
92
92
  t.text(text, :content_type => :tmux)
93
93
  t1 = textview :title => 'ansi formatted document'
94
- text = File.open("data/color.2","r").readlines
94
+ text = File.open(File.expand_path("../data/color.2", __FILE__),"r").readlines
95
95
  #text = `ri -f bs String`.split("\n")
96
96
  #t1.formatted_text(text, :ansi)
97
97
  t1.text(text, :content_type => :ansi)
@@ -5,7 +5,7 @@
5
5
  # Author: jkepler http://github.com/mare-imbrium/canis/
6
6
  # Date: 07.11.11 - 12:31
7
7
  # Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
8
- # Last update: 2014-09-11 19:51
8
+ # Last update: 2017-03-09 23:13
9
9
  # ------------------------------------------------------------ #
10
10
  #
11
11
 
@@ -178,9 +178,9 @@ module Canis
178
178
  # NOTE: tested with pad only. Not with window.
179
179
  # Moved from textpad, this is the one method textpad is to call.
180
180
  # @param [Pad] pad on which to print
181
- # @param [Fixnum] lineno to print (zero-based)
182
- # @param [Fixnum] column to start printing on, usually 0
183
- # @param [Fixnum] width of pad, usually @content_cols
181
+ # @param [Integer] lineno to print (zero-based)
182
+ # @param [Integer] column to start printing on, usually 0
183
+ # @param [Integer] width of pad, usually @content_cols
184
184
  # @param [color_pair] colorpair of textpad or widget
185
185
  # @param [attr] attr of textpad or widget
186
186
  def print pad, lineno, col, width, color_pair, attr
@@ -183,7 +183,7 @@ module Canis
183
183
  # unlike rb_gets allows user to enter control or alt or function character too.
184
184
  # @param [String] prompt or label to show.
185
185
  # @param [Hash] configuration such as default or regexp for validation
186
- # @return [Fixnum] nil if canceled, or ret value of getchar which is numeric
186
+ # @return [Integer] nil if canceled, or ret value of getchar which is numeric
187
187
  # If default provided, then ENTER returns the default
188
188
  def rb_getchar(prompt, config={}) # yield field
189
189
  begin
@@ -238,7 +238,7 @@ module Canis
238
238
  # Prompt user for a file name, allowing him to tab to complete filenames
239
239
  # @see #choose_file from rcommandwindow.rb
240
240
  # @param [String] label to print before field
241
- # @param [Fixnum] max length of field
241
+ # @param [Integer] max length of field
242
242
  # @return [String] filename or blank if user cancelled
243
243
  def get_file prompt, config={} #:nodoc:
244
244
  maxlen = 70
@@ -294,7 +294,7 @@ module Canis
294
294
  # The first 3 params are no longer required since we create a window
295
295
  # of our own.
296
296
  # @param [String] prompt - label to show
297
- # @param [Fixnum] maxlen - max length of input
297
+ # @param [Integer] maxlen - max length of input
298
298
  # @param [Hash] config - :default, :width of Field, :help_text, :tab_completion
299
299
  # help_text is displayed on F1
300
300
  # tab_completion is a proc which helps to complete user input
@@ -4,7 +4,7 @@
4
4
  # Author: j kepler http://github.com/mare-imbrium/canis/
5
5
  # Date: 2014-05-09 - 17:15
6
6
  # License: MIT
7
- # Last update: 2014-05-09 20:38
7
+ # Last update: 2017-03-09 23:13
8
8
  # ----------------------------------------------------------------------------- #
9
9
  # abstractlayout.rb Copyright (C) 2012-2014 j kepler
10
10
 
@@ -87,7 +87,7 @@ class AbstractLayout
87
87
 
88
88
 
89
89
  # Add a component, giving a weightage for height
90
- # @param [Fixnum, Float] give absolute weight, or fraction of layouts height
90
+ # @param [Integer, Float] give absolute weight, or fraction of layouts height
91
91
  # if wt is >= 1 then it is absolute height, else if between 0 and 1 ,
92
92
  # it is a percentage.
93
93
  def add_with_weight item, weight
@@ -183,7 +183,7 @@ class AbstractLayout
183
183
  e.col = c
184
184
  wt = @wts[e]
185
185
  if wt
186
- if wt.is_a? Fixnum
186
+ if wt.is_a? Integer
187
187
  e.height = wt
188
188
  elsif wt.is_a? Float
189
189
  e.height = (wt * balance_ht).floor
@@ -4,7 +4,7 @@
4
4
  # Author: j kepler http://github.com/mare-imbrium/canis/
5
5
  # Date: 2014-05-08 - 18:33
6
6
  # License: MIT
7
- # Last update: 2014-05-09 20:58
7
+ # Last update: 2017-03-09 23:13
8
8
  # ----------------------------------------------------------------------------- #
9
9
  # stacklayout.rb Copyright (C) 2012-2014 j kepler
10
10
  require 'canis/core/include/layouts/abstractlayout'
@@ -74,7 +74,7 @@ class FlowLayout < AbstractLayout
74
74
  e.col = c
75
75
  wt = cget(e, :weight)
76
76
  if wt
77
- if wt.is_a? Fixnum
77
+ if wt.is_a? Integer
78
78
  e.width = wt
79
79
  elsif wt.is_a? Float
80
80
  e.width = (wt * balance_ht).floor
@@ -4,7 +4,7 @@
4
4
  # Author: j kepler http://github.com/mare-imbrium/canis/
5
5
  # Date: 2014-05-08 - 18:33
6
6
  # License: MIT
7
- # Last update: 2014-05-09 19:58
7
+ # Last update: 2017-03-09 23:14
8
8
  # ----------------------------------------------------------------------------- #
9
9
  # stacklayout.rb Copyright (C) 2012-2014 j kepler
10
10
  require 'canis/core/include/layouts/abstractlayout'
@@ -26,7 +26,7 @@ class StackLayout < AbstractLayout
26
26
  # send in the widget and its weightage.
27
27
  #
28
28
  # @param [Widget] widget whose weightage is to be specified
29
- # @param [Float, Fixnum] weightage for the given widget (@see add_with_weight)
29
+ # @param [Float, Integer] weightage for the given widget (@see add_with_weight)
30
30
  def weightage item, wt
31
31
  @wts[item] = wt
32
32
  end
@@ -79,7 +79,7 @@ class StackLayout < AbstractLayout
79
79
  e.col = c
80
80
  wt = @wts[e]
81
81
  if wt
82
- if wt.is_a? Fixnum
82
+ if wt.is_a? Integer
83
83
  e.height = wt
84
84
  elsif wt.is_a? Float
85
85
  e.height = (wt * balance_ht).floor