rbcurse 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/README.markdown +3 -2
  2. data/VERSION +1 -1
  3. metadata +6 -103
  4. data/examples/README.txt +0 -67
  5. data/examples/abasiclist.rb +0 -33
  6. data/examples/alpmenu.rb +0 -42
  7. data/examples/app.rb +0 -859
  8. data/examples/app.sample +0 -17
  9. data/examples/appdirtree.rb +0 -74
  10. data/examples/appemail.rb +0 -191
  11. data/examples/appemaillb.rb +0 -308
  12. data/examples/appgcompose.rb +0 -315
  13. data/examples/atree.rb +0 -64
  14. data/examples/common/file.rb +0 -40
  15. data/examples/common/rmail.rb +0 -257
  16. data/examples/data.txt +0 -683
  17. data/examples/data/README.markdown +0 -9
  18. data/examples/data/brew.txt +0 -38
  19. data/examples/data/color.2 +0 -37
  20. data/examples/data/gemlist.txt +0 -60
  21. data/examples/data/lotr.txt +0 -12
  22. data/examples/data/ports.txt +0 -136
  23. data/examples/data/tasks.txt +0 -27
  24. data/examples/data/todocsv.csv +0 -28
  25. data/examples/data/unix1.txt +0 -21
  26. data/examples/data/unix2.txt +0 -11
  27. data/examples/dbdemo.rb +0 -495
  28. data/examples/deprecated/appgmail.rb +0 -952
  29. data/examples/deprecated/splitp.rb +0 -56
  30. data/examples/deprecated/testscrolllb.rb +0 -86
  31. data/examples/deprecated/testscrollp.rb +0 -88
  32. data/examples/deprecated/testscrollta.rb +0 -80
  33. data/examples/deprecated/testscrolltable.rb +0 -165
  34. data/examples/deprecated/testsplit.rb +0 -87
  35. data/examples/deprecated/testsplit2.rb +0 -123
  36. data/examples/deprecated/testsplit3.rb +0 -215
  37. data/examples/deprecated/testsplit3_1.rb +0 -244
  38. data/examples/deprecated/testsplit3a.rb +0 -215
  39. data/examples/deprecated/testsplit3b.rb +0 -237
  40. data/examples/deprecated/testsplitta.rb +0 -148
  41. data/examples/deprecated/testsplittv.rb +0 -142
  42. data/examples/deprecated/testsplittvv.rb +0 -144
  43. data/examples/deprecated/testtpane.rb +0 -215
  44. data/examples/deprecated/testtpane2.rb +0 -145
  45. data/examples/deprecated/testtpanetable.rb +0 -203
  46. data/examples/dirtree.rb +0 -88
  47. data/examples/experimental/resultsetdemo.rb +0 -280
  48. data/examples/experimental/testmform.rb +0 -35
  49. data/examples/experimental/testscroller.rb +0 -117
  50. data/examples/experimental/teststackflow.rb +0 -111
  51. data/examples/menu1.rb +0 -112
  52. data/examples/multispl.rb +0 -86
  53. data/examples/newmessagebox.rb +0 -131
  54. data/examples/newtabbedwindow.rb +0 -100
  55. data/examples/newtesttabp.rb +0 -121
  56. data/examples/qdfilechooser.rb +0 -68
  57. data/examples/rfe.rb +0 -1239
  58. data/examples/rfe_renderer.rb +0 -121
  59. data/examples/sqlc.rb +0 -454
  60. data/examples/sqlm.rb +0 -437
  61. data/examples/sqlt.rb +0 -408
  62. data/examples/status.txt +0 -68
  63. data/examples/table1.rb +0 -24
  64. data/examples/term2.rb +0 -84
  65. data/examples/test1.rb +0 -239
  66. data/examples/test2.rb +0 -674
  67. data/examples/testapp.rb +0 -44
  68. data/examples/testapp2.rb +0 -58
  69. data/examples/testchars.rb +0 -137
  70. data/examples/testcombo.rb +0 -91
  71. data/examples/testkeypress.rb +0 -66
  72. data/examples/testlistbox.rb +0 -113
  73. data/examples/testmenu.rb +0 -101
  74. data/examples/testmulticomp.rb +0 -70
  75. data/examples/testmulticontainer.rb +0 -94
  76. data/examples/testmultispl.rb +0 -199
  77. data/examples/testree.rb +0 -106
  78. data/examples/testtable.rb +0 -264
  79. data/examples/testtabp.rb +0 -107
  80. data/examples/testtodo.rb +0 -584
  81. data/examples/testvimsplit.rb +0 -112
  82. data/examples/testwsshortcuts.rb +0 -64
  83. data/examples/testwsshortcuts2.rb +0 -126
  84. data/examples/todo.db +0 -0
  85. data/examples/todo.yml +0 -191
  86. data/examples/viewtodo.rb +0 -574
  87. data/lib/rbcurse.rb +0 -8
  88. data/lib/rbcurse/deprecated/README.markdown +0 -12
  89. data/lib/rbcurse/deprecated/rpad.rb +0 -375
  90. data/lib/rbcurse/deprecated/rscrollpane.rb +0 -512
  91. data/lib/rbcurse/deprecated/rsplitpane.rb +0 -894
  92. data/lib/rbcurse/deprecated/rsplitpane2.rb +0 -1009
  93. data/lib/rbcurse/deprecated/rviewport.rb +0 -204
  94. data/lib/rbcurse/deprecated/widgets/mapper.rb +0 -130
  95. data/lib/rbcurse/deprecated/widgets/rmessagebox.rb +0 -348
  96. data/lib/rbcurse/deprecated/widgets/rtabbedpane.rb +0 -1158
  97. data/lib/rbcurse/deprecated/widgets/rtabbedwindow.rb +0 -167
  98. data/lib/rbcurse/deprecated/widgets/scrollable.rb +0 -301
  99. data/lib/rbcurse/deprecated/widgets/stdscrwindow.rb +0 -309
  100. data/lib/ver/keyboard2.rb +0 -170
