Class: MultimediaParadise::GUI::UniversalWidgets::SoundEffectWidget

Inherits:
Base
  • Object
show all
Includes:
UniversalWidgets::BaseModule
Defined in:
lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb

Overview

MultimediaParadise::GUI::UniversalWidgets::SoundEffectWidget

Constant Summary collapse

TITLE =
#

TITLE

#
'Sound Effect Widget'
WIDTH =
#

WIDTH

#
'75% or minimum 1300px'
HEIGHT =
#

HEIGHT

#
'15% or minimum 250px'
USE_THIS_FONT =
#

USE_THIS_FONT

#
:hack_23
LARGER_FONT =
#

LARGER_FONT

#
:hack_25
SMALLER_FONT =
#

SMALLER_FONT

#
:hack_20
FILE_AUDIO1 =
#

Audio Files

Some sound effects are grouped next.

#
MultimediaParadise.project_base_directory?+'sound_effects/cat_meow.mp3'
FILE_AUDIO2 =
MultimediaParadise.project_base_directory?+'sound_effects/channel_opened.mp3'
FILE_AUDIO3 =
MultimediaParadise.project_base_directory?+'sound_effects/phone_ring.mp3'

Constants inherited from Base

Base::ERROR, Base::ERROR_LINE, Base::NAMESPACE, Base::USE_THIS_NAMESPACE_FOR_THE_COLOURS, Base::USE_THIS_NAMESPACE_FOR_THE_CORE_COLOURS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#actions, #append_what_into, #be_silent, #be_verbose?, #beautiful_url, #cartoons_directory?, #clear_the_internal_hash, #cliner, #cliner_with_time_stamp, #colourized_comment, #copy_file, #crimson, #dataset_from_file_video_collection, #dd_mm_yyyy, #debug?, #default_readlines, #directory_to_realvids?, #do_not_use_opn, #dodgerblue, #does_the_video_player_support_this_commandline?, #e, #ecomment, #ecrimson, #efancy, #enable_debug, #ensure_main_encoding, #ensure_that_the_output_directory_exists, #eparse, #erev, #esystem, #ewarn, #file_video_collection?, #filter_for_audio_files, #filter_for_video_files, #forestgreen, #gold, #grey, #hh_mm_ss, #home_x_video?, #indianred, #infer_the_namespace, #internal_hash?, #is_audio_file?, #is_mkv?, #is_mp3?, #is_mp4?, #is_multimedia_file?, #is_on_roebe?, #is_video_file?, #konsole_colour_peru, #lightblue, #lightgreen, #load_yaml, #local_audio_directory?, #log_dir?, #map_symbol_to_locally_existing_file, #mediumorchid, #mediumpurple, #mediumslateblue, #mkdir, #move_file, #namespace?, #no_file_exists, #no_file_exists_at, #olive, #olivedrab, #opne, #opnecomment, #opnn, #orange, #palegoldenrod, #palegreen, #powderblue, #project_base_directory?, #rds, #register_sigint, #remove_file, #report_pwd, #reset_the_internal_hash, #return_all_video_files, #return_pwd, #return_random_video, #rev, #royalblue, #save_what_into, #sdir, #seagreen, #seconds_to_time_format, #select_only_video_files_from, #set_be_verbose, #set_use_colours, #sfancy, #sfile, #simp, #skyblue, #slateblue, #springgreen, #steelblue, #swarn, #teal, #time_right_now, #to_hh_mm_ss, #tomato, #true_rev, #try_to_rename_kde_konsole_tab, #ucliner, #use_colours?, #use_opn?, #use_which_video_player?, #verbose_truth, #video_collection?, #violet, #yaml_directory?, #yel

Methods included from CommandlineArgumentsModule

#all_input_starts_with_a_number?, #commandline_arguments?, #commandline_arguments_as_a_string, #first_argument?, #first_non_hyphened_commandline_argument?, #set_commandline_arguments

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ SoundEffectWidget

#

initialize

#


71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 71

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  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

Class Method Details

.[](i = ARGV) ⇒ Object

#

MultimediaParadise::GUI::UniversalWidgets::SoundEffectWidget[]

#


257
258
259
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 257

def self.[](i = ARGV)
  new(i)
end

.run(i = ARGV) ⇒ Object

#

MultimediaParadise::GUI::UniversalWidgets::SoundEffectWidget.run

#


239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 239

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::MultimediaParadise::GUI::Gtk::SoundEffectWidget.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.maximize
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


143
144
145
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 143

def border_size?
  2
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag)

#


180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 180

def connect_the_skeleton
  abort_on_exception

  outer_vbox = create_vbox

  button1 = bold_button(no_ext(File.basename(FILE_AUDIO1)))
  button1.on_clicked {
    Thread.new { mpv_play FILE_AUDIO1 }
  }
  outer_vbox.minimal(mbox(button1), 1)

  button2 = bold_button(no_ext(File.basename(FILE_AUDIO2)))
  button2.on_clicked {
    Thread.new { mpv_play FILE_AUDIO2 }
  }
  outer_vbox.minimal(mbox(button2), 1)

  button3 = bold_button(no_ext(File.basename(FILE_AUDIO3)))
  button3.on_clicked {
    Thread.new { mpv_play FILE_AUDIO3 }
  }
  outer_vbox.minimal(mbox(button3), 1)

  window = create_window_or_runner(nil, width?, height?, title?)
  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
  handle_CSS_rules if use_gtk3?
  run_main
end

#create_the_skeletonObject

#

create_the_skeleton (create tag, skeleton tag)

#


226
227
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 226

def create_the_skeleton
end
#
#


150
151
152
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 150

def do_all_startup_related_actions
  style_the_buttons_uniformly
end

#handle_CSS_rulesObject

#

handle_CSS_rules (CSS tag)

This is currently only in use if gtk3 is in use.

#


116
117
118
119
120
121
122
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 116

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  more_CSS_then_apply_it '

'
end

#mpv_play(i) ⇒ Object

#

mpv_play

#


173
174
175
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 173

def mpv_play(i)
  esystem "mpv #{i}"
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


136
137
138
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 136

def padding?
  2
end

#resetObject

#

reset (reset tag)

#


87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 87

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)
  infer_the_size_automatically
end

#reset_the_shared_moduleObject

#

reset_the_shared_module

This method can be used for ruby-gtk3 and ruby-libui, among other toolkits.

#


130
131
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 130

def reset_the_shared_module
end

#runObject

#

run (run tag)

#


232
233
234
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 232

def run
  run_super
end

#smaller_font?Boolean

#

smaller_font?

#

Returns:

  • (Boolean)


107
108
109
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 107

def smaller_font?
  SMALLER_FONT
end

#style_the_buttons_uniformly(array = all_buttons? ) ⇒ Object

#

style_the_buttons_uniformly (style tag)

#


157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/multimedia_paradise/gui/universal_widgets/sound_effect_widget/sound_effect_widget.rb', line 157

def style_the_buttons_uniformly(
    array = all_buttons?
  )
  array.each {|this_button|
    this_button.clear_background
    this_button.bblack2
    this_button.pad5px
    this_button.disallow_resizing
    this_button.set_size_request(30, 30)
    this_button.on_hover(:lightblue)
  }
end