class Rabbit::VideoWindow
Attributes
direction[RW]
entry[RW]
window[RW]
Public Class Methods
new(element)
click to toggle source
# File lib/rabbit/video-window.rb, line 7 def initialize(element) @element = element @video = VideoWidget.new(@element.filename) end
Public Instance Methods
hide()
click to toggle source
# File lib/rabbit/video-window.rb, line 31 def hide @video.pause @video_window.hide end
setup(window)
click to toggle source
# File lib/rabbit/video-window.rb, line 12 def setup(window) if not @completed @window = window init_window init_keys @completed = true end end
show(window)
click to toggle source
# File lib/rabbit/video-window.rb, line 21 def show(window) setup(window) if not window.nil? Utils.move_to(window, @video_window) do |bx, by, bw, bh, tw, th, sw, sh| [bx+@element.x, by+@element.y] end @video_window.resize(@element.width, @element.height) @video_window.show_all @video.play end
Private Instance Methods
init_keys()
click to toggle source
# File lib/rabbit/video-window.rb, line 55 def init_keys @video_window.signal_connect("key_press_event") do |widget, key| case key.keyval when Gdk::Keyval::GDK_KEY_space @video.toggle when Gdk::Keyval::GDK_KEY_plus @video.seek(10) when Gdk::Keyval::GDK_KEY_minus @video.seek(-10) when *[ Keys::MOVE_TO_NEXT_KEYS, Keys::MOVE_TO_PREVIOUS_KEYS, Keys::MOVE_TO_LAST_KEYS, Keys::MOVE_TO_LAST_KEYS, ].flatten hide Gtk::AccelGroup.activate(window, key.keyval, key.state) else Gtk::AccelGroup.activate(window, key.keyval, key.state) end end end
init_window()
click to toggle source
# File lib/rabbit/video-window.rb, line 37 def init_window @video_window = Gtk::Window.new(Gtk::Window::POPUP) @video_window.modal = true @video_window.set_transient_for(window) vbox = Gtk::VBox.new vbox.pack_start(@video) @video_window.add(vbox) @video_window.signal_connect('frame-event') do |widget, event| if event.event_type == Gdk::Event::Type::BUTTON_PRESS @video.toggle end end @video_window.signal_connect('destroy') do @video.stop end end