class EnvironmentInformation::EnvironmentInformation::GUI::GtkEnvironmentInformation
Constants
- HEIGHT
#¶ ↑
HEIGHT
¶ ↑#¶ ↑
- N
#¶ ↑
N
¶ ↑#¶ ↑
- WIDTH
#¶ ↑
WIDTH
¶ ↑#¶ ↑
Public Class Methods
height()
click to toggle source
new( run_already = true )
click to toggle source
Public Instance Methods
create_gtk_tree_view()
click to toggle source
#¶ ↑
create_gtk_tree_view
¶ ↑
#¶ ↑
# File lib/environment_information/gui/gtk/bindings.rb, line 99 def create_gtk_tree_view @tree_view = Gtk::TreeView.new(@list_store) # rf ruby gtk_TreeView @tree_view.do_select_multiple # Allow multiple selections. @tree_view.use_clickable_headers @tree_view.enable_model_drag_source( Gdk::Window::BUTTON1_MASK, [ ['GTK_TREE_MODEL_ROW', 0, 0] ], Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE ) @tree_view.enable_model_drag_dest([ ['GTK_TREE_MODEL_ROW', 0, 0] ], Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE ) @tree_view.signal_connect(:row_activated) { # puts "hello" } @tree_view.signal_connect(:button_press_event) { |widget, event| if event.event_type == Gdk::Event::BUTTON2_PRESS and event.button == 1 # event.event_type.name puts 'MouseButton: Doppelklick' end } @tree_view.selection.set_mode(Gtk::SelectionMode::MULTIPLE) @tree_view.selection.signal_connect(:changed) {|entry| entry.selected_each {|model, path, inner_array| if @display_information_on_the_commandline if inner_array[0] name_of_the_program = inner_array[0].strip else name_of_the_program = '(unknown' end version_of_the_program = inner_array[1] result = Colours.steelblue( name_of_the_program.ljust(25) ).dup if ::EnvironmentInformation.is_this_a_registered_program?(name_of_the_program) result << 'Version: ' end result << Colours.lightgreen(version_of_the_program.to_s) e result end } } end
currently_selected()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
# File lib/environment_information/gui/gtk/bindings.rb, line 82 def reset # ======================================================================= # # === @data # ======================================================================= # @data = ::EnvironmentInformation.initialize_hash # ======================================================================= # # === @display_information_on_the_commandline # # If the next variable is set to true then information will be # displayed on the commandline. # ======================================================================= # @display_information_on_the_commandline = true end
run()
click to toggle source
#¶ ↑
run¶ ↑
#¶ ↑
# File lib/environment_information/gui/gtk/bindings.rb, line 158 def run @list_store = Gtk::ListStore.new(String, String) create_gtk_tree_view @renderer = gtk_cell_renderer_text # ======================================================================= # # Append the information contained in our @data variable to the # ListStore object next. # ======================================================================= # @data.each {|line| name, version = *line # Decompose line. iter = @list_store.append if version.nil? or version.to_s.empty? version = '[Not installed.]' end iter.set_value(0, name) iter.set_value(1, version) } @tree_view.insert_column(-1, 'Name', @renderer, text: 0) @tree_view.insert_column(-1, 'Version', @renderer, text: 1) @tree_view.headers_clickable = true @tree_view.signal_connect(:key_press_event) { |w, event| case Gdk::Keyval.to_name(event.keyval) when 'Return','KP_Enter' e currently_selected end } File.delete('gmon.out') if File.exist? 'gmon.out' # Don't keep gmon.out @scrolled_window = gtk_scrolled_window @scrolled_window.add_with_viewport(@tree_view) add(@scrolled_window) show_all end