]> Dogcows Code - chaz/openbox/blob - tests/hideshow.py
Fix prompt cleanup (was not going through the list correctly when freeing items)
[chaz/openbox] / tests / hideshow.py
1 #!/usr/bin/env python
2
3 import pygtk
4 import gtk
5 import gobject
6 pygtk.require('2.0')
7
8 class FolderSelector(gtk.Window):
9 def __init__(self, jules):
10 gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
11 print "init folder selector", self, jules
12 self.set_title("Select Folder")
13 self.jules = jules
14
15 self.set_size_request(140, 200)
16
17 self.list_model = gtk.ListStore(gobject.TYPE_STRING)
18 self.tree = gtk.TreeView(self.list_model)
19 self.folder_column = gtk.TreeViewColumn('Folder')
20 self.tree.append_column(self.folder_column)
21
22 self.folder_cell = gtk.CellRendererText()
23 self.folder_column.pack_start(self.folder_cell, True)
24 self.folder_column.add_attribute(self.folder_cell, 'text', 0)
25
26 self.tree.set_search_column(0)
27
28 self.icon_theme = gtk.icon_theme_get_default()
29
30 self.add(self.tree)
31 self.show_all()
32 self.tree.columns_autosize()
33 print "done init"
34
35 class Jules(gtk.Window):
36 def __init__(self):
37 gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
38 self.set_title("Jules")
39 self.set_size_request(150, 320)
40 self.connect("delete_event", self.on_delete_event)
41 self.connect("destroy", self.on_destroy)
42 self.scroll = gtk.ScrolledWindow()
43
44 self.tree_model = gtk.TreeStore(gobject.TYPE_STRING,
45 gobject.TYPE_STRING)
46 self.tree = gtk.TreeView(self.tree_model)
47 self.file_column = gtk.TreeViewColumn('name', gtk.CellRendererText(),
48 markup=0)
49 self.file_column.set_sort_indicator(True)
50 self.file_column.set_clickable(True)
51 self.file_column.set_sort_column_id(1)
52 self.tree.append_column(self.file_column)
53 self.tree.set_headers_clickable(True)
54 self.tree.set_search_column(0)
55
56 self.scroll.add(self.tree)
57 self.add(self.scroll)
58 self.show_all()
59
60 self.project_selector = FolderSelector(self)
61 self.project_selector.hide()
62 self.project_selector.hide()
63
64 self.project_selector.show()
65
66 def on_delete_event(self, widget, event):
67 return False
68
69 def on_destroy(self, widget):
70 gtk.main_quit()
71
72 def run(self):
73 gtk.main()
74
75
76 if __name__ == "__main__":
77 jules = Jules()
78 jules.run()
This page took 0.034671 seconds and 4 git commands to generate.