module MultimediaParadise::GUI::Gtk::PlayVideoFromMyCollectionModule
Constants
- FILE_VIDEOCAMERA
- FONT_FAMILY_TO_USE
#¶ ↑
FONT_FAMILY_TO_USE
¶ ↑#¶ ↑
- FONT_SIZE
#¶ ↑
FONT_SIZE
¶ ↑#¶ ↑
- FROM_WHERE
#¶ ↑
FROM_WHERE
¶ ↑#¶ ↑
- HEIGHT
#¶ ↑
HEIGHT
¶ ↑#¶ ↑
- MPLAYER
#¶ ↑
MPLAYER
¶ ↑#¶ ↑
- MPV
#¶ ↑
NPV¶ ↑
#¶ ↑
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
- TITLE
#¶ ↑
TITLE
¶ ↑#¶ ↑
- WIDTH
#¶ ↑
WIDTH
¶ ↑#¶ ↑
Public Class Methods
[](i = '')
click to toggle source
new( i = nil, run_already = true )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
Calls superclass method
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 98 def initialize( i = nil, run_already = true ) super('') label_widget.set_markup( '<span weight="bold" size="x-large" foreground="darkblue"> '+TITLE+' </span>' ) reset set_input(i) # ======================================================================= # # Delegate all key-press events next. # ======================================================================= # signal_connect(:key_press_event) {|widget, event| on_key_event(widget, event) } run if run_already end
padding?()
click to toggle source
run()
click to toggle source
#¶ ↑
MultimediaParadise::GUI::Gtk::PlayFromRadioStation.run¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 370 def self.run require 'gtk_paradise/run' video_collection = MultimediaParadise::GUI::Gtk::PlayVideoFromMyCollection.new(ARGV) r = ::Gtk.run r << video_collection r.set_size_request(video_collection.width?, video_collection.height?) r.signal_connect(:delete_event) { |_widget| Gtk.main_quit } r.modify_background(:normal, :lightskyblue) r.top_left_then_run end
Public Instance Methods
add_alignment()
click to toggle source
#¶ ↑
add_alignment
¶ ↑
The alignment will hold the @scrolled_window widgt.
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 271 def add_alignment padding = 0.98 @alignment = ::Gtk::Alignment.new(padding, padding, padding, padding) @alignment.set_padding(1,1,1,1) # oben,unten,links,rechts vbox = gtk_vbox vbox.minimal(@search_bar, 2) vbox.maximal(@scrolled_window, 1) @child_widget.maximal(vbox) @child_widget.set_size_request(500, 600) @alignment.add @child_widget add(@alignment) end
add_the_scrolled_window()
click to toggle source
create_skeleton()
click to toggle source
create_the_fancy_search_bar()
click to toggle source
#¶ ↑
create_the_fancy_search_bar
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 456 def create_the_fancy_search_bar @search_bar, @search_entry = drop_down_find_box @search_entry.width_height(400, 50) @search_entry.on_enter { try_to_find_a_match } end
favicon?()
click to toggle source
input?()
click to toggle source
is_video_file?(i)
click to toggle source
obtain_all_video_files()
click to toggle source
#¶ ↑
obtain_all_video_files
¶ ↑
Simply return all video files
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 178 def obtain_all_video_files from_where = '/home/x/video/Realvids/*' # Hardcoded by default. from_where = FROM_WHERE results = Dir[from_where].select {|entry| is_video_file?(entry) }.sort return results end
on_key_event( widget, event )
click to toggle source
#¶ ↑
on_key_event
¶ ↑
Cause the searchbar to show up.
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 386 def on_key_event( widget, event ) shortcut = ::Gtk.accelerator_get_label(event.keyval, event.state) # ======================================================================= # # Get support for Ctrl+F next: # ======================================================================= # if ['Ctrl+F', 'Ctrl+Mod2+F'].include? shortcut if @search_bar.search_mode? # =================================================================== # # This causes the search bar to disappear. # =================================================================== # @search_bar.disappear else # =================================================================== # # And appear here in this event. # =================================================================== # @search_bar.appear end end end
padding?()
click to toggle source
play_this_videofile(videofile)
click to toggle source
#¶ ↑
play_this_videofile
¶ ↑
This is the method that will play a given videofile.
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 413 def play_this_videofile(videofile) efancy videofile @thread = Thread.new { _ = MPV+' '+videofile cliner e sfancy(_) cliner system _ } @thread.join @thread = nil # Unsure whether we will need this here. end
Also aliased as: play_this_video_file
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 120 def reset reset_the_internal_variables # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, NAMESPACE] # ======================================================================= # # === @title # ======================================================================= # @title = TITLE # ======================================================================= # # === @width # ======================================================================= # set_width(WIDTH) # ======================================================================= # # === @height # ======================================================================= # set_height(HEIGHT) @child_widget = gtk_vbox # This widget will hold the other variants. set_font(:dejagnu_20) append_project_css_file end
return_new_videocamera_image()
click to toggle source
#¶ ↑
return_new_videocamera_image
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 303 def return_new_videocamera_image pixbuf = ::GdkPixbuf::Pixbuf.new(file: FILE_VIDEOCAMERA) pixbuf.scale(5, 5, :hyper) image = gtk_image(pixbuf) return image end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 342 def run set_the_font_in_use_for_this_application create_skeleton input_field = gtk_input_field {{ max_length: 50 }} result_field = gtk_input_field input_field.on_key_press_event { |widget, event| case Gdk::Keyval.to_name(event.keyval) when 'Return','KP_Enter' _ = input_field.text _ = FindVideo[_] unless _.empty? _.map! {|entry| entry.last } end if _.is_a? Array _ = _.join(', ') end result_field.set_text(_) end } search_box = gtk_hbox(input_field, result_field) @vbox_with_buttons.minimal(search_box, 0) add_the_scrolled_window add_alignment # We will put all the end
set_input(i = '')
click to toggle source
try_to_find_a_match()
click to toggle source
#¶ ↑
try_to_find_a_match
¶ ↑
This method will try to find a corresponding match to the given search term.
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/play_video_from_my_collection/play_video_from_my_collection_module.rb, line 432 def try_to_find_a_match _ = @search_entry.text? possible_matches = @array_all_video_files.select {|entry| basename = File.basename(entry) basename.downcase.include? _ } if possible_matches.empty? # ===================================================================== # # Show a popover in this case # ===================================================================== # popover_on( this_widget: @search_entry, use_this_message: 'No match was found for the search '\ 'term <b>'+_+'</b>.' ) else first = possible_matches.first play_this_video_file(first) end end
try_to_open_the_imdb_link_in_the_browser(i)
click to toggle source