rbcurse 1.5.0 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/Makefile +21 -0
  2. data/Manifest.txt +6 -0
  3. data/README.markdown +6 -4
  4. data/TODO +372 -0
  5. data/TODO2.txt +121 -0
  6. data/VERSION +1 -1
  7. data/examples/README.txt +67 -0
  8. data/examples/abasiclist.rb +33 -0
  9. data/examples/alpmenu.rb +42 -0
  10. data/examples/app.rb +859 -0
  11. data/examples/app.sample +17 -0
  12. data/examples/appdirtree.rb +74 -0
  13. data/examples/appemail.rb +191 -0
  14. data/examples/appemaillb.rb +308 -0
  15. data/examples/appgcompose.rb +315 -0
  16. data/examples/atree.rb +64 -0
  17. data/examples/common/file.rb +40 -0
  18. data/examples/common/rmail.rb +257 -0
  19. data/examples/data.txt +683 -0
  20. data/examples/data/README.markdown +9 -0
  21. data/examples/data/brew.txt +38 -0
  22. data/examples/data/color.2 +37 -0
  23. data/examples/data/gemlist.txt +60 -0
  24. data/examples/data/lotr.txt +12 -0
  25. data/examples/data/ports.txt +136 -0
  26. data/examples/data/tasks.txt +27 -0
  27. data/examples/data/todocsv.csv +28 -0
  28. data/examples/data/unix1.txt +21 -0
  29. data/examples/data/unix2.txt +11 -0
  30. data/examples/dbdemo.rb +495 -0
  31. data/examples/deprecated/appgmail.rb +952 -0
  32. data/examples/deprecated/splitp.rb +56 -0
  33. data/examples/deprecated/testscrolllb.rb +86 -0
  34. data/examples/deprecated/testscrollp.rb +88 -0
  35. data/examples/deprecated/testscrollta.rb +80 -0
  36. data/examples/deprecated/testscrolltable.rb +165 -0
  37. data/examples/deprecated/testsplit.rb +87 -0
  38. data/examples/deprecated/testsplit2.rb +123 -0
  39. data/examples/deprecated/testsplit3.rb +215 -0
  40. data/examples/deprecated/testsplit3_1.rb +244 -0
  41. data/examples/deprecated/testsplit3a.rb +215 -0
  42. data/examples/deprecated/testsplit3b.rb +237 -0
  43. data/examples/deprecated/testsplitta.rb +148 -0
  44. data/examples/deprecated/testsplittv.rb +142 -0
  45. data/examples/deprecated/testsplittvv.rb +144 -0
  46. data/examples/deprecated/testtpane.rb +215 -0
  47. data/examples/deprecated/testtpane2.rb +145 -0
  48. data/examples/deprecated/testtpanetable.rb +203 -0
  49. data/examples/dirtree.rb +88 -0
  50. data/examples/experimental/resultsetdemo.rb +280 -0
  51. data/examples/experimental/testmform.rb +35 -0
  52. data/examples/experimental/testscroller.rb +117 -0
  53. data/examples/experimental/teststackflow.rb +111 -0
  54. data/examples/menu1.rb +112 -0
  55. data/examples/multispl.rb +86 -0
  56. data/examples/newmessagebox.rb +131 -0
  57. data/examples/newtabbedwindow.rb +100 -0
  58. data/examples/newtesttabp.rb +121 -0
  59. data/examples/qdfilechooser.rb +68 -0
  60. data/examples/rfe.rb +1239 -0
  61. data/examples/rfe_renderer.rb +121 -0
  62. data/examples/sqlc.rb +454 -0
  63. data/examples/sqlm.rb +437 -0
  64. data/examples/sqlt.rb +408 -0
  65. data/examples/status.txt +68 -0
  66. data/examples/table1.rb +24 -0
  67. data/examples/term2.rb +84 -0
  68. data/examples/test1.rb +239 -0
  69. data/examples/test2.rb +674 -0
  70. data/examples/testapp.rb +44 -0
  71. data/examples/testapp2.rb +58 -0
  72. data/examples/testchars.rb +137 -0
  73. data/examples/testcombo.rb +91 -0
  74. data/examples/testkeypress.rb +66 -0
  75. data/examples/testlistbox.rb +113 -0
  76. data/examples/testmenu.rb +101 -0
  77. data/examples/testmulticomp.rb +70 -0
  78. data/examples/testmulticontainer.rb +94 -0
  79. data/examples/testmultispl.rb +199 -0
  80. data/examples/testree.rb +106 -0
  81. data/examples/testtable.rb +264 -0
  82. data/examples/testtabp.rb +107 -0
  83. data/examples/testtodo.rb +584 -0
  84. data/examples/testvimsplit.rb +112 -0
  85. data/examples/testwsshortcuts.rb +64 -0
  86. data/examples/testwsshortcuts2.rb +126 -0
  87. data/examples/todo.db +0 -0
  88. data/examples/todo.yml +191 -0
  89. data/examples/viewtodo.rb +574 -0
  90. data/lib/rbcurse/deprecated/README.markdown +12 -0
  91. data/lib/rbcurse/deprecated/rpad.rb +375 -0
  92. data/lib/rbcurse/deprecated/rscrollpane.rb +512 -0
  93. data/lib/rbcurse/deprecated/rsplitpane.rb +894 -0
  94. data/lib/rbcurse/deprecated/rsplitpane2.rb +1009 -0
  95. data/lib/rbcurse/deprecated/rviewport.rb +204 -0
  96. data/lib/rbcurse/deprecated/widgets/mapper.rb +130 -0
  97. data/lib/rbcurse/deprecated/widgets/rmessagebox.rb +348 -0
  98. data/lib/rbcurse/deprecated/widgets/rtabbedpane.rb +1158 -0
  99. data/lib/rbcurse/deprecated/widgets/rtabbedwindow.rb +167 -0
  100. data/lib/rbcurse/deprecated/widgets/scrollable.rb +301 -0
  101. data/lib/rbcurse/deprecated/widgets/stdscrwindow.rb +309 -0
  102. data/lib/ver/keyboard2.rb +170 -0
  103. data/test/test_rbcurse.rb +0 -0
  104. metadata +131 -9
