rbhex-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/CHANGELOG +2000 -0
  4. data/LICENSE +56 -0
  5. data/README.md +44 -0
  6. data/examples/abasiclist.rb +179 -0
  7. data/examples/alpmenu.rb +50 -0
  8. data/examples/app.sample +19 -0
  9. data/examples/atree.rb +100 -0
  10. data/examples/bline.rb +136 -0
  11. data/examples/common/file.rb +45 -0
  12. data/examples/data/README.markdown +9 -0
  13. data/examples/data/brew.txt +38 -0
  14. data/examples/data/color.2 +37 -0
  15. data/examples/data/gemlist.txt +60 -0
  16. data/examples/data/lotr.txt +12 -0
  17. data/examples/data/ports.txt +136 -0
  18. data/examples/data/table.txt +37 -0
  19. data/examples/data/tasks.csv +88 -0
  20. data/examples/data/tasks.txt +27 -0
  21. data/examples/data/todo.txt +10 -0
  22. data/examples/data/todo.txt.bak +10 -0
  23. data/examples/data/todocsv.csv +28 -0
  24. data/examples/data/unix1.txt +21 -0
  25. data/examples/data/unix2.txt +11 -0
  26. data/examples/dbdemo.rb +502 -0
  27. data/examples/dirtree.rb +94 -0
  28. data/examples/newtabbedwindow.rb +100 -0
  29. data/examples/newtesttabp.rb +92 -0
  30. data/examples/tabular.rb +146 -0
  31. data/examples/tasks.rb +178 -0
  32. data/examples/term2.rb +84 -0
  33. data/examples/testbuttons.rb +296 -0
  34. data/examples/testcombo.rb +102 -0
  35. data/examples/testfields.rb +195 -0
  36. data/examples/testkeypress.rb +72 -0
  37. data/examples/testlistbox.rb +170 -0
  38. data/examples/testmessagebox.rb +140 -0
  39. data/examples/testprogress.rb +116 -0
  40. data/examples/testree.rb +106 -0
  41. data/examples/testwsshortcuts.rb +66 -0
  42. data/examples/testwsshortcuts2.rb +128 -0
  43. data/lib/rbhex.rb +6 -0
  44. data/lib/rbhex/core/docs/index.txt +73 -0
  45. data/lib/rbhex/core/include/action.rb +80 -0
  46. data/lib/rbhex/core/include/actionmanager.rb +49 -0
  47. data/lib/rbhex/core/include/appmethods.rb +214 -0
  48. data/lib/rbhex/core/include/bordertitle.rb +48 -0
  49. data/lib/rbhex/core/include/chunk.rb +203 -0
  50. data/lib/rbhex/core/include/io.rb +553 -0
  51. data/lib/rbhex/core/include/listbindings.rb +74 -0
  52. data/lib/rbhex/core/include/listcellrenderer.rb +140 -0
  53. data/lib/rbhex/core/include/listeditable.rb +317 -0
  54. data/lib/rbhex/core/include/listscrollable.rb +663 -0
  55. data/lib/rbhex/core/include/listselectable.rb +271 -0
  56. data/lib/rbhex/core/include/multibuffer.rb +83 -0
  57. data/lib/rbhex/core/include/orderedhash.rb +77 -0
  58. data/lib/rbhex/core/include/ractionevent.rb +73 -0
  59. data/lib/rbhex/core/include/rchangeevent.rb +27 -0
  60. data/lib/rbhex/core/include/rhistory.rb +95 -0
  61. data/lib/rbhex/core/include/rinputdataevent.rb +47 -0
  62. data/lib/rbhex/core/include/vieditable.rb +172 -0
  63. data/lib/rbhex/core/include/widgetmenu.rb +66 -0
  64. data/lib/rbhex/core/system/colormap.rb +165 -0
  65. data/lib/rbhex/core/system/keyboard.rb +150 -0
  66. data/lib/rbhex/core/system/keydefs.rb +30 -0
  67. data/lib/rbhex/core/system/ncurses.rb +236 -0
  68. data/lib/rbhex/core/system/panel.rb +162 -0
  69. data/lib/rbhex/core/system/window.rb +913 -0
  70. data/lib/rbhex/core/util/ansiparser.rb +119 -0
  71. data/lib/rbhex/core/util/app.rb +1228 -0
  72. data/lib/rbhex/core/util/basestack.rb +410 -0
  73. data/lib/rbhex/core/util/bottomline.rb +1859 -0
  74. data/lib/rbhex/core/util/colorparser.rb +77 -0
  75. data/lib/rbhex/core/util/focusmanager.rb +31 -0
  76. data/lib/rbhex/core/util/padreader.rb +192 -0
  77. data/lib/rbhex/core/util/rcommandwindow.rb +604 -0
  78. data/lib/rbhex/core/util/rdialogs.rb +574 -0
  79. data/lib/rbhex/core/util/viewer.rb +149 -0
  80. data/lib/rbhex/core/util/widgetshortcuts.rb +506 -0
  81. data/lib/rbhex/core/version.rb +5 -0
  82. data/lib/rbhex/core/widgets/applicationheader.rb +103 -0
  83. data/lib/rbhex/core/widgets/box.rb +58 -0
  84. data/lib/rbhex/core/widgets/divider.rb +310 -0
  85. data/lib/rbhex/core/widgets/keylabelprinter.rb +194 -0
  86. data/lib/rbhex/core/widgets/rcombo.rb +253 -0
  87. data/lib/rbhex/core/widgets/rcontainer.rb +415 -0
  88. data/lib/rbhex/core/widgets/rlink.rb +30 -0
  89. data/lib/rbhex/core/widgets/rlist.rb +696 -0
  90. data/lib/rbhex/core/widgets/rmenu.rb +958 -0
  91. data/lib/rbhex/core/widgets/rmenulink.rb +22 -0
  92. data/lib/rbhex/core/widgets/rmessagebox.rb +387 -0
  93. data/lib/rbhex/core/widgets/rprogress.rb +118 -0
  94. data/lib/rbhex/core/widgets/rtabbedpane.rb +634 -0
  95. data/lib/rbhex/core/widgets/rtabbedwindow.rb +70 -0
  96. data/lib/rbhex/core/widgets/rtextarea.rb +960 -0
  97. data/lib/rbhex/core/widgets/rtextview.rb +739 -0
  98. data/lib/rbhex/core/widgets/rtree.rb +768 -0
  99. data/lib/rbhex/core/widgets/rwidget.rb +3277 -0
  100. data/lib/rbhex/core/widgets/scrollbar.rb +143 -0
  101. data/lib/rbhex/core/widgets/statusline.rb +113 -0
  102. data/lib/rbhex/core/widgets/tabular.rb +264 -0
  103. data/lib/rbhex/core/widgets/tabularwidget.rb +1142 -0
  104. data/lib/rbhex/core/widgets/textpad.rb +995 -0
  105. data/lib/rbhex/core/widgets/tree/treecellrenderer.rb +150 -0
  106. data/lib/rbhex/core/widgets/tree/treemodel.rb +428 -0
  107. data/rbhex-core.gemspec +32 -0
  108. metadata +172 -0
