final version of refactoring, moving utility functions
[zip-doc.git] / gui.rb
blob610751ac5af31ba5ca98da26e07722172d7c6a42
1 require 'tk' 
2 require 'tk/wm'
3 class GUI
5   def initialize
6     ph = { 'padx' => 10, 'pady' => 10 }     # common options
7     open = proc {`open http://localhost:2042/`}
8     leave = proc {
9       H.stop
10       exit(0)
11     }
12     
13     root = TkRoot.new { title "Wikipedia Offline Server" }
14 #    top::Wm.focusmodel('active')
15     top = TkFrame.new(root)
16     TkLabel.new(top) {text    'The Wikipedia Server is now running.' ; pack(ph) }
17     TkLabel.new(top) {text    'It is available through http://localhost:2042/' ; pack(ph) }
19     TkButton.new(top) {text 'Open default webbrowser'; command open; pack ph}
20     TkButton.new(top) {text 'Exit'; command leave; pack ph}
21     top.pack('fill'=>'both', 'side' =>'top')
22   end
23 end