Class: MultimediaParadise::GUI::UniversalWidgets::Lyrics

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

Overview

MultimediaParadise::GUI::UniversalWidgets::Lyrics

Constant Summary collapse

TITLE =
#

TITLE

#
'Lyrics'
WIDTH =
#

WIDTH

#
'100% or minimum 1820px'
HEIGHT =
#

HEIGHT

#
'88% or minimum 1540px'
DEFAULT_STREAM =
#

DEFAULT_STREAM

#
'https://orf-live.ors-shoutcast.at/oe3-q2a.m3u'
FONT_FAMILY_TO_USE =
#

FONT_FAMILY_TO_USE

#
'DejaVu Sans Mono'
FONT_SIZE =
#

FONT_SIZE

#
'20'
SMALLER_FONT_SIZE =
#

SMALLER_FONT_SIZE

#
'16'
USE_THIS_FONT =
#

USE_THIS_FONT

#
:hack_23
LARGER_FONT =
#

LARGER_FONT

#
:hack_25
SMALLER_FONT =
#

SMALLER_FONT

#
:hack_20

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) ⇒ Lyrics

#

initialize

#


83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 83

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::Lyrics[]

#


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

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

.run(i = ARGV) ⇒ Object

#

MultimediaParadise::GUI::UniversalWidgets::Lyrics.run

#


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

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::MultimediaParadise::GUI::Gtk::Lyrics.new(i)
  r = ::Gtk.run
  r << _
  _.set_parent_widget(r) # Must come before we enable the key-combinations.
  
  r.enable_context_menu_on_button_click_events
  r.signal_connect(:delete_event) { |_widget| ::Gtk.main_quit }
  _.maximize_button?.set_new_parent(r)
  r.automatic_size_then_automatic_title
  r.enable_quick_exit
  r.modify_background(:normal, :azure)
  r.maximize
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


152
153
154
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 152

def border_size?
  0
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag)

#


200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 200

def connect_the_skeleton
  abort_on_exception

  outer_vbox = create_vbox

  # ======================================================================= #
  # === @file_viewer
  # ======================================================================= #
  @file_viewer = ::Gtk::FileViewer.new(FILE_LYRICS)
  @file_viewer.use_this_font(main_font?)
  outer_vbox.add(@file_viewer)

  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.set_size_request(width?, height?)
  window.show_all
  window.top_left
  do_all_startup_related_actions
  run_main
end

#create_the_skeletonObject

#

create_the_skeleton (create tag, skeleton tag)

#


166
167
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 166

def create_the_skeleton
end

#handle_CSS_rulesObject

#

handle_CSS_rules (CSS tag)

#


124
125
126
127
128
129
130
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 124

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  more_CSS_then_apply_it '

'
end

#main_font?Boolean

#

main_font?

#

Returns:

  • (Boolean)


193
194
195
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 193

def main_font?
  :hack_18
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


145
146
147
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 145

def padding?
  0
end

#resetObject

#

reset (reset tag)

#


99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 99

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, "#{FONT_FAMILY_TO_USE} #{FONT_SIZE}"
  )
  if use_gtk3?
    handle_CSS_rules
  end
  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.

#


138
139
140
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 138

def reset_the_shared_module
  try_to_read_in_the_main_dataset
end

#runObject

#

run (run tag)

#


172
173
174
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 172

def run
  run_super
end

#smaller_font?Boolean

#

smaller_font?

#

Returns:

  • (Boolean)


159
160
161
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 159

def smaller_font?
  "#{FONT_FAMILY_TO_USE} #{SMALLER_FONT_SIZE}"
end

#try_to_read_in_the_main_dataset(this_file = FILE_LYRICS) ⇒ Object

#

try_to_read_in_the_main_dataset

#


179
180
181
182
183
184
185
186
187
188
# File 'lib/multimedia_paradise/gui/universal_widgets/lyrics/lyrics.rb', line 179

def try_to_read_in_the_main_dataset(
    this_file = FILE_LYRICS
  )
  if File.exist? this_file
    _ = File.read(FILE_LYRICS, encoding: 'utf-8')
    @dataset = _
  else
    @dataset = nil
  end
end