data/LICENSE ADDED
@@ -0,0 +1,56 @@
1
+ rbhex is a continuation of rbcurse, (c) rkumar, 2008-2013.
2
+ You may redistribute and/or modify this software under either the terms of the
3
+ 2-clause BSDL or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # rbhex-core
2
+
3
+ Contains core widgets and infrastructure of rbhex ncurses toolkit. rbhex helps to easily build
4
+ ncurses applications for text terminals.
5
+
6
+ rbhex-core contains basic widgets for constructing command line applications with ncurses. These include:
7
+
8
+ * field
9
+
10
+ * buttons - checkbox, radio, toggle
11
+
12
+ * list
13
+
14
+ * textview
15
+
16
+ * dialogs and popup
17
+
18
+ * table
19
+
20
+ * menu
21
+
22
+ * tabbedpane
23
+
24
+ * tree
25
+
26
+ * application header
27
+
28
+ * status line
29
+
30
+ ## Install
31
+
32
+ `gem install rbhex-core`
33
+
34
+ ## Documentation
35
+
36
+ In short, there isn't any - nor are there any plans to create any. The `/examples` directory
37
+ contains many examples and should provide a nice start for you. Otherwise, the [tutorial for
38
+ rbcurse](https://github.com/rkumar/rbcurse-tutorial) is still mostly valid for the majority of this
39
+ codebase.
40
+
41
+ ## rbcurse
42
+
43
+ This project is a continuation/fork of [rkumar](https://github.com/rkumar)'s [rbcurse](https://github.com/rkumar/rbcurse-core).
44
+ rbcurse is no longer maintained as of March 2014.
@@ -0,0 +1,179 @@
1
+ require 'rbhex/core/util/app'
2
+ require 'rbhex/core/include/appmethods'
3
+ require 'rbhex/core/widgets/rlist'
4
+
5
+ def my_help_text
6
+ <<-eos
7
+ abasiclist.rb
8
+ =========================================================================
9
+ Basic Usage
10
+
11
+ This simple example shows 2 lists inside a "flow". Each takes 50 percent
12
+ of the screen's width.
13
+
14
+ If you have brew installed, you can refresh the list to show actual
15
+ brew packages on your system, using ':r'. Then you can view info, edit,
16
+ or see the man page for that program.
17
+
18
+ In the second list, you can refresh the list with your gems using ":r".
19
+ Place cursor on any gem, and execute any of the ":" commands to see the
20
+ output. "edit" shells out to your EDITOR.
21
+
22
+ You can try multiple selection using <space> and <ctrl-space> for range
23
+ select. Check the general help screen for more _list_ commands. The selections
24
+ are not mapped to any command.
25
+
26
+ =========================================================================
27
+ :n or Alt-n for next buffer. 'q' to quit.
28
+
29
+ eos
30
+ end
31
+
32
+
33
+
34
+ # just a simple test to ensure that rbasiclistbox is running inside a container.
35
+ App.new do
36
+ def disp_menu
37
+ # ideally this shuld get action_manager and add_action so these are added to widgets actions
38
+ f = @form.get_current_field
39
+
40
+ if f.name == "lb1"
41
+ menu = PromptMenu.new self do
42
+ item :r, :refresh
43
+ item :i, :info
44
+ item :m, :brew_man
45
+ item :e, :edit
46
+ end
47
+ else
48
+ menu = PromptMenu.new self do
49
+ item :r, :refresh
50
+ item :e, :edit
51
+ item :d, :dependency
52
+ item :s, :specification
53
+ item :w, :which
54
+ end
55
+ end
56
+ menu.display_new :title => "Menu"
57
+ end
58
+ # fill list with actual gems available on your system
59
+ def refresh
60
+ f = @form.get_current_field
61
+ if f.name == "lb2"
62
+ l = %x[gem list --local].split("\n")
63
+ w = @form.by_name['lb2']
64
+ w.list l
65
+ else
66
+ l = %x[brew list].split("\n")
67
+ w = @form.by_name['lb1']
68
+ w.list l
69
+ end
70
+ end
71
+ def specification
72
+ w = @form.by_name['lb2']
73
+ name = w.text.split()[0]
74
+ textdialog(%x[ gem specification #{name} ].split("\n") , :title => 'Specification')
75
+ end
76
+
77
+ # execute just man for the brew package
78
+ def brew_man
79
+ w = @form.by_name['lb1']
80
+ name = w.text.split()[0]
81
+ shell_out "man #{name}"
82
+ end
83
+
84
+ # using gem which to get path, and then shelling out to EDITOR
85
+ def edit
86
+ f = @form.get_current_field
87
+ if f.name == "lb2"
88
+ name = f.text.split()[0]
89
+ shell_out "gem edit #{name}"
90
+ else
91
+ name = f.text.split()[0]
92
+ shell_out "brew edit #{name}"
93
+ end
94
+ return
95
+
96
+ # this is our own home-cooked version which opens the actual file in your editor
97
+ res = %x[ gem which #{name} ].split("\n")
98
+ res = res[0]
99
+ if File.exists? res
100
+ require './common/file.rb'
101
+ file_edit res
102
+ end
103
+ end
104
+ #
105
+ # general purpose command to catch miscellaneous actions that can be
106
+ # executed in the same way. Or even take complex command lines
107
+ # such as what vim has.
108
+ def execute_this *cmd
109
+ f = @form.get_current_field
110
+ if f.name == "lb2"
111
+ m = "gem"
112
+ else
113
+ m = "brew"
114
+ end
115
+ w = f
116
+ name = w.text.split()[0]
117
+ cmd = cmd[0].to_s
118
+ res = %x[ #{m} #{cmd} #{name}].split("\n")
119
+ res ||= "Error in command [#{cmd}] [#{name}] "
120
+ textdialog( res, :title => cmd ) if res
121
+ end
122
+ # handle resizing, sadly I am not sure flow and stack can do a resize, i am sure the xperimental one can.
123
+ def resize
124
+ lb1 = @form.by_name["lb1"]
125
+ lb2 = @form.by_name["lb2"]
126
+ maxc = Ncurses.COLS
127
+ maxr = Ncurses.LINES
128
+ lb1.height = maxr-2
129
+ lb2.height = maxr-2
130
+ lb1.width = ((lb1.width_pc * maxc) / 100).floor
131
+ lb2.width = ((lb2.width_pc * maxc) / 100).floor
132
+ lb2.col = lb1.col + lb1.width
133
+ lab = @form.by_name["lab"]
134
+ lab.row = maxr-1
135
+ end
136
+
137
+ colors = Ncurses.COLORS
138
+ back = :blue
139
+ back = 234 if colors >= 256
140
+ header = app_header "rbhex #{Rbhex::Core::VERSION}", :text_center => "Basic List Demo", :text_right =>"New Improved!", :color => :white, :bgcolor => back #, :attr => :bold
141
+ message "Press F10 to escape from here"
142
+ #install_help_text my_help_text
143
+ @form.help_manager.help_text = my_help_text
144
+
145
+ @form.define_prefix_command :csmap, :scope => self
146
+ #@form.define_key(:csmap, "r", 'refresh') { refresh }
147
+ @form.define_key(:csmap, "r", 'refresh', :refresh )
148
+ @form.define_key(:csmap, "s", 'specification') { specification }
149
+ @form.bind_key ?\C-s, :csmap
150
+ #pm = PrefixCommand.new :csmap, self do |p|
151
+ #p.key("r", 'refresh', :refresh )
152
+ #p.key("s", 'specification'){ specification }
153
+ #end
154
+ #@form.bind_key(?\C-x){ pm.call }
155
+
156
+ alist = File.open(File.expand_path("../data/brew.txt", __FILE__), 'r').readlines
157
+ list2 = File.open(File.expand_path("../data/gemlist.txt", __FILE__), 'r').readlines
158
+ lb = nil
159
+
160
+ flow :margin_top => 1, :height => FFI::NCurses.LINES-2 do
161
+ lb = listbox :list => alist, :suppress_borders => false, :title => "[ brew packages ]",
162
+ :left_margin => 1, :width_pc => 50, :name => 'lb1'
163
+ lb.show_selector = false
164
+
165
+ lb2 = listbox :list => list2, :justify => :left, :title => "[ gems ]", :suppress_borders => false,
166
+ :left_margin => 1, :width_pc => 50, :name => 'lb2'
167
+ end
168
+
169
+
170
+ label({:text => "F1 Help, F10 Quit. : for menu. Press F4 and F5 to test popup, space or enter to select", :row => Ncurses.LINES-1, :col => 0, :name => 'lab'})
171
+
172
+ @form.bind(:RESIZE) { resize() }
173
+ @form.bind_key(FFI::NCurses::KEY_F4) { row = lb.current_index+lb.row; col=lb.col+lb.current_value.length+1; ret = popuplist(%w[ andy berlioz strauss tchaiko matz beethoven], :row => row, :col => col, :title => "Names", :bgcolor => :blue, :color => :white) ; alert "got #{ret} "}
174
+
175
+ @form.bind_key(FFI::NCurses::KEY_F5) { list = %x[ls].split("\n");ret = popuplist(list, :title => "Files"); alert "Got #{ret} #{list[ret]} " }
176
+
177
+ @form.bind_key(?:) { disp_menu;
178
+ }
179
+ end # app
@@ -0,0 +1,50 @@
1
+ require 'rbhex/core/util/app'
2
+
3
+ def load_relative(path)
4
+ load File.expand_path("../#{path}", __FILE__)
5
+ end
6
+
7
+ App.new do
8
+ #title "Demo of Menu - rbhex"
9
+ #subtitle "Hit F1 to quit, F2 for menubar toggle"
10
+ header = app_header "rbhex #{Rbhex::Core::VERSION}", :text_center => "Alpine Menu Demo", :text_right =>""
11
+
12
+ stack :margin_top => 10, :margin_left => 15 do
13
+ #w = "Messages".length + 1
14
+ w = 60
15
+ menulink :text => "&View Dirs", :width => w, :description => "View Dirs in tree" do |s, *stuff|
16
+ message "Pressed #{s.text} "
17
+ load_relative './dirtree.rb'
18
+ #require './viewtodo'; todo = ViewTodo::TodoApp.new; todo.run
19
+ end
20
+ blank
21
+ menulink :text => "&Tabular", :width => w, :description => "Tabula Rasa" do |s, *stuff|
22
+ message "Pressed #{s.text} "
23
+ load_relative './tabular.rb'
24
+ #require './testtodo'; todo = TestTodo::TodoApp.new; todo.run
25
+ end
26
+ blank
27
+ menulink :text => "&Messages", :width => w, :description => "View Tasks" do |s, *stuff|
28
+ message "Pressed #{s.text} "
29
+ load_relative './tasks.rb'
30
+ end
31
+ blank
32
+ menulink :text => "&Database", :width => w, :description => "Database Demo" do |s, *stuff|
33
+ message "Pressed #{s.getvalue} "
34
+ load_relative './dbdemo.rb'
35
+ end
36
+ blank
37
+ # somehow ? in mnemonic won't work
38
+ menulink :text => "&Setup", :width => w, :description => "Configure Alpine options" do |s, *stuff|
39
+ #message "Pressed #{s.text} "
40
+ alert "Not done!"
41
+ end
42
+ blank
43
+ menulink :text => "&Quit", :width => w, :description => "Quit this application" do |s, *stuff|
44
+ quit
45
+ end
46
+ @form.bind(:ENTER) do |w|
47
+ header.text_right = w.text
48
+ end
49
+ end # stack
50
+ end # app
@@ -0,0 +1,19 @@
1
+ require 'rbhex/core/util/app'
2
+ def help_text
3
+ <<-eos
4
+ Enter as much help text
5
+ here as you want
6
+ eos
7
+ end
8
+
9
+ App.new do
10
+ ## application code comes here
11
+ @form.help_manager.help_text = help_text()
12
+
13
+ @header = app_header "My App", :text_center => "Yet Another Email Client that sucks", :text_right =>"Some text", :color => :black, :bgcolor => :white
14
+
15
+ @status_line = status_line
16
+ @status_line.command {
17
+
18
+ }
19
+ end # app
data/examples/atree.rb ADDED
@@ -0,0 +1,100 @@
1
+ require 'rbhex/core/util/app'
2
+
3
+ App.new do
4
+ var = Variable.new
5
+ header = app_header "rbhex #{Rbhex::Core::VERSION}", :text_center => "Tree Demo", :text_right =>"New Improved!", :color => :black, :bgcolor => :white, :attr => :bold
6
+ message "Press Enter to expand/collapse"
7
+
8
+ @form.bind_key(FFI::NCurses::KEY_F3) {
9
+ require 'rbhex/core/util/viewer'
10
+ RubyCurses::Viewer.view("rbc13.log", :close_key => KEY_ENTER, :title => "<Enter> to close")
11
+ }
12
+
13
+ ww = FFI::NCurses.COLS-0
14
+ flow :width => ww , :margin_top => 1, :height => FFI::NCurses.LINES-2 do
15
+ stack :margin_top => 0, :width_pc => "30" do
16
+ tm = nil
17
+ atree = tree :height => 10, :title => '[ ruby way ]' do
18
+ root "root" do
19
+ branch "hello" do
20
+ leaf "ruby"
21
+ end
22
+ branch "goodbye" do
23
+ leaf "java"
24
+ leaf "verbosity"
25
+ end
26
+ end
27
+ end
28
+ found=atree.get_node_for_path "goodbye"
29
+ atree.set_expanded_state(atree.root, true)
30
+ atree.set_expanded_state(found,true)
31
+
32
+ # using a Hash
33
+ model = { :ruby => [ "jruby", {:mri => %W[ 1.8.6 1.8.7]}, {:yarv => %W[1.9.1 1.9.2]}, "rubinius", "macruby" ], :python => %W[ cpython jython laden-swallow ] }
34
+ tree :data => model, :title => "[ Hash ]"
35
+
36
+ end # stack
37
+ stack :margin_top => 0, :width_pc => "30" do
38
+
39
+ # using an Array, these would be expanded on selection, using an event
40
+ tree :data => Dir.glob("*"), :title=> "[ Array ]" do
41
+ command do |node|
42
+ # insert dir entries unless done so already
43
+ if node.children && !node.children.empty?
44
+ else
45
+ f = node.user_object
46
+ if File.directory? f
47
+ l = Dir.glob(f + "/*")
48
+ node.add(l) if l
49
+ end
50
+ end
51
+ end
52
+ bind :ENTER_ROW do |t|
53
+ var.value = t.text.user_object
54
+ end
55
+ end
56
+
57
+ # long way ISO 9001 certifed, SEI CMM 5 compliant
58
+ #
59
+ root = TreeNode.new "ROOT"
60
+ subroot = TreeNode.new "subroot"
61
+ leaf1 = TreeNode.new "leaf 1"
62
+ leaf2 = TreeNode.new "leaf 2"
63
+ model = DefaultTreeModel.new root
64
+ #model.insert_node_into(subroot, root, 0) # BLEAH JAVA !!
65
+
66
+ # slightly better, since we return self in ruby
67
+ root << subroot
68
+ subroot << leaf1 << leaf2
69
+ leaf1 << "leaf11"
70
+ leaf1 << "leaf12"
71
+
72
+ # more rubyish way
73
+ root.add "blocky", true do
74
+ add "block2"
75
+ add "block3" do
76
+ add "block31"
77
+ end
78
+ end
79
+
80
+ tree :data => model, :title => "[ legacy way ]"
81
+
82
+ end
83
+ #stack :margin_top => 2 do
84
+ stack :margin_top => 0, :width_pc => "40", :height => :expand do
85
+ t = textview :suppress_borders => true, :height_pc => 100
86
+ var.command do |filename|
87
+ filename = filename.value
88
+ if File.directory? filename
89
+ lines = Dir.entries(filename )
90
+ t.set_content lines
91
+ elsif File.exist? filename
92
+ lines = File.open(filename,'r').readlines
93
+ t.set_content lines
94
+ else
95
+ alert " #{filename} does not appear to be a file "
96
+ end
97
+ end
98
+ end
99
+ end # flow
100
+ end # app