Skip to content

Instantly share code, notes, and snippets.

@indrekj
Created January 10, 2010 16:34
Show Gist options
  • Save indrekj/273597 to your computer and use it in GitHub Desktop.
Save indrekj/273597 to your computer and use it in GitHub Desktop.
require 'rubygems'
gem 'ncurses'
require 'logger'
require 'rbcurse'
require 'rbcurse/rtabbedpane'
require 'rbcurse/rtextarea'
$log = Logger.new('view.log')
$log.level = Logger::DEBUG
begin
VER::start_ncurses
@window = VER::Window.root_window
@form = Form.new(@window)
@tp = RubyCurses::TabbedPane.new(@form,
:height => 21,
:width => 80,
:row => 1,
:col => 1,
:button_type => :ok
)
@tab1 = @tp.add_tab('&Global')
@system_log = RubyCurses::TextArea.new(@tab1.form,
:title => 'System log',
:title_attrib => (Ncurses::A_REVERSE | Ncurses::A_BOLD),
:row => 1,
:col => 1,
:width => 55,
:height => 15,
:editable => false,
:focusable => false,
:auto_scroll => true
)
@form.repaint
@window.wrefresh
Ncurses::Panel.update_panels
while((ch = @window.getchar()) != ?q.getbyte(0))
@form.handle_key(ch)
@window.wrefresh
end
rescue Exception => e
$log.error "Exception: #{e}"
$log.error e.backtrace.join("\n")
end
D, [2010-01-10T18:34:06.185241 #12556] DEBUG -- : #<RubyCurses::Form:0x0000000242e148> adding a widget 0 .. #<RubyCurses::TabbedPane:0x0000000242d968>
D, [2010-01-10T18:34:06.185333 #12556] DEBUG -- : setting graphic to form window for RubyCurses::TabbedPane, RubyCurses::Form
D, [2010-01-10T18:34:06.185565 #12556] DEBUG -- : #<RubyCurses::Form:0x00000002421f08> adding a widget 0 ..
D, [2010-01-10T18:34:06.185600 #12556] DEBUG -- : setting graphic to form window for RubyCurses::TextArea, RubyCurses::Form
D, [2010-01-10T18:34:06.185634 #12556] DEBUG -- : RubyCurses::TextArea CB called with H: 15 W 55
D, [2010-01-10T18:34:06.185667 #12556] DEBUG -- : pad printborder 1 - 2 , 1 - 0, 14 , 55
D, [2010-01-10T18:34:06.185696 #12556] DEBUG -- : inside print_border r -1 c 1 h 14 w 55
D, [2010-01-10T18:34:06.186058 #12556] DEBUG -- : create_window R 1, C 1 21 80
D, [2010-01-10T18:34:06.186093 #12556] DEBUG -- : RubyCurses::TabbedPane CB called with H: 21 W 80
D, [2010-01-10T18:34:06.186123 #12556] DEBUG -- : WINDOW PAD #<VER::Window:0x00000002432828>
D, [2010-01-10T18:34:06.186223 #12556] DEBUG -- : #<RubyCurses::TabbedButton:0x000000023fc620> setting MNEMO to G 231
D, [2010-01-10T18:34:06.186265 #12556] DEBUG -- : called bind_key BIND 231 M-g
D, [2010-01-10T18:34:06.186313 #12556] DEBUG -- : #<RubyCurses::Form:0x000000023fd928> adding a widget 0 .. #<RubyCurses::TabbedButton:0x000000023fc620>
D, [2010-01-10T18:34:06.186345 #12556] DEBUG -- : setting graphic to form window for RubyCurses::TabbedButton, RubyCurses::Form
D, [2010-01-10T18:34:06.186381 #12556] DEBUG -- : Global bound PRESS
D, [2010-01-10T18:34:06.186414 #12556] DEBUG -- : TabbedBUTTon repaint : RubyCurses::TabbedButton r:1 c:1 Global
D, [2010-01-10T18:34:06.186445 #12556] DEBUG -- : TabbedBUTTon repaint : ELSE ,
D, [2010-01-10T18:34:06.186528 #12556] DEBUG -- : form repaint parent_buffer () if : &Global
D, [2010-01-10T18:34:06.186582 #12556] DEBUG -- : form repaint calling select field 0 SHOULD HAPPEN FIRST TIME ONLY
D, [2010-01-10T18:34:06.186612 #12556] DEBUG -- : insdie sele nxt field : -1 WL:1
D, [2010-01-10T18:34:06.186661 #12556] DEBUG -- : def fire_handler evt:LEAVE, o: #<RubyCurses::TabbedButton:0x000000023fc620>, #<RubyCurses::TabbedButton:0x000000023fc620>, hdnler:{:PRESS=>[#<Proc:0x000000023f3c88@/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rtabbedpane.rb:198>]}
D, [2010-01-10T18:34:06.186695 #12556] DEBUG -- : def fire_handler evt:LEAVE, o: #<RubyCurses::TabbedButton:0x000000023fc620>, #<RubyCurses::Form:0x000000023fd928>, hdnler:{}
D, [2010-01-10T18:34:06.186727 #12556] DEBUG -- : insdie sele nxt field : i 0 0 WL:1, field #<RubyCurses::TabbedButton:0x000000023fc620>
D, [2010-01-10T18:34:06.186778 #12556] DEBUG -- : def fire_handler evt:ENTER, o: #<RubyCurses::TabbedButton:0x000000023fc620>, #<RubyCurses::TabbedButton:0x000000023fc620>, hdnler:{:PRESS=>[#<Proc:0x000000023f3c88@/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rtabbedpane.rb:198>]}
D, [2010-01-10T18:34:06.186810 #12556] DEBUG -- : def fire_handler evt:ENTER, o: #<RubyCurses::TabbedButton:0x000000023fc620>, #<RubyCurses::Form:0x000000023fd928>, hdnler:{}
D, [2010-01-10T18:34:06.186842 #12556] DEBUG -- : TabbedBUTTon repaint : RubyCurses::TabbedButton r:1 c:1 Global
D, [2010-01-10T18:34:06.186873 #12556] DEBUG -- : TabbedBUTTon repaint : HIGHLIGHTED black, white
D, [2010-01-10T18:34:06.186936 #12556] DEBUG -- : form repaint parent_buffer () if : &Global
D, [2010-01-10T18:34:06.186989 #12556] DEBUG -- : setpos : 1 2
D, [2010-01-10T18:34:06.187021 #12556] DEBUG -- : XXX calling window.wrefresh COOMENTED OFF FOR TABBEDPANE 2009-11-02 23:08
D, [2010-01-10T18:34:06.187700 #12556] DEBUG -- : setpos : 1 2
D, [2010-01-10T18:34:06.187734 #12556] DEBUG -- : XXX calling window.wrefresh COOMENTED OFF FOR TABBEDPANE 2009-11-02 23:08
D, [2010-01-10T18:34:06.187811 #12556] DEBUG -- : def fire_handler evt:PRESS, o: #<RubyCurses::ItemEvent:0x000000023d5598>, #<RubyCurses::TabbedButton:0x000000023fc620>, hdnler:{:PRESS=>[#<Proc:0x000000023f3c88@/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rtabbedpane.rb:198>]}
D, [2010-01-10T18:34:06.187845 #12556] DEBUG -- : #<RubyCurses::TabbedButton:0x000000023fc620> called EventHandler firehander &Global, PRESS
D, [2010-01-10T18:34:06.187871 #12556] DEBUG -- : calling display form from button press
D, [2010-01-10T18:34:06.187897 #12556] DEBUG -- : before pad copy
D, [2010-01-10T18:34:06.187927 #12556] DEBUG -- : ... niside smaxrow 19 + 2 -1 - 0
E, [2010-01-10T18:34:06.187999 #12556] ERROR -- : Exception: undefined method `smaxrow' for Ncurses:Module
E, [2010-01-10T18:34:06.188032 #12556] ERROR -- : /usr/lib/ruby1.9.1/gems/1.9.1/gems/ncurses-1.2.4/lib/ncurses.rb:75:in `method_missing'
/home/innu/pidgin-text/vendor/rbcurse/lib/ver/window.rb:89:in `method_missing'
/home/innu/pidgin-text/vendor/rbcurse/lib/ver/window.rb:593:in `copy_pad_to_win'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rtabbedpane.rb:214:in `display_form'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rtabbedpane.rb:199:in `block (2 levels) in create_window'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:217:in `call'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:217:in `block in fire_handler'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:214:in `each'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:214:in `each_with_index'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:214:in `fire_handler'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:1965:in `fire'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:2053:in `fire'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rtabbedpane.rb:207:in `create_window'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rtabbedpane.rb:142:in `repaint'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:833:in `block in repaint'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:831:in `each'
/home/innu/pidgin-text/vendor/rbcurse/lib/rbcurse/rwidget.rb:831:in `repaint'
test.rb:49:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment