1
from gi.repository import Gtk, Gio, GdkPixbuf
4
def __init__(self, window):
7
left_arrow = Arrow('left')
8
center = Center(window)
9
right_arrow = Arrow('right')
10
self.pack_start(left_arrow, False, True, 0)
11
self.pack_start(center, True, True, 0)
12
self.pack_start(right_arrow, False, True, 0)
17
def __init__(self, direction):
18
Gtk.Box.__init__(self)
19
if direction == 'left':
20
gicon = Gio.ThemedIcon.new_with_default_fallbacks('go-previous-symbolic')
21
elif direction == 'right':
22
gicon = Gio.ThemedIcon.new_with_default_fallbacks('go-next-symbolic')
23
image = Gtk.Image.new_from_gicon(gicon, Gtk.IconSize.DIALOG)
25
button.set_image(image)
26
button.set_relief(Gtk.ReliefStyle.NONE)
27
self.pack_start(button, False, False, 0)
28
button.set_can_focus(False)
31
class Center(Gtk.IconView):
32
def __init__(self, window):
33
Gtk.IconView.__init__(self)
35
self.model = Gtk.ListStore(GdkPixbuf.Pixbuf, str)
36
self.set_model(self.model)
37
self.set_pixbuf_column(0)
38
self.set_text_column(1)
39
self.model.append([self.get_icon('gtk-new'), 'New Document'])
40
self.model.append([self.get_icon('gtk-open'), 'Open File'])
41
self.connect('item-activated', self._on_item_activated)
43
def get_icon(self, name):
44
image = Gtk.Image.new_from_stock(name, Gtk.IconSize.DIALOG)
45
icon = image.get_pixbuf()
48
def _on_item_activated(self, iconview, path):
49
if self.model[path][1] == 'New Document':
50
self.window.request_new_operation(None)