class Iconify::TerminalWindow
メインウィンドウ
Constants
- COLORS
the shimbun color scheme
Attributes
state[R]
Public Class Methods
new(argv)
click to toggle source
- String
Calls superclass method
# File lib/iconify.rb, line 18 def initialize(argv) super() @argv = argv @state = :stopped update_title @rerun_button = create_rerun_button @kill_button = create_kill_button @quit_button = create_quit_button @terminal = create_vte_terminal @copy_button = create_copy_button @paste_button = create_paste_button layout set_geometry_hints end
Public Instance Methods
changed()
click to toggle source
# File lib/iconify.rb, line 117 def changed @rerun_button.sensitive = (@state == :stopped) @kill_button.sensitive = (@state == :running) @copy_button.sensitive = @terminal.has_selection? signal_emit('changed') end
create_vte_terminal()
click to toggle source
# File lib/iconify.rb, line 145 def create_vte_terminal Vte::Terminal.new.tap do |t| t.font = Pango::FontDescription.new('monospace 14') t.set_size_request(t.char_width * 40, t.char_height * 12) t.set_size(80, 24) t.cursor_blink_mode = Vte::CursorBlinkMode::OFF t.set_colors(COLORS[0], COLORS[15], COLORS) t.signal_connect('child-exited') do on_child_exited end t.signal_connect('selection-changed') do changed end end end
exec()
click to toggle source
# File lib/iconify.rb, line 169 def exec @pid = @terminal.spawn(argv: @argv) @state = :running changed end
layout()
click to toggle source
# File lib/iconify.rb, line 43 def layout vbox = Box.new(:vertical) toolbar = Toolbar.new toolbar.add(@rerun_button) toolbar.add(@kill_button) toolbar.add(SeparatorToolItem.new) toolbar.add(@copy_button) toolbar.add(@paste_button) toolbar.add(SeparatorToolItem.new) toolbar.add(@quit_button) vbox.pack_start(toolbar, expand: false) padding_box = Box.new(:vertical) padding_box.pack_start(@terminal, expand: true, fill: true) padding_box.border_width = 18 override_background_color(StateFlags::NORMAL, COLORS[15]) vbox.pack_start(padding_box, expand: true, fill: true) add vbox end
on_child_exited()
click to toggle source
# File lib/iconify.rb, line 162 def on_child_exited @state = :stopped @pid = nil @rerun_button.sensitive = true changed end
set_geometry_hints()
click to toggle source
# File lib/iconify.rb, line 38 def set_geometry_hints @terminal.realize @terminal.set_geometry_hints_for_window(self) end
update_title()
click to toggle source
# File lib/iconify.rb, line 113 def update_title self.title = "iconify - #{@argv[0]}" end