class MultimediaParadise::GUI::Gtk::CutMultimedia
Public Class Methods
new( commandline_arguments = ARGV, run_already = true )
click to toggle source
run( i = ARGV )
click to toggle source
#¶ ↑
MultimediaParadise::GUI::Gtk::CutMultimedia.run
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/gtk3/cut_multimedia/cut_multimedia.rb, line 306 def self.run( i = ARGV ) require 'gtk_paradise/app/app.rb' _ = ::MultimediaParadise::GUI::Gtk::CutMultimedia.new(i) r = ::Gtk.run r << _ r.automatic_size_then_automatic_title r.top_left_then_run end
Public Instance Methods
connect_skeleton()
click to toggle source
#¶ ↑
connect_skeleton
(connect tag)¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/gtk3/cut_multimedia/cut_multimedia.rb, line 152 def connect_skeleton abort_on_exception instantiate_a_new_cut_multimedia_object hbox = create_hbox hbox.minimal( text('Work on this file'), 5 ) if @commandline_arguments and !@commandline_arguments.empty? set_use_this_file( @commandline_arguments.first.to_s ) end hbox.maximal(@entry_work_on_this_file, 3) _ = drag_from_left_to_right(hbox, return_file_chooser_widget) _.position = 900 minimal(_, 2) # ======================================================================= # # Add the duration of this multimedia-file next: # ======================================================================= # hbox = gtk_hbox hbox.minimal(text('Duration of the file:'), 3) @text_duration_of_the_file = gtk_label @text_duration_of_the_file.make_bold hbox.minimal(@text_duration_of_the_file, 3) minimal(hbox, 3) # ======================================================================= # # The Trim button: # ======================================================================= # hbox = gtk_hbox minimal(hbox, 3) hbox = gtk_hbox hbox.minimal(image_audio_x_generic_symbolic, 3) hbox.minimal(button_trim?, 3) hbox.minimal(@entry_n_seconds_for_trimming, 3) hbox.minimal(@button_play_the_audio_file, 3) hbox.minimal(@button_delete_the_audio_file, 3) hbox.minimal(@button_quit, 3) minimal(hbox, 3) unless @entry_work_on_this_file.text?.empty? update_the_duration end hbox = gtk_hbox hbox.minimal( text('This <b>multimedia-player</b> is in use:'), 3 ) hbox.minimal(@entry_multimedia_player_in_use, 3) minimal(hbox, 3) minimal(return_hbox_containing_the_start_and_end_position_entries, 3) end
create_skeleton()
click to toggle source
create_the_entries()
click to toggle source
#¶ ↑
create_the_entries
(entries tag, entry tag)¶ ↑
The shared attributes for all entries are batch-defined near the end of this method.
#¶ ↑
# File lib/multimedia_paradise/gui/gtk3/cut_multimedia/cut_multimedia.rb, line 90 def create_the_entries # ======================================================================= # # === @entry_work_on_this_file # ======================================================================= # @entry_work_on_this_file = create_entry @entry_work_on_this_file.set_size_request(450, 44) @entry_work_on_this_file.hint = 'Denote on which '\ 'file you work here.' @entry_work_on_this_file.on_enter { _ = @entry_work_on_this_file.text?.to_s if _ and File.exist?(_) a_new_file_has_been_assigned(_) end } # ======================================================================= # # === @entry_multimedia_player_in_use # ======================================================================= # @entry_multimedia_player_in_use = create_entry @entry_multimedia_player_in_use.hint = 'This entry designates the multimedia player in use. '\ '<b>mpv</b> is a good choice here normally.' @entry_multimedia_player_in_use.do_center @entry_multimedia_player_in_use.on_click_select_everything @entry_multimedia_player_in_use.set_text( ::MultimediaParadise.player?.to_s ) @entry_multimedia_player_in_use.on_clicked { _ = @entry_multimedia_player_in_use.text? MultimediaParadise.set_use_this_multimedia_player(_) unless _.empty? } # ======================================================================= # # === @entry_n_seconds_for_trimming # ======================================================================= # @entry_n_seconds_for_trimming = create_entry @entry_n_seconds_for_trimming.center @entry_n_seconds_for_trimming.set_text('30') @entry_n_seconds_for_trimming.set_size_request(50, 40) # ======================================================================= # # All entries of this gtk-widget should have a yellow background # and a slight border. The following code-block ensures that. # ======================================================================= # return_all_entries.each {|this_entry| this_entry.pad8px this_entry.set_name( 'entry_yellow_background_and_slight_border' ) } end
do_delete_the_audio_file( i = main_file? )
click to toggle source
#¶ ↑
do_delete_the_audio_file
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/gtk3/cut_multimedia/cut_multimedia.rb, line 240 def do_delete_the_audio_file( i = main_file? ) if i @cut_multimedia_object.set_main_file(i) Thread.new { @cut_multimedia_object.interactive_menu('delete_the_audio_file') } main_entry?.clear end end
do_merge_the_created_files()
click to toggle source
handle_CSS_rules()
click to toggle source
instantiate_a_new_cut_multimedia_object()
click to toggle source
#¶ ↑
instantiate_a_new_cut_multimedia_object
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/gtk3/cut_multimedia/cut_multimedia.rb, line 142 def instantiate_a_new_cut_multimedia_object # ======================================================================= # # === @cut_multimedia_object # ======================================================================= # @cut_multimedia_object = MultimediaParadise::CutMultimedia.new(first_argument?) { :gui } end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/gtk3/cut_multimedia/cut_multimedia.rb, line 48 def reset 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) handle_CSS_rules infer_the_size_automatically end
return_file_chooser_widget()
click to toggle source
#¶ ↑
return_file_chooser_widget
(open tag)¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/gtk3/cut_multimedia/cut_multimedia.rb, line 277 def return_file_chooser_widget # ======================================================================= # # First define the file-chooser button. # ======================================================================= # file_chooser = gtk_file_chooser_button file_chooser.bblack1 file_chooser.on_click { create_a_new_file_chooser_dialog(self, 'Choose a file:') {{ additional_directories: '/home/x/songs/' }} _ = ::Gtk.main_file? if _ and File.exist?(_) a_new_file_has_been_assigned(_) end } return file_chooser end
run()
click to toggle source
update_the_duration( target_file = main_file? )
click to toggle source
#¶ ↑
update_the_duration
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/gtk3/cut_multimedia/cut_multimedia.rb, line 262 def update_the_duration( target_file = main_file? ) if target_file and !target_file.empty? _ = duration?(target_file) @text_duration_of_the_file.set_text( '<b>'+_.to_s+'</b> seconds' ) @text_duration_of_the_file.do_markify end end