Class: MultimediaParadise::GUI::Gtk::YoutubeChannels

Inherits:
Gtk::Box
  • Object
show all
Includes:
Gtk::BaseModule
Defined in:
lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
TITLE =
#

TITLE

#
'Youtube Channels'
WIDTH =
#

WIDTH

#
600
HEIGHT =
#

HEIGHT

#
500
USE_THIS_FONT =
#

USE_THIS_FONT

#
:dejavu_condensed_20
ARRAY_ADD_THESE_CHANNELS =
#

ARRAY_ADD_THESE_CHANNELS

#
%i(
  daily_dose_of_internet
  ozzy_man
  wt3
  chris_sumo
  devon_larrat
  monster_michael
  tods_workshop
)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commandline_arguments = ARGV, run_already = true) ⇒ YoutubeChannels

#

initialize

#


67
68
69
70
71
72
73
74
75
76
77
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 67

def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  super(:vertical)
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.run(i = ARGV) ⇒ Object

#

MultimediaParadise::GUI::Gtk::YoutubeChannels.run

#


195
196
197
198
199
200
201
202
203
204
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 195

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::MultimediaParadise::GUI::Gtk::YoutubeChannels.new(i)
  r = ::Gtk.run
  r << _
  r.automatic
  r.top_left_then_run
end

Instance Method Details

#apply_custom_CSS_rulesObject

#

apply_custom_CSS_rules

#


109
110
111
112
113
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 109

def apply_custom_CSS_rules
  more_CSS_then_apply_these_rules '.fancy_border {
border: 2px dotted royalblue;
}'
end

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


125
126
127
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 125

def border_size?
  2
end

#connect_skeletonObject

#

connect_skeleton (connect tag)

#


152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 152

def connect_skeleton
  abort_on_exception
  bold_header = gtk_left_aligned_label(' Show video channels ')
  bold_header.make_bold
  minimal(bold_header, 5)
  ARRAY_ADD_THESE_CHANNELS.each_with_index {|this_channel, index| index += 1
    button = gtk_button(
      this_channel.to_s.tr('_',' ')
    )
    button.use_this_font = :dejavu_15
    button.on_clicked {
      Thread.new { do_open_this_channel_associated_URL(this_channel) }
    }
    button.make_bold
    button.bblack2
    @grid.left(text(" #{index} "))
    @grid.right(button)
    @grid.new_row
  }
  minimal(@grid, 28)
end

#create_gridObject

#

create_grid

#


139
140
141
142
143
144
145
146
147
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 139

def create_grid
  # ======================================================================= #
  # === @grid
  # ======================================================================= #
  @grid = return_default_grid
  @grid.css_class('pad8px')
  @grid.css_class('mar5px')
  @grid.css_class('fancy_border')
end

#create_skeletonObject

#

create_skeleton (create tag)

#


132
133
134
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 132

def create_skeleton
  create_grid
end

#do_open_this_channel_associated_URL(i) ⇒ Object

#

do_open_this_channel_associated_URL

#


177
178
179
180
181
182
183
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 177

def do_open_this_channel_associated_URL(
    i
  )
  remote_url = BeautifulUrl[i]
  e 'Now opening '+sfancy(remote_url)+'.'
  Open.in_browser(remote_url)
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


118
119
120
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 118

def padding?
  2
end

#resetObject

#

reset (reset tag)

#


82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 82

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  # ======================================================================= #
  # === @title
  # ======================================================================= #
  @title  = TITLE
  # ======================================================================= #
  # === @width
  # ======================================================================= #
  set_width(WIDTH)
  # ======================================================================= #
  # === @height
  # ======================================================================= #
  set_height(HEIGHT)
  set_use_this_font(USE_THIS_FONT)
  use_gtk_paradise_project_css_file 
  infer_the_size_automatically
  apply_custom_CSS_rules
end

#runObject

#

run (run tag)

#


188
189
190
# File 'lib/multimedia_paradise/gui/gtk3/youtube_channels/youtube_channels.rb', line 188

def run
  create_skeleton_then_connect_skeleton
end