Class: AboutWindow
- Inherits:
-
Object
- Object
- AboutWindow
- Defined in:
- lib/gui/about_window.rb
Overview
About window class
Instance Method Summary collapse
-
#initialize ⇒ AboutWindow
constructor
show the “about window”.
Constructor Details
#initialize ⇒ AboutWindow
show the “about window”. Dylan,Yin June 18th,2009 #
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/gui/about_window.rb', line 12 def initialize() about = Gtk::Window.new about.set_size_request(350,420) about.set_title "About GNMS" about.resizable=false about.window_position=Gtk::Window::POS_CENTER icon_name="#{PIXMAP_PATH}/logo_icon.png" Gtk::Window.set_default_icon(icon_name) about.show about.signal_connect("destroy") { about.destroy } about.signal_connect("key_press_event") {|w,e| if !@inthread if e.keyval == 65307 #Esc key press about.destroy end end } vboxb = Gtk::VBox.new(false,5) vboxb.show about.add vboxb vboxb.border_width=5 pxb = Gdk::Pixbuf.new("#{PIXMAP_PATH}/logo_icon.png",64,64) image = Gtk::Image.new(pxb) image.show hboxb = Gtk::HBox.new(false,0) hboxb.show vboxb.add hboxb vboxb1 = Gtk::VBox.new(false,0) vboxb1.show label_version = Gtk::Label.new label_version.show label_version.set_size_request(270,80) label_version.wrap=true label_version.set_markup("<span weight=\"bold\" size=\"xx-large\">GNMS #{GNMSVERSION}</span>",true) label_infor = Gtk::Label.new label_infor.show label_infor.set_size_request(270,90) label_infor.wrap=true label_infor.set_markup("<span size=\"large\">Gnome Network Management System, for monitoring ip elements.</span>",true) vboxb1.pack_start_defaults(label_version) vboxb1.pack_start_defaults(label_infor) hboxb.pack_start_defaults(image) hboxb.pack_start_defaults(vboxb1) hboxb.set_size_request(350,140) hboxb1 = Gtk::HBox.new(false,0) hboxb1.show label_credit = Gtk::Label.new label_credit.show label_credit.text="Credit:" label_blank = Gtk::Label.new label_blank.show label_blank.text="" vboxb2 = Gtk::VBox.new(false,0) vboxb2.show vboxb2.pack_start_defaults(label_credit) vboxb2.pack_start_defaults(label_blank) vboxb2.set_size_request(80,-1) vboxb3 = Gtk::VBox.new(false,0) vboxb3.show AUTHORS.each {|auth| label_developer1 = Gtk::Label.new label_developer1.show label_developer1.text=auth label_developer1.set_alignment(0,0.5) vboxb3.pack_start_defaults(label_developer1) } vboxb3.set_size_request(270,-1) vboxb.add hboxb1 hboxb1.pack_start_defaults(vboxb2) hboxb1.pack_start_defaults(vboxb3) hboxb1.set_size_request(350,40) hboxb2 = Gtk::HBox.new(false,0) hboxb2.show hboxb3 = Gtk::HBox.new(false,0) hboxb3.show #add the information table @treestore=Gtk::ListStore.new(String,String) @ctree = Gtk::TreeView.new(@treestore) @ctree.selection.mode = Gtk::SELECTION_MULTIPLE @ctree.enable_search=true @ctree.enable_tree_lines=true # Create a renderer renderer = Gtk::CellRendererText.new renderer.editable=false # Add column using our renderer col = Gtk::TreeViewColumn.new("Name", renderer, :text => 0) @ctree.append_column(col) col = Gtk::TreeViewColumn.new("Value", renderer, :text => 1) @ctree.append_column(col) @ctree.headers_visible=true @ctree.show sysinfor=get_system_infor() iter=@treestore.append iter[0]="Cpu" iter[1]=sysinfor["cpu"] iter=@treestore.append iter[0]="Memory" iter[1]=sysinfor["Memory"] iter=@treestore.append iter[0]="Hostname" iter[1]=sysinfor["hostname"] iter=@treestore.append iter[0]="OS Version" iter[1]=sysinfor["OS"] iter=@treestore.append iter[0]="Total Disk Size" iter[1]=sysinfor["Disk Size"] hboxb3.add @ctree scrolled_about = Gtk::ScrolledWindow.new(nil, nil) scrolled_about.border_width=5 scrolled_about.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_NEVER) scrolled_about.set_size_request(-1,180) hboxb2.pack_start_defaults(scrolled_about) scrolled_about.(hboxb3) scrolled_about.show vboxb.add hboxb2 hboxb4 = Gtk::HButtonBox.new hboxb4.show hboxb4.set_layout_style(Gtk::ButtonBox::END) =Gtk::Button.new(Gtk::Stock::CLOSE) .signal_connect("clicked") { about.destroy } .show .set_size_request(80,30) hboxb4.add vboxb.add hboxb4 end |