@@ -0,0 +1,9 @@
1
+ I've put some data here to use in programs as text for textareas, textviews or lists.
2
+
3
+ brew.txt - single list, use in listboxes
4
+ color.2 - ANSI formatted text, use in formatted textview
5
+ gemlist.txt - single column list
6
+ lotr.txt - running text for text views
7
+ ports.txt - 3 column list, use in tables, tabular
8
+ unix1.txt - running text
9
+ unix2.txt - running text
@@ -0,0 +1,38 @@
1
+ ack
2
+ aqua-less
3
+ atool
4
+ bash-completion
5
+ calcurse
6
+ cmake
7
+ coreutils
8
+ curl
9
+ elinks
10
+ findutils
11
+ gawk
12
+ gettext
13
+ git
14
+ gnu-sed
15
+ grep
16
+ htop
17
+ jed
18
+ libevent
19
+ moreutils
20
+ most
21
+ msmtp
22
+ multitail
23
+ mysql
24
+ oniguruma
25
+ pcre
26
+ pidof
27
+ pigz
28
+ pkg-config
29
+ pv
30
+ readline
31
+ rlwrap
32
+ s-lang
33
+ sqlite
34
+ tal
35
+ task
36
+ tig
37
+ tmux
38
+ wget
@@ -0,0 +1,37 @@
1
+ Showing all items...
2
+ (8b0dbf) #enh view with table, text, list, tree, fields hash
3
+ (3ef256) #fix clearing/hiding widget
4
+ (df584b) %menu list place cursor firstchar match
5
+ (749828) %menu RT_ARROW if none go left
6
+ (ed1515) %vimsplit when adding, put grabbar cmd in system_commands
7
+ (b3102b) %listbox reduce repaint, only if change, or selection
8
+ (344ad2) %form dn_arrow to lower field, rt_arrow to right field
9
+ (35bed1) %tabularwidget ask_select and ask_unselect
10
+ (7c24e7) check other widgets for color changes
11
+ (f864fe) check for #UTF-8 errors where match method used #fix
12
+ (4bef44) testdir returns path wrong if i use ../ #fix
13
+ (2171c9) %TabularWidget example scrollbar showing white space at end #fix
14
+ (ed7b0a) search in tabular does not take offset of header into account #fix
15
+ (fc95e4) #enh widgets can have %keylabels, so mode gets taken care of auto
16
+ (c538e9) app_header assumes root_window, shd take window width into acount
17
+ (e22c8e) menu in dbdemo one column short (ony after F4 closes) #fix
18
+ (83dfff) additional footer text in text view area #hold
19
+ (891157) maybe selected and focussed should be shown same so no confusion
20
+ (dd5f96) calculate color_pair once, and not so many times #fix
21
+ (2406f8) listcellrenderer is horribly complicated - simplify
22
+ (f42383) reduce #repaint in #textarea and #tree
23
+ (543b53) dock through div by zero if row Ncurses.Lines-1 #fix
24
+ (c48a48) The view in #dbdemo should allow sorting on header. and maybe select one row
25
+ (85461c) common routine tabular(headings,content)
26
+ (9b3501) sort on tabularwidget with resultset sometimes gives error ofcomparison
27
+ (31f476) put comopnent traversal into traversal module
28
+ (5be1c4) popuplist: space in single selection should select?
29
+ (330928) system shell etc menu items should be available somehow ifwe want
30
+ (3663dc) install mysql and gem and test resultset with that too
31
+ (745c3f) remove multiform
32
+ 
33
+ ==================== TODAY ====================
34
+ (d56b4d) alert dialog overflow on data, shd have increased in size #fix #today
35
+ 
36
+ ==================== URGENT ====================
37
+ (140d16) #fix %testvimsplit not sizing STACK correctly #urgent
@@ -0,0 +1,60 @@
1
+ activesupport (3.1.0, 3.0.10)
2
+ arrayfields (4.7.4)
3
+ bond (0.4.1)
4
+ bugzyrb (0.3.8)
5
+ bundler (1.0.18)
6
+ cheat (1.3.0)
7
+ chronic (0.6.4, 0.3.0)
8
+ colored (1.2)
9
+ dooby (0.3.1)
10
+ fattr (2.2.0)
11
+ ffi (1.0.9)
12
+ ffi-locale (1.0.1)
13
+ ffi-ncurses (0.4.0)
14
+ gem-man (0.3.0)
15
+ gemcutter (0.7.0)
16
+ gemedit (1.0.1)
17
+ git (1.2.5)
18
+ gmail (0.4.0)
19
+ gmail_xoauth (0.3.0)
20
+ growl (1.0.3)
21
+ highline (1.6.2, 1.6.1)
22
+ hoe (2.12.3)
23
+ i18n (0.6.0)
24
+ interactive_editor (0.0.10)
25
+ jeweler (1.6.4)
26
+ json_pure (1.6.1)
27
+ lightning (0.4.0)
28
+ live_console (0.2.1)
29
+ mail (2.3.0)
30
+ main (4.7.7, 4.2.0)
31
+ map (4.3.0)
32
+ maruku (0.6.0)
33
+ mime (0.1)
34
+ mime-types (1.16)
35
+ multi_json (1.0.3)
36
+ ncurses (1.2.4)
37
+ nokogiri (1.5.0)
38
+ oauth (0.4.5)
39
+ optiflag (0.7)
40
+ polyglot (0.3.2)
41
+ qwandry (0.1.4)
42
+ rake (0.9.2, 0.8.7)
43
+ random_data (1.5.2)
44
+ rbcurse (1.4.0)
45
+ rubyforge (2.0.4)
46
+ rubygems-update (1.8.10)
47
+ sequel (3.27.0)
48
+ snipplr (0.0.9)
49
+ spoon (0.0.1)
50
+ sqlite3 (1.3.4)
51
+ sqlite3-ruby (1.3.3)
52
+ subcommand (1.0.6)
53
+ syntax (1.0.0)
54
+ terminal-table (1.4.2)
55
+ thor (0.14.6)
56
+ todorb (1.2.3)
57
+ treetop (1.4.10)
58
+ tzinfo (0.3.29)
59
+ vmail (2.3.2)
60
+ yard (0.7.2)
@@ -0,0 +1,12 @@
1
+ I amar prestar aen. The world is changed. Han matho ne nen. I feel it in the water. Han mathon ned cae. I feel it in the earth. A han noston ned gwilith. I smell it in the air. Much that once was is lost, for none now live who remember it.
2
+
3
+ It began with the forging of the Great Rings. Three were given to the Elves, immortal, wisest and fairest of all beings. Seven to the Dwarf-Lords, great miners and craftsmen of the mountain halls. And nine, nine rings were gifted to the race of Men, who above all else desire power. For within these rings was bound the strength and the will to govern each race. But they were all of them deceived, for another ring was made. Deep in the land of Mordor, in the Fires of Mount Doom, the Dark Lord Sauron forged in secret a master ring to control all others, and into this ring he poured his cruelty, his malice and his will to dominate all life. One ring to rule them all.
4
+
5
+ One by one, the free lands of Middle-Earth fell to the power of the Ring, but there were some who resisted. A last alliance of Men and Elves marched against the armies of Mordor, and on the very slopes of Mount Doom, they fought for the freedom of Middle-Earth. Victory was near, but the power of the ring could not be undone.
6
+ It was in this moment, when all hope had faded, that Isildur, son of the king, took up his father's sword.
7
+
8
+ Sauron, the enemy of the free peoples of Middle-Earth, was defeated. The Ring passed to Isildur, who had this once chance to destroy evil forever. But the hearts of Men are easily corrupted. And the ring of power has a will of its own. It betrayed Isildur, to his death. And some things that should not have been forgotten were lost. History became legend, legend became myth. And for two and a half thousand years, the ring passed out of all knowledge. Until, when chance came, it ensnared a new bearer.
9
+
10
+ The Ring came to the creature Gollum, who took it deep into the tunnels of the Misty Mountains. And there it consumed him. The ring brought to Gollum unnatural long life. For five hundred years it poisoned his mind, and in the gloom of Gollum's cave, it waited. Darkness crept back into the forests of the world. Rumor grew of a shadow in the East, whispers of a nameless fear, and the Ring of Power percieved its time had now come. It abandoned Gollum. But something happened then that the Ring did not intend. It was picked up by the most unlikely creature imaginable: a Hobbit, Bilbo Baggins, of the Shire.
11
+
12
+ For the time will soon come when hobbits will shape the fortunes of all.
@@ -0,0 +1,136 @@
1
+ alpine @2.00 mail/alpine
2
+ apr @1.4.5 devel/apr
3
+ apr-util @1.3.12 devel/apr-util
4
+ autoconf @2.68 devel/autoconf
5
+ automake @1.11.1 devel/automake
6
+ bash @4.2.10 shells/bash
7
+ bash-completion @1.3 sysutils/bash-completion
8
+ bison @2.5 devel/bison
9
+ boost @1.47.0 devel/boost
10
+ boost-jam @3.1.18 devel/boost-jam
11
+ bzip2 @1.0.6 archivers/bzip2
12
+ coreutils @8.14 sysutils/coreutils
13
+ cppunit @1.12.1 devel/cppunit
14
+ ctags @5.8 devel/ctags
15
+ curl @7.22.0 net/curl
16
+ curl-ca-bundle @7.22.0 net/curl-ca-bundle
17
+ cyrus-sasl2 @2.1.23 security/cyrus-sasl2
18
+ db46 @4.6.21 databases/db46
19
+ dirac @1.0.2 multimedia/dirac
20
+ elvis @2.2_0 editors/elvis
21
+ expat @2.0.1 textproc/expat
22
+ expat @2.0.1 textproc/expat
23
+ faac @1.28 audio/faac
24
+ faad2 @2.7 audio/faad2
25
+ ffmpeg @0.7.6 multimedia/ffmpeg
26
+ file @5.09 sysutils/file
27
+ findutils @4.4.2 sysutils/findutils
28
+ flex @2.5.35 devel/flex
29
+ gawk @4.0.0 lang/gawk
30
+ gdbm @1.9.1 databases/gdbm
31
+ gettext @0.18.1.1 devel/gettext
32
+ gettext @0.18.1.1 devel/gettext
33
+ git-core @1.7.7 devel/git-core
34
+ glib2 @2.28.8 devel/glib2
35
+ gmake @3.82 devel/gmake
36
+ gmp @5.0.2 devel/gmp
37
+ gnupg @1.4.11 mail/gnupg
38
+ gperf @3.0.4 devel/gperf
39
+ gperf @3.0.4 devel/gperf
40
+ grep @2.9 sysutils/grep
41
+ groff @1.21 sysutils/groff
42
+ gsed @4.2.1 textproc/gsed
43
+ gzip @1.4 archivers/gzip
44
+ help2man @1.40.4 textproc/help2man
45
+ icu @4.8.1 devel/icu
46
+ irssi @0.8.15 irc/irssi
47
+ joe @3.7 editors/joe
48
+ lame @3.99 audio/lame
49
+ lame @3.99 audio/lame
50
+ libao @1.1.0 audio/libao
51
+ libiconv @1.14 textproc/libiconv
52
+ libiconv @1.14 textproc/libiconv
53
+ libid3tag @0.15.1b audio/libid3tag
54
+ libidn @1.22 mail/libidn
55
+ libmad @0.15.1b audio/libmad
56
+ libmp3splt @0.5.7a audio/libmp3splt
57
+ libogg @1.3.0 multimedia/libogg
58
+ liboil @0.3.17 devel/liboil
59
+ libpng @1.4.8 graphics/libpng
60
+ libsdl @1.2.14 devel/libsdl
61
+ libtheora @1.1.1 multimedia/libtheora
62
+ libtool @2.4.2 devel/libtool
63
+ libusb @1.0.8 devel/libusb
64
+ libvorbis @1.3.2 audio/libvorbis
65
+ libxml2 @2.7.8 textproc/libxml2
66
+ links @2.3 www/links
67
+ lzmautils @4.32.7 archivers/lzmautils
68
+ m4 @1.4.16 devel/m4
69
+ macutil @2.0b3 sysutils/macutil
70
+ mc @4.7.5.2 sysutils/mc
71
+ mp3splt @2.2.6a audio/mp3splt
72
+ mp3wrap @0.5 audio/mp3wrap
73
+ mp4v2 @1.9.1 multimedia/mp4v2
74
+ mpack @1.6 mail/mpack
75
+ mpg321 @0.2.10 audio/mpg321
76
+ ncftp @3.2.5 net/ncftp
77
+ ncurses @5.9 devel/ncurses
78
+ ncurses @5.9 devel/ncurses
79
+ ncursesw @5.8 devel/ncursesw
80
+ ncursesw @5.8 devel/ncursesw
81
+ neon @0.29.6 www/neon
82
+ netcat @1.10 net/netcat
83
+ openldap @2.4.21 databases/openldap
84
+ openssl @1.0.0e devel/openssl
85
+ p5-compress-raw-bzip2 @2.37.0 perl/p5-compress-raw-bzip2
86
+ p5-compress-raw-zlib @2.35.0 perl/p5-compress-raw-zlib
87
+ p5-crypt-ssleay @0.580.0 perl/p5-crypt-ssleay
88
+ p5-error @0.170.160 perl/p5-error
89
+ p5-html-parser @3.680.0 perl/p5-html-parser
90
+ p5-html-tagset @3.200.0 perl/p5-html-tagset
91
+ p5-io-compress @2.35.0 perl/p5-io-compress
92
+ p5-libwww-perl @6.20.0 perl/p5-libwww-perl
93
+ p5-locale-gettext @1.50.0 perl/p5-locale-gettext
94
+ p5-svn-simple @0.280.0 perl/p5-svn-simple
95
+ p5-term-readkey @2.300.0 perl/p5-term-readkey
96
+ p5-uri @1.580.0 perl/p5-uri
97
+ pcre @8.12 devel/pcre
98
+ perl5 @5.12.3 lang/perl5
99
+ perl5.8 @5.8.9 lang/perl5.8
100
+ pkgconfig @0.26 devel/pkgconfig
101
+ popt @1.16 devel/popt
102
+ pv @1.2.0 sysutils/pv
103
+ readline @6.2.000 devel/readline
104
+ rsync @3.0.8 net/rsync
105
+ schroedinger @1.0.10 multimedia/schroedinger
106
+ serf @0.7.2 www/serf
107
+ slang2 @2.2.3 lang/slang2
108
+ source-highlight @3.1.4 textproc/source-highlight
109
+ sqlite3 @3.7.8 databases/sqlite3
110
+ subversion @1.7.0 devel/subversion
111
+ subversion-perlbindings @1.7.0 devel/subversion-perlbindings
112
+ surfraw @2.2.1 net/surfraw
113
+ vim @7.3.286 editors/vim
114
+ wget @1.13.4 net/wget
115
+ x264 @20110628 multimedia/x264
116
+ xorg-bigreqsproto @1.1.1 x11/xorg-bigreqsproto
117
+ xorg-inputproto @2.0.2 x11/xorg-inputproto
118
+ xorg-kbproto @1.0.5 x11/xorg-kbproto
119
+ xorg-libX11 @1.4.4 x11/xorg-libX11
120
+ xorg-libXau @1.0.6 x11/xorg-libXau
121
+ xorg-libXdmcp @1.1.0 x11/xorg-libXdmcp
122
+ xorg-libXext @1.3.0 x11/xorg-libXext
123
+ xorg-libXrandr @1.3.2 x11/xorg-libXrandr
124
+ xorg-randrproto @1.3.2 x11/xorg-randrproto
125
+ xorg-renderproto @0.11.1 x11/xorg-renderproto
126
+ xorg-util-macros @1.15.0 x11/xorg-util-macros
127
+ xorg-xcmiscproto @1.2.1 x11/xorg-xcmiscproto
128
+ xorg-xextproto @7.2.0 x11/xorg-xextproto
129
+ xorg-xf86bigfontproto @1.2.0 x11/xorg-xf86bigfontproto
130
+ xorg-xproto @7.0.22 x11/xorg-xproto
131
+ xorg-xtrans @1.2.6 x11/xorg-xtrans
132
+ xrender @0.9.6 x11/xrender
133
+ XviD @1.3.2 multimedia/XviD
134
+ xz @5.0.3 archivers/xz
135
+ yasm @1.1.0 lang/yasm
136
+ zlib @1.2.5 archivers/zlib
@@ -0,0 +1,27 @@
1
+ Field to have history which pops up
2
+ App to have layout objects @1.6
3
+ F2 menu to have context sensitive items
4
+ SL and Dock events Hide. Move ...
5
+ Stack and Flow to be objects @1.5
6
+ ability to share directory options and functions across dir apps
7
+ add event to form, key_resize
8
+ app: add popup @1.5
9
+ app: widgets can register with dock @1.5
10
+ can use textpad in resultsetdb view to make things simpler
11
+ colored module that allows row-wise coloring for all multirow wids
12
+ find_file like microemacs @1.5
13
+ motion options in textview and lists gg G cYcEcDcB zz zt zb etc
14
+ registering command with Alt-X SL and Dock
15
+ schemes (color) @1.5
16
+ textview etc can have source. also module to recog file type,fmt
17
+ use textpad for lists etc
18
+ window.close can have a event so cleanup of any widget can be done
19
+ Backward char search using F
20
+ add progress bar to StatusWindow
21
+ bottomline options global @1.5
22
+ catch_alt_digits maybe at form level not global
23
+ widgets needs to expose mapped keys in some easy way
24
+ color_pair as :red_on_black
25
+ confirm quit option, and call a proc before quitting
26
+ elusive error if row not given in button
27
+ rpopupmenu and rmenu share same class names
@@ -0,0 +1,28 @@
1
+ FIXME,MSGBOX,5,Confirm dialog: box vertical line overwritten in 2 spots,TODO
2
+ FIXME,MSGBOX,5,Confirm dialog: use normal key as hotkey also,TODO,Tue Jan 20 11:44:49 +0530 2009
3
+ FIXME,MSGBOX,5,Confirm dialog: arrow keys not navigating anylonger,TODO,Tue Jan 20 11:45:27 +0530 2009
4
+ FIXME,GEN,9,Message Box sizing,TODO,Thu Jan 22 20:39:21 +0530 2009
5
+ DONE,LIST,5,case insensitive char search in list and combo,TESTED,Sat Feb 21 20:43:05 +0530 2009
6
+ DONE,TABLE,5,increase the maxlen of this field please. Let us see how it goes.,TESTED
7
+ DONE,TABLE,5,Can we disable down arrow in Chkbox in table?,TESTED,Mon Jan 19 00:00:00 +0530 2009
8
+ DONE,TABLE,0,editing on enter,TESTED,Mon Jan 19 01:37:00 +0530 2009
9
+ DONE,TABLE,5,cell editors pcol is not being reset each time,TESTED,Mon Jan 19 17:47:00 +0530 2009
10
+ DONE,TABLE,5,Use TAB for intercell navig. use M-TAB for next f,TESTED,Tue Jan 20 00:38:19 +0530 2009
11
+ DONE,TABLE,5,Searching,TESTED,Sat Feb 21 20:42:10 +0530 2009
12
+ DONE,TABLE,3,Columns editable or not,TESTED,Sat Feb 21 20:43:10 +0530 2009
13
+ DONE,TABLE,1,Any way to start a table with no data and pop late,TODO,Sat Feb 21 20:43:33 +0530 2009
14
+ DONE,GEN,5,Make widget of Keylabelprinter,TESTED,Tue Jan 20 00:38:43 +0530 2009
15
+ DONE,GEN,5,Added Action class shared by Button Menuitem ,TESTED,Thu Jan 22 18:08:28 +0530 2009
16
+ DONE,GEN,5,Added PopupMenu 2009-01-22 18:09 ,TESTED,Thu Jan 22 18:09:34 +0530 2009
17
+ DONE,LIST,0,call on_enter and on_leave of component,TOTEST,Sun Feb 22 12:19:38 +0530 2009
18
+ DONE,FIELD,5,Field: OVERWRITE Mode,TESTED,2010-09-13 11:24:35 +0530
19
+ DONE,GEN,5,"Modified should check if value changed, not UP etc",TOTEST,2010-09-13 11:25:18 +0530
20
+ TODO,TABLE,1,table.set_data should check if models already created.,TODO
21
+ TODO,TABLE,5,"Set column_class in TableColumn, to avoid hassles",TODO
22
+ TODO,TABLE,2,Table sorting and filtering is required - using VIEW,TODO
23
+ TODO,TABLE,5,Table height and col widths auto sizing or FILLING extra space.,TODO
24
+ TODO,TEXTAREA,9,"Textarea: wrap options NONE, COLUMN",TODO,Tue Jan 20 01:04:15 +0530 2009
25
+ TODO,GEN,5,Give a decent FileChooser and FileSaver,TODO
26
+ TODO,GEN,5,Focus Traversable vs focusable,TODO
27
+ TODO,GEN,5,Action class: fire event for listeners,TODO,Thu Jan 22 20:09:50 +0530 2009
28
+ TODO,FIELD,5,Field: Auto-skip when reaching end of maxlen,TODO
@@ -0,0 +1,21 @@
1
+ Eric S. Raymond, in his book The Art of Unix Programming,[2] summarizes the Unix philosophy as the widely-used KISS Principle of "Keep it Simple, Stupid."[3] He also provides a series of design rules:
2
+
3
+ * Rule of Modularity: Write simple parts connected by clean interfaces.
4
+ * Rule of Clarity: Clarity is better than cleverness.
5
+ * Rule of Composition: Design programs to be connected to other programs.
6
+ * Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
7
+ * Rule of Simplicity: Design for simplicity; add complexity only where you must.
8
+ * Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
9
+ * Rule of Transparency: Design for visibility to make inspection and debugging easier.
10
+ * Rule of Robustness: Robustness is the child of transparency and simplicity.
11
+ * Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.[4]
12
+ * Rule of Least Surprise: In interface design, always do the least surprising thing.
13
+ * Rule of Silence: When a program has nothing surprising to say, it should say nothing.
14
+ * Rule of Repair: When you must fail, fail noisily and as soon as possible.
15
+ * Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
16
+ * Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
17
+ * Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
18
+ * Rule of Diversity: Distrust all claims for "one true way".
19
+ * Rule of Extensibility: Design for the future, because it will be here sooner than you think.
20
+
21
+
@@ -0,0 +1,11 @@
1
+ 1. Small is beautiful.
2
+ 2. Make each program do one thing well.
3
+ 3. Build a prototype as soon as possible.
4
+ 4. Choose portability over efficiency.
5
+ 5. Store data in flat text files.
6
+ 6. Use software leverage to your advantage.
7
+ 7. Use shell scripts to increase leverage and portability.
8
+ 8. Avoid captive user interfaces.
9
+ 9. Make every program a filter.
10
+
11
+
@@ -0,0 +1,495 @@
1
+ require 'rbcurse/core/util/app'
2
+ require 'sqlite3'
3
+ #require 'rbcurse/experimental/resultsettextview.rb'
4
+ require 'rbcurse/experimental/widgets/undomanager'
5
+
6
+ # @return array of table names from selected db file
7
+ def get_table_names
8
+ raise "No database file selected." unless $current_db
9
+
10
+ $tables = get_data "select name from sqlite_master"
11
+ $tables.collect!{|x| x[0] } ## 1.9 hack, but will it run on 1.8 ??
12
+ $tables
13
+ end
14
+ def get_column_names tbname
15
+ get_metadata tbname
16
+ end
17
+ def connect dbname
18
+ $current_db = dbname
19
+ $db = SQLite3::Database.new(dbname)
20
+
21
+ return $db
22
+ end
23
+ def get_data sql
24
+ $log.debug "SQL: #{sql} "
25
+ $columns, *rows = $db.execute2(sql)
26
+ $log.debug "XXX COLUMNS #{sql} "
27
+ content = rows
28
+ return nil if content.nil? or content[0].nil?
29
+ $datatypes = content[0].types #if @datatypes.nil?
30
+ return content
31
+ end
32
+ def get_metadata table
33
+ get_data "select * from #{table} limit 1"
34
+ #$columns.collect!{|x| x[0] } ## 1.9 hack, but will it run on 1.8 ??
35
+ return $columns
36
+ end
37
+ #
38
+ # creates a popup for selection given the data, and executes given block with
39
+ # following return value.
40
+ # @return [String] if mode is :single
41
+ # @return [Array] if mode is :multiple
42
+ #
43
+ def create_popup array, selection_mode=:single, &blk
44
+ require 'rbcurse/extras/widgets/rlistbox'
45
+ #raise "no block given " unless block_given?
46
+ listconfig = {'bgcolor' => 'blue', 'color' => 'white'}
47
+ url_list= RubyCurses::ListDataModel.new(array)
48
+ ht = 16
49
+ if array.length < 16
50
+ ht = array.length+1
51
+ end
52
+ pl = RubyCurses::PopupList.new do
53
+ row 4
54
+ col 10
55
+ width 30
56
+ height ht
57
+ #list url_list
58
+ list_data_model url_list
59
+ list_selection_mode selection_mode
60
+ #relative_to f
61
+ list_config listconfig
62
+ bind :PRESS do |lb|
63
+ #field.set_buffer url_list[index]
64
+ #blk.call(url_list[index]) #if &blk
65
+ #selected = []; indices.each{|i| selected << url_list[i] }
66
+ #blk.call(selected.join(", "))
67
+ if selection_mode == :single
68
+ blk.call(url_list[lb]) #if &blk
69
+ else
70
+ blk.call(lb.selected_values)
71
+ end
72
+
73
+ end
74
+ end
75
+ end
76
+
77
+ def view_data fields='*', name
78
+ stmt = "select #{fields} from #{name}"
79
+ stmt << $where_string if $where_string
80
+ stmt << $order_string if $order_string
81
+ @form.by_name['tarea'] << stmt
82
+ view_sql stmt
83
+ end
84
+ def view_sql stmt
85
+ begin
86
+ content = get_data stmt
87
+ if content.nil?
88
+ else
89
+ require 'rbcurse/core/widgets/tabular'
90
+ t = Tabular.new do |t|
91
+ t.headings = $columns
92
+ t.data=content
93
+ end
94
+ view t.render
95
+ end
96
+ rescue => err
97
+ $log.error err.to_s
98
+ $log.error(err.backtrace.join("\n"))
99
+ alert err.to_s
100
+ end
101
+ end
102
+
103
+ App.new do
104
+ header = app_header "rbcurse #{Rbcurse::VERSION}", :text_center => "Database Demo", :text_right =>"enabled"
105
+ form = @form
106
+ mylabel = "a field"
107
+ $catch_alt_digits = true # use M-1..9 in textarea
108
+ $current_table = nil
109
+ $current_db = nil # "testd.db"
110
+ connect $current_db if $current_db
111
+ def which_field
112
+ alert "curent field is #{form.get_current_field} "
113
+ end
114
+
115
+ def get_commands
116
+ %w{ which_field }
117
+ end
118
+ def help_text
119
+ <<-eos
120
+ DBDEMO HELP
121
+
122
+ This is some help text for dbdemo.
123
+ We are testing out this feature.
124
+
125
+ Alt-d - Select a database
126
+ <Enter> on a table, view data (q to close window)
127
+ <Space> on a table, display columns in lower list
128
+
129
+ COLUMN LIST KEYS
130
+ <Space> on a column for multiple select
131
+ <Ctrl-Space> on a column for range select/deselect from previous selection
132
+ <Enter> on column table to view data for selected columns
133
+ u unselect all
134
+ a select all
135
+ * invert selection
136
+ F4 View data for selected table (or columns if selected)
137
+
138
+ q or C-q Close the data window that comes on Enter or F4
139
+
140
+ Alt-x - Command mode (<tab> to see commands and select)
141
+ : - Command mode
142
+ Alt-z - Commands in TextArea
143
+
144
+ DB BROWSER KEYS
145
+
146
+ , Prev row (mnemonic <)
147
+ . Next row (mnemonic >)
148
+ < First row
149
+ > Last row
150
+
151
+ F10 - Quit application
152
+
153
+
154
+
155
+ -----------------------------------------------------------------------
156
+ Hope you enjoyed this help.
157
+ eos
158
+ end
159
+ def ask_databases
160
+ names = Dir.glob("*.{sqlite,db}")
161
+ if names
162
+ create_popup( names,:single) {|value| connect(value);
163
+ @form.by_name["tlist"].list(get_table_names)
164
+ }
165
+ else
166
+ alert "Can't find a .db or .sqlite file"
167
+ end
168
+ end
169
+ # TODO accelerators and
170
+ # getting a handle for later use
171
+ mb = menubar do
172
+ keep_visible true
173
+ #@toggle_key=KEY_F2
174
+ menu "File" do
175
+ item "Open", "O" do
176
+ accelerator "Ctrl-O"
177
+ command do
178
+ alert "HA!! you wanted to open a file?"
179
+ end
180
+ end
181
+ menu "Database" do
182
+ item_list do
183
+ Dir.glob("**/*.{sqlite,db}")
184
+ end
185
+ command do |menuitem, text|
186
+ connect text
187
+ form.by_name["tlist"].list(get_table_names)
188
+ end
189
+ end
190
+ menu "Tables" do
191
+ item_list do
192
+ if $current_db
193
+ get_table_names
194
+ end
195
+ end
196
+ command do |menuitem, text|
197
+ $current_table = text
198
+ #alert(get_column_names(text).join(", "))
199
+ create_popup(get_column_names(text), :multiple) { |value| view_data( value.join(","), text) }
200
+ end
201
+ end
202
+ item "New", "N"
203
+ separator
204
+ item "Exit", "x" do
205
+ command do
206
+ throw(:close)
207
+ end
208
+ end
209
+ item "Cancel Menu" do
210
+ accelerator "Ctrl-g"
211
+ end
212
+
213
+ end # menu
214
+ menu "Window" do
215
+ item "Tile", "T"
216
+ menu "Find" do
217
+ item "More", "M"
218
+ $x = item "Less", "L" do
219
+ #accelerator "Ctrl-X"
220
+ command do
221
+ alert "You clickses on Less"
222
+ end
223
+ end
224
+ menu "Size" do
225
+ item "Zoom", "Z"
226
+ item "Maximize", "X"
227
+ item "Minimize", "N"
228
+ end
229
+ end
230
+ end
231
+ menu "Others" do
232
+ require 'rbcurse/core/include/appmethods.rb'
233
+ item "Shell Output" do
234
+ command { shell_output }
235
+ end
236
+ item "Suspend" do
237
+ command { suspend }
238
+ end
239
+ end
240
+ end # menubar
241
+ mb.toggle_key = FFI::NCurses::KEY_F2
242
+ mb.color = :white
243
+ mb.bgcolor = :blue
244
+ @form.set_menu_bar mb
245
+ tv = nil
246
+ col1w = 20
247
+ stack :margin => 0, :width => col1w do
248
+ text = "No tables"
249
+ if !$current_db
250
+ text = "Select DB first. Press Alt-D"
251
+ end
252
+ tlist = basiclist :name => "tlist", :list => [text], :title => "Tables", :height => 10,
253
+ :selected_color => 'cyan', :selected_bgcolor => 'black' , :selected_attr => Ncurses::A_REVERSE,
254
+ :help_text => "Enter to View complete table, Space to select table and view columns",
255
+ :should_show_focus => true
256
+ tlist.bind(:PRESS) do |eve|
257
+ if $current_db
258
+ # get data of table
259
+ view_data eve.text
260
+ tv.sqlite $current_db, eve.text, "select * from #{eve.text} "
261
+ else
262
+ ask_databases
263
+ end
264
+ end
265
+ tlist.bind(:ENTER_ROW) do |eve|
266
+ # too much confusion between selected and focussed row
267
+ #$current_table = eve.text if $db
268
+ end
269
+ clist = basiclist :name => "clist", :list => ["No columns"], :title => "Columns", :height => 14,
270
+ :selection_mode => :multiple,
271
+ :selected_color => 'cyan', :selected_bgcolor => 'black' , :selected_attr => Ncurses::A_REVERSE,
272
+ :help_text => "Enter to View selected fields, Space to select columns, w - where, o-order"
273
+ tlist.bind(:LIST_SELECTION_EVENT) do |eve|
274
+ $selected_table = eve.source[eve.firstrow]
275
+ $current_table = $selected_table
276
+ clist.data = get_column_names $selected_table
277
+ end
278
+ clist.bind(:PRESS) do |eve|
279
+ # get data of table
280
+ if $selected_table
281
+ cols = "*"
282
+ c = clist.get_selected_values
283
+ unless c.empty?
284
+ cols = c.join(",")
285
+ end
286
+ view_data cols, $selected_table
287
+ else
288
+ alert "Select a table first."
289
+ end
290
+ end
291
+ clist.bind_key('w') {
292
+ c = clist.current_value
293
+ $where_columns ||= []
294
+ hist = ["#{c} = "]
295
+ w = ask("(UP arrow to edit) where "){ |q| q.default = "#{c} = "; q.history = hist }
296
+ $where_columns << w if w
297
+ message "where: #{$where_columns.last}. Press F4 when done"
298
+ $log.debug "XXX: WHERE: #{$where_columns} "
299
+ }
300
+ clist.bind_key('o') {
301
+ c = clist.current_value
302
+ $order_columns ||= []
303
+ $order_columns << c if c
304
+ message "order (asc): #{$order_columns.last}. Press F4 when done"
305
+ $log.debug "XXX: ORDER: #{$order_columns} "
306
+ }
307
+ clist.bind_key('O') {
308
+ c = clist.current_value
309
+ $order_columns ||= []
310
+ $order_columns << " #{c} desc " if c
311
+ message "order: #{$order_columns.last}"
312
+ $log.debug "XXX: ORDER: #{$order_columns}. Press F4 when done"
313
+ }
314
+ @statusline = status_line
315
+ #wg = get_color($datacolor, 'white','green')
316
+ #wb = get_color($datacolor, 'white','blue')
317
+ @statusline.command {
318
+ # trying this out. If you want a persistent message that remains till the next on
319
+ # then send it in as $status_message
320
+ text = $status_message.value || ""
321
+ if !$current_db
322
+ #"[%-s] %s" % [ "Select a Database", text]
323
+ "[%-s] %s" % [ "#[bg=red,fg=yellow]Select a Database#[end]", text]
324
+ #[ [nil, "%-22s" % Time.now, nil], [$errorcolor, " [Select a Database ]", FFI::NCurses::A_BOLD], [nil, text, nil] ]
325
+ elsif !$current_table
326
+ "[DB: #[fg=white,bg=blue]%-s#[end] | %-s ] %s" % [ $current_db || "None", $current_table || "#[bg=red,fg=yellow]Select a table#[end]", text]
327
+ #[ [nil, "%-22s [DB: %-s | " % [Time.now, $current_db || "None" ],nil], [$errorcolor, " Select a Table ]", FFI::NCurses::A_BOLD], [nil, text, nil] ]
328
+ else
329
+ "DB: #[fg=white,bg=green,bold]%-s#[end] | #[bold]%-s#[end] ] %s" % [ $current_db || "None", $current_table || "----", text]
330
+ #[ [nil, "%-22s [DB: " % Time.now, nil], [wb, " #{$current_db} ", FFI::NCurses::A_BOLD],
331
+ #[wg, $current_table || "----", FFI::NCurses::A_BOLD], [nil, text, nil] ]
332
+ end
333
+ }
334
+ @adock = nil
335
+ keyarray = [
336
+ ["F1" , "Help"], ["F10" , "Exit"],
337
+ ["F2", "Menu"], ["F4", "View"],
338
+ ["M-d", "Datebase"], ["M-t", "Table"],
339
+ ["M-x", "Command"], nil
340
+ ]
341
+ tlist_keyarray = keyarray + [ ["Sp", "Select"], nil, ["Enter","View"] ]
342
+
343
+ clist_keyarray = keyarray + [ ["Sp", "Select"], ["C-sp", "Range Sel"],
344
+ ["Enter","View"], ['w', 'where'],
345
+ ["o","order by"], ['O', 'order desc']
346
+ ]
347
+ tarea_keyarray = keyarray + [ ["M-z", "Commands"], nil ]
348
+ #tarea_sub_keyarray = [ ["r", "Run"], ["c", "clear"], ["w","Save"], ["a", "Append next"],
349
+ #["y", "Yank"], ["Y", "yank pop"] ]
350
+ tarea_sub_keyarray = [ ["r", "Run"], ["c", "clear"], ["w","Kill Ring Save (M-w)"], ["a", "Append Next"],
351
+ ["y", "Yank (C-y)"], ["Y", "yank pop (M-y)"],
352
+ ["u", "Undo (C-_)"], ["R", "Redo (C-r)"],
353
+ ]
354
+
355
+ gw = get_color($reversecolor, 'green', 'black')
356
+ @adock = dock keyarray, { :row => Ncurses.LINES-2, :footer_color_pair => $datacolor,
357
+ :footer_mnemonic_color_pair => gw }
358
+ @adock.set_key_labels tlist_keyarray, :tables
359
+ @adock.set_key_labels clist_keyarray, :columns
360
+ @adock.set_key_labels tarea_sub_keyarray, :tarea_sub
361
+ @adock.set_key_labels tarea_keyarray, :tarea
362
+ tlist.bind(:ENTER) { @adock.mode :tables }
363
+ clist.bind(:ENTER) { @adock.mode :columns }
364
+
365
+ reduce = lambda { |obj|
366
+ obj.height -= 1 if obj.height > 3
367
+ }
368
+ increase = lambda { |obj|
369
+ obj.height += 1 if obj.height + obj.row < Ncurses.LINES-2
370
+ }
371
+ _lower = lambda { |obj|
372
+ obj.row += 1 if obj.height + obj.row < Ncurses.LINES-2
373
+ }
374
+ _raise = lambda { |obj|
375
+ obj.row -= 1 if obj.row > 2
376
+ }
377
+ [clist, tlist].each do |o|
378
+ o.bind_key([?\C-x, ?-]){ |o| reduce.call(o) }
379
+ o.bind_key([?\C-x, ?+]){ |o| increase.call(o) }
380
+ o.bind_key([?\C-x, ?v]){ |o| _lower.call(o) }
381
+ o.bind_key([?\C-x, ?6]){ |o| _raise.call(o) }
382
+ end
383
+
384
+
385
+ @form.bind_key([?q,?q]) { throw :close }
386
+ @form.bind_key(?\M-t) do
387
+ if $current_db.nil?
388
+ alert "Please select database first"
389
+ else
390
+ create_popup( get_table_names,:single) {|value| $selected_table = $current_table = value}
391
+ end
392
+ end
393
+ @form.bind_key(?\M-d) do
394
+ ask_databases
395
+ end
396
+ @form.bind_key(FFI::NCurses::KEY_F4) do
397
+ $where_string = nil
398
+ $order_string = nil
399
+ if $where_columns
400
+ $where_string = " where " + $where_columns.join(" and ")
401
+ end
402
+ if $order_columns
403
+ $order_string = " order by " + $order_columns.join(" , ")
404
+ end
405
+ # mismatch between current and selected table
406
+ if $current_table
407
+ cols = "*"
408
+ c = clist.get_selected_values
409
+ unless c.empty?
410
+ cols = c.join(",")
411
+ end
412
+ view_data cols, $current_table
413
+ else
414
+ alert "Select a table first."
415
+ end
416
+ end
417
+ end # stack
418
+ stack :margin => col1w+1, :width => :EXPAND do
419
+ tarea = textarea :name => 'tarea', :height => 5, :title => 'Sql Statement'
420
+ undom = SimpleUndo.new tarea
421
+ tarea.bind_key(Ncurses::KEY_F4) do
422
+ text = tarea.get_text
423
+ if text == ""
424
+ alert "Please enter a query and then hit F4. Or press F4 over column list"
425
+ else
426
+ view_sql tarea.get_text
427
+ end
428
+ end
429
+ tarea.bind(:ENTER) { @adock.mode :tarea }
430
+ tarea.bind_key(?\M-z){
431
+
432
+ hash = { 'c' => lambda{ tarea.remove_all },
433
+ 'w' => lambda{ tarea.kill_ring_save },
434
+ 'a' => lambda{ tarea.append_next_kill },
435
+ 'y' => lambda{ tarea.yank },
436
+ 'Y' => lambda{ tarea.yank_pop },
437
+ 'r' => lambda{ view_sql tarea.get_text },
438
+ 'u' => lambda{ tarea.undo },
439
+ 'R' => lambda{ tarea.redo },
440
+ }
441
+
442
+
443
+ @adock.mode :tarea_sub
444
+ @adock.repaint
445
+ keys = @adock.get_current_keys
446
+ while((ch = @window.getchar()) != ?\C-c.getbyte(0) )
447
+ if ch < 33 || ch > 126
448
+ Ncurses.beep
449
+ elsif !keys.include?(ch.chr)
450
+ Ncurses.beep
451
+ else
452
+ hash.fetch(ch.chr).call
453
+ #opt_file ch.chr
454
+ break
455
+ end
456
+ end
457
+ @adock.mode :normal
458
+ } # M-z
459
+ flow do
460
+ #button_row = 17
461
+ button "Save" do
462
+ @cmd_history ||= []
463
+ filename = ask("File to append contents to: ") { |q| q.default = @oldfilename; q.history = @cmd_history }
464
+
465
+ if filename
466
+ str = tarea.get_text
467
+ File.open(filename, 'a') {|f| f.write(str) }
468
+ @oldfilename = filename
469
+ @cmd_history << filename unless @cmd_history.include? filename
470
+
471
+ message "Appended data to #{filename}"
472
+ else
473
+ message "Aborted operation"
474
+ end
475
+ hide_bottomline
476
+ end
477
+ button "Read" do
478
+ filter = "*"
479
+ str = choose filter, :title => "Files", :prompt => "Choose a file: "
480
+ begin
481
+ tarea.set_content(str)
482
+ message "Read content from #{str} "
483
+ rescue => err
484
+ say_with_pause "No file named: #{str}: #{err.to_s} "
485
+ end
486
+ end
487
+ #ok_button = button( [button_row,30], "OK", {:mnemonic => 'O'}) do
488
+ #end
489
+ end
490
+ blank
491
+ #tv = RubyCurses::ResultsetTextView.new @form, :row => 1, :col => 1, :width => 50, :height => 16
492
+ tv = resultsettextview :name => 'resultset', :height => 18 , :title => 'DB Browser', :print_footer => true
493
+
494
+ end
495
+ end # app