class RBT::GUI::UniversalWidgets::Statistics
Constants
- EXPLANATION_ABOUT_THE_PURPOSE_OF_THIS_WIDGET
#¶ ↑
EXPLANATION_ABOUT_THE_PURPOSE_OF_THIS_WIDGET
¶ ↑#¶ ↑
- HEIGHT
#¶ ↑
HEIGHT
¶ ↑#¶ ↑
- LARGER_FONT
#¶ ↑
LARGER_FONT
¶ ↑#¶ ↑
- SMALLER_FONT
#¶ ↑
SMALLER_FONT
¶ ↑#¶ ↑
- TITLE
#¶ ↑
TITLE
¶ ↑#¶ ↑
- USE_THESE_CSS_RULES
#¶ ↑
USE_THESE_CSS_RULES
¶ ↑#¶ ↑
- USE_THIS_FONT
#¶ ↑
USE_THIS_FONT
¶ ↑#¶ ↑
- WIDTH
#¶ ↑
WIDTH
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = nil, run_already = true )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype::new
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 90 def initialize( commandline_arguments = nil, run_already = true ) super(:vertical) if use_gtk3? determine_the_GUI_to_be_used(commandline_arguments) # This must come first, even before reset(). reset set_commandline_arguments( commandline_arguments ) on_delete_event_quit_the_application run if run_already end
run( i = ARGV )
click to toggle source
#¶ ↑
RBT::GUI::Gtk::Statistics.run¶ ↑
#¶ ↑
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 470 def self.run( i = ARGV ) require 'gtk_paradise/run' _ = ::RBT::GUI::Gtk::Statistics.new(i) r = ::Gtk.run _.set_parent_widget(r) # Must come before we enable the key-combinations. r << _ r.automatic_size_then_automatic_title r.enable_quick_exit r.set_background :white r.top_left_then_run end
Public Instance Methods
border_size?()
click to toggle source
connect_the_skeleton()
click to toggle source
#¶ ↑
connect_the_skeleton
(connect tag)¶ ↑
#¶ ↑
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 423 def connect_the_skeleton abort_on_exception outer_vbox = create_vbox # A new vbox. style_the_treeview_properly make_the_treeview_sortable on_right_mouse_button_deselect_the_treeview_selection container_for_the_treeview = vbox container_for_the_treeview.maximal(@treeview, 10) @scrolled_window.add(container_for_the_treeview) @scrolled_window.set_size_request(820, 820) info_text = bold_text(EXPLANATION_ABOUT_THE_PURPOSE_OF_THIS_WIDGET) outer_vbox.maximal(info_text, 20) outer_vbox.maximal(@scrolled_window) small_container = create_vbox small_container.minimal(@button_update_the_tree_view, 2) small_container.hcenter # @button_update_the_tree_view.hcenter # @button_update_the_tree_view.align_to_center #_.minimal(small_container) outer_vbox.minimal(small_container, 12) window = create_window_or_runner window << outer_vbox properly_prepare_this_window(window, { title: title?, font: font?, width: width?, height: height?, padding: padding?, border_size: border_size? } ) window.show_all window.top_left do_all_startup_related_actions run_main end
create_the_liststore()
click to toggle source
create_the_scrolled_window()
click to toggle source
create_the_skeleton()
click to toggle source
create_the_treeview()
click to toggle source
#¶ ↑
create_the_treeview
¶ ↑
#¶ ↑
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 292 def create_the_treeview # ======================================================================= # # === @treeview # ======================================================================= # @treeview = tree_view @treeview.the_headers_are_clickable @treeview.enable_search # Enable searching. @treeview.rubber_banding @treeview.enable_drag_and_drop @treeview.all_are_sortable @treeview.allow_resizing @treeview.set_reorderable(true) @treeview.set_size_request(500, 800) end
do_prepare_the_list_store( i = @list_store )
click to toggle source
#¶ ↑
do_prepare_the_list_store
¶ ↑
#¶ ↑
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 192 def do_prepare_the_list_store( i = @list_store ) # ======================================================================= # # Define the dataset that is to be used for this widget. # ======================================================================= # use_this_dataset = return_time_sorted_dataset index = 0 use_this_dataset.each {|name_of_the_program, compile_time| index += 1 iter = i.append iter.set_value(0, index.to_s.rjust(2, ' ')) iter.set_value(1, name_of_the_program) _ = ('%.2f' % compile_time.round(2)).rjust(10,' ') iter.set_value(2, _) # ===================================================================== # # Next, set the time in n minutes # ===================================================================== # new_value = (_.strip.to_f / 60.0).round(2).to_s new_value = '%.2f' % new_value.to_f iter.set_value( 3, new_value ) } end
Also aliased as: populate
favicon?()
click to toggle source
handle_CSS_rules()
click to toggle source
hash?()
click to toggle source
list_store?()
click to toggle source
make_the_treeview_sortable()
click to toggle source
#¶ ↑
make_the_treeview_sortable
¶ ↑
#¶ ↑
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 163 def make_the_treeview_sortable columns = @treeview.columns? columns[0].sortable_based_on(0) columns[0].align_to_the_center columns[1].sortable_based_on(1) columns[1].align_to_the_center columns[2].sortable_based_on(2) columns[2].align_to_the_center columns[3].sortable_based_on(3) columns[3].align_to_the_center # ======================================================================= # # Use a custom sort-function next. # ======================================================================= # list_store?.set_sort_func(2) { |_model, iter1, iter2| iter2[2].to_f <=> iter1[2].to_f } # ======================================================================= # # Sort the minutes as well. # ======================================================================= # list_store?.set_sort_func(3) { |_model, iter1, iter2| iter2[3].to_f <=> iter1[3].to_f } end
padding?()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 107 def reset super() if respond_to?(:super) reset_the_shared_module # This can come early. reset_the_base_module reset_the_internal_variables infer_the_namespace # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, namespace?] # ======================================================================= # # === Set the title, width, height and the font in use. # ======================================================================= # title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT) if use_gtk3? handle_CSS_rules end infer_the_size_automatically # ======================================================================= # # === @compile_time_statistics # # The next instance-variable is a Hash. We will tap into class Shell # for this information. # ======================================================================= # @compile_time_statistics = ::RBT::Installer::Shell.new(:dont_run_yet).return_compile_time if @compile_time_statistics.nil? e 'No statistics were found. Exiting now.' exit end end
return_time_sorted_dataset()
click to toggle source
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 416 def run run_super end
Also aliased as: start_gui_application
smaller_font?()
click to toggle source
style_the_treeview_properly()
click to toggle source
#¶ ↑
style_the_treeview_properly
¶ ↑
#¶ ↑
# File lib/rbt/gui/universal_widgets/statistics/statistics.rb, line 341 def style_the_treeview_properly # ======================================================================= # # Create a new GtkCellRendererText, add it to the tree # view column and append the column to the tree view. # ======================================================================= # renderer = cell_renderer_text renderer.foreground = '#0c087d' # This is a darkblue colour. renderer_centered = centered_cell_renderer_text renderer_centered.xalign = 0.5 # Center it here. very_left_column = tree_view_column( '#', renderer_centered, text: 0 ) very_left_column.center @treeview.append_column(very_left_column) # ======================================================================= # # === Name of the program # ======================================================================= # left_column = tree_view_column( 'Name of the program', renderer, text: 1 ) left_column.set_alignment(0.5) @treeview.append_column(left_column) renderer = cell_renderer_text renderer.foreground = '#037317' # This is a darkgreen colour. # ======================================================================= # # === right_column # ======================================================================= # right_column = tree_view_column( 'Time (in seconds)', renderer_centered, text: 2 ) right_column.alignment = 0.5 @treeview.append_column(right_column) # ======================================================================= # # === righter_column # ======================================================================= # righter_column = tree_view_column( 'Time (in minutes)', renderer_centered, text: 3 ) @treeview.append_column(righter_column) do_prepare_the_list_store(@list_store) @treeview.model = @list_store @treeview.on_button_press_event { |widget, event| if double_click?(event) # Act on double-click events. selected = @treeview.selection.selected[1] e ::Colours.steelblue(selected) end } end