|
Revision 8, 1.5 kB
(checked in by matt_dorn@yahoo.com, 3 years ago)
|
0.2 release
Added multiple list support, mainly
|
| Line | |
|---|
| 1 |
import gtk |
|---|
| 2 |
|
|---|
| 3 |
class TabLinks: |
|---|
| 4 |
|
|---|
| 5 |
active_id=None |
|---|
| 6 |
|
|---|
| 7 |
def __init__(self): |
|---|
| 8 |
pass |
|---|
| 9 |
|
|---|
| 10 |
def render(self, window, links, pages_model): |
|---|
| 11 |
list_store = gtk.ListStore(int, str) |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
cols=window.treeview_links.get_columns() |
|---|
| 15 |
for col in cols: |
|---|
| 16 |
window.treeview_links.remove_column(col) |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
items=links |
|---|
| 20 |
if items: |
|---|
| 21 |
for item in items: |
|---|
| 22 |
list_store.append([item[0], item[1]]) |
|---|
| 23 |
window.treeview_links.set_model(list_store) |
|---|
| 24 |
|
|---|
| 25 |
renderer1 = gtk.CellRendererText() |
|---|
| 26 |
col1=gtk.TreeViewColumn("Linked Pages", renderer1, text=1) |
|---|
| 27 |
col1.set_sort_column_id(0) |
|---|
| 28 |
window.treeview_links.append_column(col1) |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
window.combo_links.clear() |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
window.combo_links.set_model(pages_model) |
|---|
| 35 |
cell = gtk.CellRendererText() |
|---|
| 36 |
window.combo_links.pack_start(cell, True) |
|---|
| 37 |
window.combo_links.set_attributes(cell, text=1) |
|---|
| 38 |
|
|---|
| 39 |
def link(self, window, link_to_id): |
|---|
| 40 |
window.bp.page.linkTo(window.page_id, link_to_id) |
|---|
| 41 |
return |
|---|
| 42 |
|
|---|
| 43 |
def delete(self, window, link_to_id): |
|---|
| 44 |
page_id=window.page_id |
|---|
| 45 |
window.bp.page.unlink(window.page_id, link_to_id) |
|---|
| 46 |
return |
|---|
| 47 |
|
|---|