Germinal 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,61 @@
1
+ # Copyright 2015-2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
+ # This file is part of Germinal.
3
+ #
4
+ # Germinal is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # Germinal is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with Germinal. If not, see <http://www.gnu.org/licenses/>.
16
+ class GerminalFontSelector < Gtk::Box
17
+ attr_reader :font
18
+ def initialize(window)
19
+ @window = window
20
+ @font = @window.notebook.current.font
21
+ super(:horizontal, 0)
22
+
23
+ reset_button = Gtk::Button.new(:label => "Reset")
24
+ reset_button.signal_connect "clicked" do
25
+ font_desc = Pango::FontDescription.new(@font)
26
+ @window.notebook.current.set_font(font_desc)
27
+ end
28
+ pack_start(reset_button, :expand => false, :fill => false, :padding => 0)
29
+
30
+ font_button = Gtk::FontButton.new
31
+ font_button.set_font(@font)
32
+ font_button.set_show_style(true)
33
+ font_button.set_show_size(true)
34
+ font_button.set_use_font(true)
35
+ font_button.set_use_size(false)
36
+ font_button.signal_connect "font-set" do
37
+ font_desc = Pango::FontDescription.new(font_button.font_name)
38
+ @window.notebook.current.set_font(font_desc)
39
+ end
40
+ pack_start(font_button, :expand => false, :fill => false, :padding => 0)
41
+
42
+ save_button = Gtk::Button.new(:label => "Save")
43
+ save_button.signal_connect "clicked" do
44
+ new_props={}
45
+ font = @window.notebook.current.font
46
+ new_props["-GerminalTerminal-font"] = font.to_s
47
+ toplevel.application.update_css(new_props)
48
+ toplevel.notebook.each do |tab|
49
+ if tab.class == GerminalTerminal
50
+ tab.set_font(font)
51
+ end
52
+ end
53
+ toplevel.exit_overlay_mode
54
+ end
55
+ pack_start(save_button, :expand => false, :fill => false, :padding => 0)
56
+ set_name("font_selector")
57
+ show_all
58
+ set_halign(:center)
59
+ set_valign(:end)
60
+ end
61
+ end
data/lib/notebook.rb ADDED
@@ -0,0 +1,90 @@
1
+ # Copyright 2015-2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
+ # This file is part of Germinal.
3
+ #
4
+ # Germinal is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # Germinal is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with Germinal. If not, see <http://www.gnu.org/licenses/>.
16
+ class GerminalNotebook < Gtk::Notebook
17
+ attr_reader :visible
18
+ attr_accessor :gen_preview
19
+ def initialize
20
+ super()
21
+ @gen_preview = true
22
+ signal_connect "hide" do |widget|
23
+ @visible = false
24
+ end
25
+ signal_connect "show" do |widget|
26
+ @visible = true
27
+ end
28
+
29
+ signal_connect "switch-page" do |widget, next_page, next_page_num|
30
+ if next_page.tab_label
31
+ toplevel.current_label.text = next_page.tab_label
32
+ else
33
+ next_label = get_tab_label(next_page)
34
+ toplevel.current_label.text = next_label.text
35
+ end
36
+ toplevel.current_tab.text = "#{next_page_num + 1}/#{n_pages}"
37
+
38
+ if page >= 0 && @gen_preview
39
+ current.queue_draw
40
+ _x,_y,w,h = current.allocation.to_a
41
+ pix = current.window.to_pixbuf(0, 0, w, h)
42
+ current.preview = pix if pix
43
+ elsif !@gen_preview
44
+ @gen_preview = true
45
+ end
46
+ end
47
+
48
+ signal_connect "page-reordered" do |widget, child, new_page_num|
49
+ toplevel.current_tab.text = "#{page + 1}/#{n_pages}"
50
+ end
51
+
52
+ signal_connect "page-removed" do
53
+ toplevel.current_tab.text = "#{page + 1}/#{n_pages}" if toplevel.class == GerminalWindow
54
+ end
55
+
56
+ set_show_tabs(false)
57
+ end
58
+
59
+ def remove_all_pages
60
+ each do |widget|
61
+ index = page_num(widget)
62
+ remove_page(index)
63
+ end
64
+ end
65
+
66
+ def cycle_next_page
67
+ page < (n_pages - 1) ? next_page : set_page(0)
68
+ end
69
+
70
+ def cycle_prev_page
71
+ page > 0 ? prev_page : set_page(n_pages - 1)
72
+ end
73
+
74
+ def current
75
+ get_nth_page(page)
76
+ end
77
+
78
+ def remove_current_page
79
+ if n_pages == 1
80
+ toplevel.quit_gracefully
81
+ else
82
+ remove(current)
83
+ current.grab_focus
84
+ end
85
+ end
86
+
87
+ def toggle_visibility
88
+ @visible ? hide : show
89
+ end
90
+ end
@@ -0,0 +1,32 @@
1
+ # Copyright 2015-2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
+ # This file is part of Germinal.
3
+ #
4
+ # Germinal is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # Germinal is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with Germinal. If not, see <http://www.gnu.org/licenses/>.
16
+ class GerminalResizeMessage < Gtk::Box
17
+ def initialize(text)
18
+ super(:vertical)
19
+ text = text || ""
20
+ add(Gtk::Label.new(text))
21
+ set_halign(:end)
22
+ set_valign(:end)
23
+ set_border_width(4)
24
+ show_all
25
+ set_name("resize_box")
26
+ end
27
+
28
+ def text=(text)
29
+ children[0].text = text
30
+ show_all
31
+ end
32
+ end
data/lib/terminal.rb ADDED
@@ -0,0 +1,164 @@
1
+ # Copyright 2015-2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
+ # This file is part of Germinal.
3
+ #
4
+ # Germinal is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # Germinal is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with Germinal. If not, see <http://www.gnu.org/licenses/>.
16
+ class GerminalMenu < Gtk::Menu
17
+ def initialize(vte)
18
+ super()
19
+ copyitem = Gtk::MenuItem.new(:label => "Copy")
20
+ copyitem.signal_connect "activate" do
21
+ vte.copy_clipboard
22
+ end
23
+ append(copyitem)
24
+
25
+ pasteitem = Gtk::MenuItem.new(:label => "Paste")
26
+ pasteitem.signal_connect "activate" do
27
+ vte.paste_clipboard
28
+ end
29
+ append(pasteitem)
30
+ show_all
31
+ end
32
+ end
33
+
34
+ TERMINAL_COLOR_NAMES = [:foreground, :background, :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white,
35
+ :brightblack, :brightred, :brightgreen, :brightyellow, :brightblue, :brightmagenta, :brightcyan, :brightwhite]
36
+ DEFAULT_TERMINAL_COLORS = %w(#aeafad #323232 #000000 #b9214f #A6E22E #ff9800 #3399ff #8e33ff #06a2dc
37
+ #B0B0B0 #5D5D5D #ff5c8d #CDEE69 #ffff00 #9CD9F0 #FBB1F9 #77DFD8 #F7F7F7)
38
+ DEFAULT_TERMINAL_FONT = "Monospace 11"
39
+ ##
40
+ # The default vte terminal customized
41
+ class GerminalTerminal < Vte::Terminal
42
+ attr_reader :pid, :menu
43
+ attr_accessor :preview, :colors, :tab_label
44
+ type_register
45
+ TERMINAL_COLOR_NAMES.each_with_index do |c, i|
46
+ name = c.to_s
47
+ install_style_property(
48
+ GLib::Param::Boxed.new(name, # name
49
+ name.capitalize, # nick
50
+ name.upcase, # blurb
51
+ GLib::Type["GdkRGBA"],
52
+ GLib::Param::READABLE |
53
+ GLib::Param::WRITABLE)
54
+ )
55
+ end
56
+ install_style_property(
57
+ GLib::Param::Boxed.new("font", # name
58
+ "font".capitalize, # nick
59
+ "font".upcase, # blurb
60
+ GLib::Type["PangoFontDescription"],
61
+ GLib::Param::READABLE |
62
+ GLib::Param::WRITABLE)
63
+ )
64
+ ##
65
+ # Create a new GerminalTerminal instance that runs command_string
66
+ def initialize(command_string, working_dir = nil)
67
+ super()
68
+ # TODO: make a begin/rescue like in glib2-2.2.4/sample/shell.rb
69
+ command_array = GLib::Shell.parse(command_string)
70
+ @pid = spawn(:argv => command_array,
71
+ :working_directory => working_dir,
72
+ :spawn_flags => GLib::Spawn::SEARCH_PATH)
73
+
74
+ signal_connect "child-exited" do |widget|
75
+ notebook = widget.parent
76
+ current_page = notebook.page_num(widget)
77
+ if notebook.n_pages > 1
78
+ notebook.remove_page(current_page)
79
+ notebook.get_nth_page(notebook.page).grab_focus
80
+ else
81
+ notebook.remove_page(current_page)
82
+ notebook.toplevel.application.quit
83
+ end
84
+ end
85
+
86
+ signal_connect "window-title-changed" do |widget|
87
+ if parent && parent.current == self
88
+ current_label = parent.get_tab_label(widget)
89
+ if @tab_label.class == String
90
+ current_label.text = @tab_label
91
+ else
92
+ current_label.text = window_title
93
+ parent.toplevel.current_label.text = window_title
94
+ end
95
+ end
96
+ end
97
+
98
+ @menu = GerminalMenu.new(self)
99
+ signal_connect "button-press-event" do |widget, event|
100
+ if event.type == Gdk::EventType::BUTTON_PRESS &&
101
+ event.button == Gdk::BUTTON_SECONDARY
102
+
103
+ widget.menu.popup(nil, nil, event.button, event.time)
104
+ true
105
+ else
106
+ false
107
+ end
108
+ end
109
+ configure
110
+ end
111
+
112
+ def get_pid_dir
113
+ File.readlink("/proc/#{@pid}/cwd")
114
+ end
115
+
116
+ def get_css_colors
117
+ background = nil
118
+ foreground = nil
119
+ colors = []
120
+ background = parse_css_color(TERMINAL_COLOR_NAMES[0].to_s)
121
+ foreground = parse_css_color(TERMINAL_COLOR_NAMES[1].to_s)
122
+ TERMINAL_COLOR_NAMES[2..-1].each do |c|
123
+ color = parse_css_color(c.to_s)
124
+ colors << color
125
+ end
126
+ [background, foreground] + colors
127
+ end
128
+
129
+ def get_css_font
130
+ font = style_get_property("font")
131
+ unless font
132
+ font = Pango::FontDescription.new(DEFAULT_TERMINAL_FONT)
133
+ end
134
+ font
135
+ end
136
+
137
+ def apply_colors
138
+ set_colors(@colors[0], @colors[1], @colors[2..-1])
139
+ end
140
+
141
+ private
142
+
143
+ def parse_css_color(color_name)
144
+ default_color = Gdk::RGBA.parse(DEFAULT_TERMINAL_COLORS[TERMINAL_COLOR_NAMES.index(color_name.to_sym)])
145
+ color_from_css = style_get_property(color_name)
146
+ color = color_from_css ? color_from_css : default_color
147
+ color
148
+ end
149
+
150
+ def configure
151
+ set_rewrap_on_resize(true)
152
+ set_scrollback_lines(-1)
153
+ @colors = get_css_colors
154
+ set_font(get_css_font)
155
+ apply_colors
156
+ #add_matches
157
+ end
158
+
159
+ def add_matches
160
+ puts methods.grep(/rege/)
161
+ match_add_gregex("cedlemo")
162
+ end
163
+ end
164
+
@@ -0,0 +1,214 @@
1
+ # Copyright 2015-2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
+ # This file is part of Germinal.
3
+ #
4
+ # Germinal is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # Germinal is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with Germinal. If not, see <http://www.gnu.org/licenses/>.
16
+ class GerminalTermChooser < Gtk::ScrolledWindow
17
+ def initialize(window)
18
+ super(nil, nil)
19
+ @window = window
20
+ set_size_request( 184, @window.notebook.current.allocation.to_a[3] - 8)
21
+ set_halign(:end)
22
+ set_valign(:center)
23
+ set_name("terminal_chooser")
24
+
25
+ generate_previews_pixbufs
26
+ generate_grid
27
+ fill_grid
28
+
29
+ @box = Gtk::Box.new(:vertical, 4)
30
+ @box.pack_start(@grid, :expand => true, :fill => true, :padding => 4)
31
+ add(@box)
32
+ end
33
+
34
+ private
35
+ def generate_grid
36
+ @grid = Gtk::Grid.new
37
+ @grid.valign = :start
38
+ @grid.halign = :center
39
+ @grid.row_spacing = 2
40
+ end
41
+
42
+ def fill_grid
43
+ @window.notebook.children.each_with_index do |child,i|
44
+ button = generate_preview_button(child, i)
45
+ @grid.attach(button, 0 , i, 1, 1)
46
+ add_drag_and_drop_functionalities(button)
47
+ button = generate_close_tab_button
48
+ @grid.attach(button, 1 , i, 1, 1)
49
+ end
50
+ @grid.attach(generate_separator, 0, @window.notebook.n_pages, 2, 1)
51
+ button = generate_quit_button
52
+ @grid.attach(button, 0, @window.notebook.n_pages + 1, 2, 1)
53
+ end
54
+
55
+ def generate_close_tab_button
56
+ button = Gtk::EventBox.new
57
+ button.tooltip_text = "Close Tab"
58
+ image = Gtk::Image.new(:stock => Gtk::Stock::CLOSE, :size => :button)
59
+ button.add(image)
60
+ button.hexpand = false
61
+ button.vexpand = false
62
+ button.valign = :start
63
+ button.halign = :center
64
+ button.signal_connect "button_press_event" do
65
+ n = @grid.child_get_property(button, "top-attach")
66
+ tab = @window.notebook.get_nth_page(n)
67
+ if @window.notebook.n_pages == 1
68
+ @window.quit_gracefully
69
+ else
70
+ remove_tab(tab, n)
71
+ end
72
+ end
73
+ button
74
+ end
75
+
76
+ def remove_tab(tab, n)
77
+ @window.notebook.remove(tab)
78
+ @grid.remove_row(n)
79
+ last_tab = @window.notebook.n_pages - 1
80
+ update_preview_button_tooltip(n..last_tab)
81
+ end
82
+
83
+ def update_preview_button_tooltip(range)
84
+ (range).each do |j|
85
+ puts j
86
+ @grid.get_child_at(0, j).tooltip_text = j.to_s
87
+ end
88
+ end
89
+
90
+ def generate_preview_button(child, i)
91
+ button = Gtk::Button.new
92
+ button.add(generate_preview_image(child.preview))
93
+ button.set_tooltip_text(i.to_s)
94
+ button.signal_connect "clicked" do
95
+ @window.notebook.gen_preview = false
96
+ @window.notebook.set_current_page(i)
97
+ end
98
+ button
99
+ end
100
+
101
+ def generate_preview_image(pixbuf)
102
+ ratio = pixbuf.width / pixbuf.height
103
+ scaled_pix = pixbuf.scale(150, 75, Gdk::Pixbuf::INTERP_BILINEAR)
104
+ img = Gtk::Image.new(:pixbuf => scaled_pix)
105
+ img.show
106
+ img
107
+ end
108
+
109
+ def generate_separator
110
+ Gtk::Separator.new(:horizontal)
111
+ end
112
+
113
+ def generate_quit_button
114
+ button = Gtk::EventBox.new
115
+ button.tooltip_text = "Quit Germinal"
116
+ image = Gtk::Image.new(:stock => Gtk::Stock::QUIT, :size => :button)
117
+ button.add(image)
118
+ button
119
+ end
120
+ def generate_previews_pixbufs
121
+ current_page = @window.notebook.page
122
+
123
+ if @window.notebook.children.size == 1
124
+ # If we have only one vte, just generate the preview
125
+ _x,_y,w,h = @window.notebook.current.allocation.to_a
126
+ @window.notebook.current.preview = @window.notebook.current.window.to_pixbuf(0, 0, w, h)
127
+ else
128
+ # If we have more terminals, just cycle through them
129
+ # the previews will be generated in the "switch-page" event of the notebook
130
+ begin
131
+ @window.notebook.cycle_next_page
132
+ end while @window.notebook.page == current_page
133
+ # Here I disable the preview generation in the notebook "switch-page" event
134
+ # before returning to the current page.
135
+ # This is a Hack, If I don't disable the preview, all the previews will be
136
+ # the same.
137
+ @window.notebook.gen_preview = false
138
+ @window.notebook.set_current_page(current_page)
139
+ end
140
+ end
141
+
142
+ def add_drag_and_drop_functionalities(button)
143
+ add_dnd_source(button)
144
+ add_dnd_destination(button)
145
+ end
146
+
147
+ def add_dnd_source(button)
148
+ button.drag_source_set(Gdk::ModifierType::BUTTON1_MASK |
149
+ Gdk::ModifierType::BUTTON2_MASK,
150
+ [["test", Gtk::TargetFlags::SAME_APP, 12_345]],
151
+ Gdk::DragAction::COPY |
152
+ Gdk::DragAction::MOVE)
153
+ button.drag_source_set_icon_name("grab")
154
+ # Drag source signals
155
+ # drag-begin User starts a drag Set-up drag icon
156
+ # drag-data-get When drag data is requested by the destination Transfer drag data from source to destination
157
+ # drag-data-delete When a drag with the action Gdk.DragAction.MOVE is completed Delete data from the source to complete the ‘move’
158
+ # drag-end When the drag is complete Undo anything done in drag-begin
159
+
160
+ #button.signal_connect "drag-begin" do
161
+ # puts "drag begin for #{index}"
162
+ #end
163
+ button.signal_connect("drag-data-get") do |_widget, _context, selection_data, _info, _time|
164
+
165
+ index = @grid.child_get_property(button, "top-attach")
166
+ selection_data.set(Gdk::Selection::TYPE_INTEGER, index.to_s)
167
+ end
168
+ #button.signal_connect "drag-data-delete" do
169
+ # puts "drag data delete for #{inex}"
170
+ #end
171
+ #button.signal_connect "drag-end" do
172
+ # puts "drag end for #{index}"
173
+ #end
174
+ end
175
+
176
+ def add_dnd_destination(button)
177
+ button.drag_dest_set(Gtk::DestDefaults::MOTION |
178
+ Gtk::DestDefaults::HIGHLIGHT,
179
+ [["test", :same_app, 12_345]],
180
+ Gdk::DragAction::COPY |
181
+ Gdk::DragAction::MOVE)
182
+
183
+ # Drag destination signals
184
+ # drag-motion Drag icon moves over a drop area Allow only certain areas to be dropped onto
185
+ # drag-drop Icon is dropped onto a drag area Allow only certain areas to be dropped onto
186
+ # drag-data-received When drag data is received by the destination Transfer drag data from source to destination
187
+ #button.signal_connect "drag-motion" do
188
+ # puts "drag motion for #{index}"
189
+ #end
190
+ button.signal_connect("drag-drop") do |widget, context, _x, _y, time|
191
+ widget.drag_get_data(context, context.targets[0], time)
192
+ end
193
+ button.signal_connect("drag-data-received") do |_widget, context, _x, _y, selection_data, _info, _time|
194
+ index = @grid.child_get_property(button, "top-attach")
195
+ index_of_dragged_object = index
196
+ context.targets.each do |target|
197
+ if target.name == "test" ||
198
+ selection_data.type == Gdk::Selection::TYPE_INTEGER
199
+ data_len = selection_data.data[1]
200
+ index_of_dragged_object = selection_data.data[0].pack("C#{data_len}").to_i
201
+ else
202
+ next
203
+ end
204
+ end
205
+ if index_of_dragged_object != index
206
+ child = @window.notebook.get_nth_page(index_of_dragged_object)
207
+ @window.notebook.reorder_child(child, index)
208
+ @window.notebook.children.each_with_index do |child, i|
209
+ @grid.get_child_at(0, i).image = generate_preview_image(child.preview)
210
+ end
211
+ end
212
+ end
213
+ end
214
+ end
@@ -0,0 +1,60 @@
1
+ # Copyright 2015-2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
+ # This file is part of Germinal.
3
+ #
4
+ # Germinal is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # Germinal is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with Germinal. If not, see <http://www.gnu.org/licenses/>.
16
+ class GerminalTermOverview < Gtk::ScrolledWindow
17
+ def initialize(window)
18
+ puts "new term chooser"
19
+ @window = window
20
+ super(nil, nil)
21
+ vbox = Gtk::Box.new(:vertical, 0)
22
+ add(vbox)
23
+ current_page = @window.notebook.page
24
+ @window.notebook.children.each_with_index do |child, i|
25
+ child.show
26
+ _x,_y,w,h = child.allocation.to_a
27
+ done, x, y = child.translate_coordinates(@window.notebook, 0, 0)
28
+ t_hadjustment = child.hadjustment
29
+ t_vadjustment = child.vadjustment
30
+
31
+ puts t_hadjustment.class
32
+ #@window.notebook.set_current_page(i)
33
+ #@window.notebook.queue_draw
34
+ #@window.show_all
35
+ child.window.show
36
+ term_pixbuf = child.window.to_pixbuf(0,0,w,h)
37
+ #surf = child.window.create_similar_surface(Cairo::CONTENT_COLOR,
38
+ # w,
39
+ # h)
40
+ #an = surf.to_pixbuf(0,0,w,h)
41
+ #child.unmap
42
+ ratio = term_pixbuf.width / term_pixbuf.height
43
+ term_pixbuf = term_pixbuf.scale(100, 100 / ratio, Gdk::Pixbuf::INTERP_BILINEAR)
44
+ img = Gtk::Image.new(:pixbuf => term_pixbuf)
45
+ img.show
46
+ vbox.pack_start(img, :expand => true, :fill => true)
47
+ end
48
+ @window.notebook.current.window.show
49
+ @window.notebook.current.window.raise
50
+ #vbox.pack_start(img, :expand => true, :fill => true)
51
+ # img = Gtk::Image.new(:file => "2.png")
52
+ # img.show
53
+ # vbox.pack_start(img, :expand => true, :fill => true)
54
+ vbox.show
55
+ set_size_request(75,100)
56
+ set_halign(:end)
57
+ set_valign(:center)
58
+ show_all
59
+ end
60
+ end