@@ -1,101 +0,0 @@
1
- require 'logger'
2
- require 'rbcurse'
3
- #require 'lib/rbcurse/rform'
4
- require 'rbcurse/extras/widgets/rpopupmenu'
5
- if $0 == __FILE__
6
- include RubyCurses
7
-
8
- begin
9
- # Initialize curses
10
- VER::start_ncurses # this is initializing colors via ColorMap.setup
11
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
12
- $log.level = Logger::DEBUG
13
-
14
- @window = VER::Window.root_window
15
- # Initialize few color pairs
16
- # Create the window to be associated with the form
17
- # Un post form and free the memory
18
-
19
- catch(:close) do
20
- colors = Ncurses.COLORS
21
- $log.debug "START #{colors} colors #{$datacolor} ---------"
22
- @form = Form.new @window
23
- @form.window.printstring 0, 25, "Demo of Ruby Curses PopupMenu", $normalcolor, 'reverse'
24
- r = 1; fc = 12;
25
- row = 10; col = 10
26
- colorlabel = Label.new @form, {'text' => "A label:", "row" => row, "col" => col, "color"=>"cyan", "mnemonic" => 'A'}
27
-
28
- #@mb = RubyCurses::MenuBar.new
29
- #filemenu = RubyCurses::Menu.new "File"
30
- filemenu = RubyCurses::PopupMenu.new "File"
31
- filemenu.add(item = RubyCurses::PMenuItem.new("Open",'O'))
32
-
33
- filemenu.insert_separator 1
34
- filemenu.add(RubyCurses::PMenuItem.new "New",'N')
35
- filemenu.add(item = RubyCurses::PMenuItem.new("Save",'S'))
36
- filemenu.add(item = RubyCurses::PMenuItem.new("Test",'T'))
37
- filemenu.add(item = RubyCurses::PMenuItem.new("Wrap Text",'W'))
38
- filemenu.add(item = RubyCurses::PMenuItem.new("Exit",'X'))
39
- item.command() {
40
- #throw(:menubarclose);
41
- throw(:close)
42
- }
43
- item = RubyCurses::PCheckBoxMenuItem.new "Reverse"
44
- #filemenu.create_window
45
- # item.onvalue="On"
46
- # item.offvalue="Off"
47
- #item.checkbox.text "Labelcb"
48
- #item.text="Labelcb"
49
- # in next line, an explicit repaint is required since label is on another form.
50
- #item.command(colorlabel){|it, label| att = it.getvalue ? 'reverse' : nil; label.attr(att); label.repaint}
51
-
52
-
53
- filemenu.add(item)
54
- #@mb.add(filemenu)
55
- editmenu = RubyCurses::PMenu.new "Edit"
56
- item = RubyCurses::PMenuItem.new "Cut"
57
- editmenu.add(item)
58
- item.accelerator = "Ctrl-X"
59
- item=RubyCurses::PMenuItem.new "Copy"
60
- editmenu.add(item)
61
- item.accelerator = "Ctrl-C"
62
- item=RubyCurses::PMenuItem.new "Paste"
63
- editmenu.add(item)
64
- item.accelerator = "Ctrl-V"
65
- #@mb.add(editmenu)
66
- #@mb.add(
67
- menu=RubyCurses::PMenu.new("Others")
68
- filemenu.add(menu)
69
- #item=RubyCurses::PMenuItem.new "Save","S"
70
- item = RubyCurses::PMenuItem.new "Config"
71
- menu.add(item)
72
- item = RubyCurses::PMenuItem.new "Tables"
73
- menu.add(item)
74
- savemenu = RubyCurses::PMenu.new "EditM"
75
- item = RubyCurses::PMenuItem.new "CutM"
76
- savemenu.add(item)
77
- item = RubyCurses::PMenuItem.new "DeleteM"
78
- savemenu.add(item)
79
- item = RubyCurses::PMenuItem.new "PasteM"
80
- savemenu.add(item)
81
- menu.add(savemenu)
82
- # 2008-12-20 13:06 no longer hardcoding toggle key of menu_bar.
83
- #@mb.toggle_key = KEY_F2
84
- #@form.set_menu_bar @mb
85
- #@cell = CellRenderer.new "Hello", {"col" => 1, "row"=>29, "justify"=>:right, "display_length" => 30}
86
- # END
87
- @form.repaint
88
- filemenu.show colorlabel, 0,1
89
- @window.wrefresh
90
- Ncurses::Panel.update_panels
91
- end
92
- rescue => ex
93
- ensure
94
- @window.destroy if !@window.nil?
95
- VER::stop_ncurses
96
- p ex if ex
97
- p(ex.backtrace.join("\n")) if ex
98
- $log.debug( ex) if ex
99
- $log.debug(ex.backtrace.join("\n")) if ex
100
- end
101
- end
@@ -1,70 +0,0 @@
1
- require 'logger'
2
- require 'rbcurse'
3
- require 'rbcurse/extras/widgets/rmulticontainer'
4
- require 'rbcurse/core/widgets/rtextarea'
5
- if $0 == __FILE__
6
- include RubyCurses
7
- include RubyCurses::Utils
8
-
9
- begin
10
- # Initialize curses
11
- VER::start_ncurses # this is initializing colors via ColorMap.setup
12
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
13
- $log.level = Logger::DEBUG
14
-
15
- @window = VER::Window.root_window
16
-
17
- catch(:close) do
18
- colors = Ncurses.COLORS
19
- $log.debug "START #{colors} colors --------- testmulticomp"
20
- @form = Form.new @window
21
- @ctr = 1
22
- r = 1; c = 30;
23
-
24
- mc = MultiContainer.new @form do
25
- name "multic"
26
- row r
27
- col c
28
- width 60
29
- height 15
30
- title "Multiconty"
31
- end
32
- ctr = 1
33
-
34
- @form.bind_key(?\M-a) do
35
- $log.debug " Inside M-a MULTI "
36
- texta = TextArea.new do
37
- name "mytext#{ctr}"
38
- title "Enter Something-#{ctr}"
39
- title_attrib (Ncurses::A_REVERSE | Ncurses::A_BOLD)
40
- end
41
- mc.add texta, "Enter Something #{ctr}"
42
- texta << "Hello World"
43
- texta << "Hello World"
44
- ctr += 1
45
- end
46
- @help = "F10 to quit. M-a to open new component. M-: for menu #{$0} "
47
- RubyCurses::Label.new @form, {'text' => @help, "row" => 21, "col" => 2, "color" => "yellow"}
48
-
49
- @form.repaint
50
- @window.wrefresh
51
- Ncurses::Panel.update_panels
52
- while((ch = @window.getchar()) != KEY_F10 )
53
- break if ch == ?\C-q.getbyte(0)
54
- str = keycode_tos ch
55
- $log.debug "#{ch} got (#{str})"
56
- @form.handle_key ch
57
- @form.repaint
58
- @window.wrefresh
59
- end
60
- end
61
- rescue => ex
62
- ensure
63
- @window.destroy if !@window.nil?
64
- VER::stop_ncurses
65
- p ex if ex
66
- p(ex.backtrace.join("\n")) if ex
67
- $log.debug( ex) if ex
68
- $log.debug(ex.backtrace.join("\n")) if ex
69
- end
70
- end
@@ -1,94 +0,0 @@
1
- ##
2
- # This tests both multicontainer and container
3
- #
4
- require 'logger'
5
- require 'rbcurse'
6
- require 'rbcurse/extras/widgets/rmulticontainer'
7
- require 'rbcurse/core/widgets/rcontainer'
8
- require 'rbcurse/core/widgets/rtextarea'
9
- if $0 == __FILE__
10
- include RubyCurses
11
- include RubyCurses::Utils
12
-
13
- begin
14
- # Initialize curses
15
- VER::start_ncurses # this is initializing colors via ColorMap.setup
16
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
17
- $log.level = Logger::DEBUG
18
-
19
- @window = VER::Window.root_window
20
-
21
- catch(:close) do
22
- colors = Ncurses.COLORS
23
- $log.debug "START #{colors} colors --------- testmulticomp"
24
- @form = Form.new @window
25
- @ctr = 1
26
- r = 1; c = 30;
27
-
28
- mc = MultiContainer.new @form do
29
- name "multic"
30
- row r
31
- col c
32
- width 60
33
- height 15
34
- title "Multicontainer"
35
- end
36
- ctr = 1
37
-
38
- c1 = Container.new
39
- mc.add c1, "A form"
40
- f1 = Field.new nil do
41
- name "name"
42
- text "rahul"
43
- row 1
44
- col 10
45
- label " Name: "
46
- end
47
- f2 = Field.new nil, :name => "email", :text => "me@somebody.com", :label => "Email: "
48
- c1.add( f1, f2)
49
-
50
- c3 = TextArea.new
51
- mc.add c3, "Edit Me"
52
- c2 = Container.new
53
- mc.add c2, "Another form"
54
- attrib = 'underline'
55
- f3 = Field.new do
56
- name "language"
57
- text "ruby"
58
- row 1
59
- col 10
60
- label "Language: "
61
- attr attrib
62
- end
63
- f4 = Field.new nil, :name => "version", :text => "1.9.2", :row => 2, :col => 10,
64
- :label => " Version: ", :attr => attrib
65
- c2.add( f3, f4)
66
-
67
- @help = "F10 to quit. M-a to open new component. M-: for menu #{$0} "
68
- RubyCurses::Label.new @form, {:text => @help, :row => last_line(), :col => 2,
69
- :color => 'yellow', :bgcolor => 'red'}
70
- f5 = Field.new @form, :name => "version2", :text => "1.9.2", :row => 20, :col => c, :bgcolor => 'blue',
71
- :label => "Version: ", :label_color_pair => get_color($datacolor, 'green', 'black')
72
-
73
- @form.repaint
74
- @window.wrefresh
75
- Ncurses::Panel.update_panels
76
- while((ch = @window.getchar()) != KEY_F10 )
77
- break if ch == ?\C-q.getbyte(0)
78
- str = keycode_tos ch
79
- $log.debug "#{ch} got (#{str})"
80
- @form.handle_key ch
81
- @form.repaint
82
- @window.wrefresh
83
- end
84
- end
85
- rescue => ex
86
- ensure
87
- @window.destroy if !@window.nil?
88
- VER::stop_ncurses
89
- p ex if ex
90
- p(ex.backtrace.join("\n")) if ex
91
- $log.debug( ex) if ex
92
- $log.debug(ex.backtrace.join("\n")) if ex
93
- end
94
- end
@@ -1,199 +0,0 @@
1
- $LOAD_PATH << "/Users/rahul/work/projects/rbcurse/lib"
2
- require 'rbcurse'
3
- require 'rbcurse/extras/widgets/rmultisplit'
4
- require 'rbcurse/extras/widgets/rlistbox'
5
- require 'fileutils'
6
-
7
- #
8
- ## this sample creates a multisplitpane with n objects
9
- ##+ and move divider around using - + and =.
10
- # TODO:
11
- # x Status bar below to reflect full path.
12
- # - enter to gotonext component too, or at least make visible if not
13
- # but now cursor is showing around everywhere
14
- #
15
- $counter = 0
16
-
17
- # when displaying a filename, if directory prepend a slash.
18
- def format list, fullname=nil
19
- list.collect! {|e|
20
- if fullname
21
- f = File.join(fullname, e)
22
- else
23
- f = e
24
- end
25
- if File.directory? f
26
- "/" + e
27
- else
28
- e
29
- end
30
- }
31
- list
32
- end
33
- # @param [Listbox] new list to bind
34
- # @param [Array] array of lists
35
- # @param [MultiSplit] msp object to add a new list to
36
- def bind_list(listb, lists, splitp)
37
- #listb.bind(:ENTER_ROW, mylist) {|lb,list| row_cmd.call(lb,list) }
38
- listb.bind(:PRESS) {
39
- #@status_row.text = "Selected #{tablelist.get_content()[tablelist.current_index]}"
40
- item = "#{listb.get_content()[listb.current_index]}"
41
- fullname = File.join(listb.config[:path], item)
42
- mylist = nil
43
- if File.directory? fullname
44
- $log.debug " DIRector is a item #{item} "
45
- d = Dir.new(fullname)
46
- mylist = d.entries
47
- mylist.delete "."
48
- mylist.delete ".."
49
- format(mylist, fullname)
50
- # NOTE that we create component with nil form as container will manage it
51
- if lists.empty? || lists.last == listb
52
- $counter += 1
53
- listc = Listbox.new nil do
54
- name "LIST#{$counter}"
55
- list mylist
56
- title item
57
- title_attrib 'reverse'
58
- end
59
- listc.one_key_selection = false
60
- listc.bind(:ENTER) {|l| l.title_attrib 'reverse'; }
61
- listc.bind(:LEAVE) {|l| l.title_attrib 'normal'; }
62
- # FIXME crashes if file nil
63
- row_cmd = lambda {|lb, oldlist| list = lb.list(); file = list[lb.current_index]; file ||= "?"; $message.value = File.join(lb.config[:path], file); }
64
- listc.bind(:ENTER_ROW, mylist) {|lb,list| row_cmd.call(lb,list) }
65
- splitp.add listc
66
- lists << listc
67
- listb.config[:child] = listc
68
- listc.config[:path] = File.join(listb.config[:path], item)
69
- bind_list(listc, lists, splitp)
70
- else
71
- #l = lists.first
72
- l = listb.config[:child]
73
- l.list_data_model.remove_all
74
- # if empty maybe we should remove it, but its just a demo
75
- # what happens is, this comes up again when going through another
76
- # directory. First go down rbcurse/lib/rbcurse/extras
77
- # then go to examples which has a shallow structure.
78
- l.list_data_model.insert 0, *mylist unless mylist.empty?
79
- l.config[:path] = fullname
80
- l.title = item
81
- while true
82
- n = l.config[:child]
83
- break if n.nil?
84
- n.list_data_model.remove_all
85
- # TODO should be removed, so focus does not go to it
86
- n.title = ""
87
- l = n
88
- end
89
- $log.debug " MYLIST #{mylist} dir #{item} "
90
- end
91
- splitp.goto_next_component
92
- end
93
- }
94
- end
95
- if $0 == __FILE__
96
- include RubyCurses
97
- include RubyCurses::Utils
98
-
99
- begin
100
- # Initialize curses
101
- VER::start_ncurses # this is initializing colors via ColorMap.setup
102
- $log = Logger.new((File.join(ENV['LOGDIR'] || "./" ,"rbc13.log")))
103
-
104
- $log.level = Logger::DEBUG
105
-
106
- @window = VER::Window.root_window
107
-
108
- catch(:close) do
109
- @form = Form.new @window
110
- r = 3; c = 7; ht = 18
111
- #lastrow = ht+r+5 # 26
112
- lastrow = Ncurses.LINES-1
113
-
114
-
115
- help = "F1 to quit. #{$0} Press Enter on directory, TAB/BTAB to navigate. C-w+-= "
116
- RubyCurses::Label.new @form, {:text => help, :row => lastrow, "col" => 2, "color" => "yellow" }
117
- title = "Demo of Multi-SplitPane (Column Browse pattern)"
118
- RubyCurses::Label.new @form, {:text => title, :row => 1, :col => c, :color => "white" }
119
-
120
-
121
- splitp = MultiSplit.new @form do
122
- name "mypane"
123
- row r
124
- col c
125
- width 70
126
- height ht
127
- split_count 3
128
- unlimited true
129
- orientation :VERTICAL_SPLIT
130
- max_visible 3
131
- end
132
- splitp.bind(:PROPERTY_CHANGE){|e| $message.value = e.to_s }
133
-
134
- $message = Variable.new
135
- $message.value = "Message Comes Here"
136
- message_label = RubyCurses::Label.new @form, {'text_variable' => $message, "name"=>"message_label","row" => ht+r+2, "col" => 1, "display_length" => 80, "height" => 2, 'color' => 'cyan'}
137
- $message.update_command() { message_label.repaint } # why ?
138
- #message_label.row = splitp.row + splitp.height
139
- #message_label.col = splitp.col
140
- @form.place_below(message_label)
141
-
142
-
143
- lists = []
144
- FileUtils.cd("..")
145
- mylist = Dir.glob('*')
146
- mylist.delete_if {|x| x =~ /^\./ || x =~ /^_/ || x =~ /bak$/}
147
- format(mylist)
148
- # NOTE that we create component with nil form as container will manage it
149
- listb = Listbox.new nil do
150
- name "mainlist"
151
- list mylist
152
- title "A short list"
153
- title_attrib 'reverse'
154
- end
155
- listb.config[:path] = Dir.getwd
156
- listb.one_key_selection = false
157
- splitp.add listb
158
- row_cmd = lambda {|lb, list| file = list[lb.current_index]; $message.value = file; # File.stat("#{cur_dir()}/#{file}").inspect
159
- }
160
- listb.bind(:ENTER_ROW, mylist) {|lb,list| row_cmd.call(lb,list) }
161
- listb.bind(:ENTER) {|l| l.title_attrib 'reverse'; }
162
- listb.bind(:LEAVE) {|l| l.title_attrib 'normal'; }
163
- bind_list(listb, lists, splitp)
164
-
165
- # Dummy field just to see navigation from and to container
166
- fname = "Search"
167
- r, c = @form.next_position
168
- c += fname.length + 1
169
- field = Field.new @form do
170
- name fname
171
- row r
172
- col c
173
- display_length 30
174
- bgcolor 'cyan'
175
- #set_buffer "abcd "
176
- set_label Label.new @form, {:text => fname, :color=>'white',:bgcolor=>'red', :mnemonic=> 's'}
177
- end
178
-
179
- @form.repaint
180
- @window.wrefresh
181
- Ncurses::Panel.update_panels
182
- counter = 0
183
- while((ch = @window.getchar()) != KEY_F1 )
184
- str = keycode_tos ch
185
- @form.handle_key(ch)
186
- @window.wrefresh
187
- end
188
- end
189
- rescue => ex
190
- ensure
191
- @window.destroy if !@window.nil?
192
- VER::stop_ncurses
193
- p ex if ex
194
- puts(ex.backtrace.join("\n")) if ex
195
- $log.debug( ex) if ex
196
- $log.debug(ex.backtrace.join("\n")) if ex
197
- end
198
- end
199
-