1
2 """
3 A suite of tools for dealing with notebooks...
4 """
5
6 import gtk
7
18
20 """
21 Add the specified view to the given notebook which has
22 been prep'd with prepNotebook. It gives you a bunch of
23 junk for free.
24 """
25 label = createTabLabel(view, notebook)
26 index = notebook.append_page(view, label)
27 notebook.set_tab_reorderable(view, True)
28 notebook.set_tab_detachable(view, True)
29 if totop:
30 notebook.set_current_page(index)
31
34
36 label = gtk.Label(page.vwGetDisplayName())
37
38 if not page.vwIsClosable():
39 return label
40
41 box = gtk.HBox()
42 image = gtk.Image()
43 image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_SMALL_TOOLBAR)
44
45 cbutton = gtk.Button()
46 cbutton.connect("clicked", closeTabButton, page, notebook)
47 cbutton.set_image(image)
48 cbutton.set_relief(gtk.RELIEF_NONE)
49
50 box.pack_start(label, True, True)
51 box.pack_end(cbutton, False, False)
52 box.show_all()
53 return box
54
57
65
66 -def createWindowForPage(page, x=300, y=400):
67 """
68 x and y are the position for the new window
69 """
70
71 win = gtk.Window()
72 nb = prepNotebook()
73 nb.connect("page-removed", notebookWindowPageRemoved, win)
74 appendToNotebook(nb, page)
75 win.notebook = nb
76 win.add(nb)
77 win.show_all()
78 win.move(x,y)
79 return win
80
82 """
83 When a tab is removed from a popped up window, check if it is the last.
84 """
85 if notebook.get_n_pages() == 0:
86 window.destroy()
87