41
49
MODEL_FIELD_PIXBUF = 4
46
54
def expandAll(widget, *args):
48
if args[0] == True: view.expand_all()
49
elif args[0] == False: view.collapse_all()
56
if args[0] == True: view.expand_all()
57
elif args[0] == False: view.collapse_all()
51
59
def showAbout(*args):
52
about = gtk.AboutDialog()
53
about.set_name(appName)
54
about.set_authors(appAuthors)
55
about.set_comments('Explore your desktop with Dogtail')
56
about.set_website('http://people.redhat.com/zcerza/dogtail/')
60
about = gtk.AboutDialog()
61
about.set_name(appName)
62
about.set_authors(appAuthors)
63
about.set_comments('Explore your desktop with Dogtail')
64
about.set_website('http://people.redhat.com/zcerza/dogtail/')
59
67
def connectSignals():
60
sniff.connect('delete_event', quit)
62
quit1 = x.get_widget('quit1')
63
quit1.connect('activate', quit)
65
expand_all1 = x.get_widget('expand_all1')
66
expand_all1.connect('activate', expandAll, True)
67
collapse_all1 = x.get_widget('collapse_all1')
68
collapse_all1.connect('activate', expandAll, False)
70
about1 = x.get_widget('about1')
71
about1.connect('activate', showAbout)
73
refreshMenuItem = x.get_widget('refresh1')
74
refreshMenuItem.connect('activate', refreshAll)
76
view.connect('button-press-event', buttonPress)
77
view.connect('row-expanded', rowExpanded)
78
view.connect('row-collapsed', rowCollapsed)
79
treeSelection = view.get_selection()
80
treeSelection.connect('changed', selectionChanged)
68
sniff.connect('delete_event', quit)
70
quit1 = x.get_widget('quit1')
71
quit1.connect('activate', quit)
73
expand_all1 = x.get_widget('expand_all1')
74
expand_all1.connect('activate', expandAll, True)
75
collapse_all1 = x.get_widget('collapse_all1')
76
collapse_all1.connect('activate', expandAll, False)
78
about1 = x.get_widget('about1')
79
about1.connect('activate', showAbout)
81
refreshMenuItem = x.get_widget('refresh1')
82
refreshMenuItem.connect('activate', refreshAll)
84
view.connect('button-press-event', buttonPress)
85
view.connect('row-expanded', rowExpanded)
86
view.connect('row-collapsed', rowCollapsed)
87
treeSelection = view.get_selection()
88
treeSelection.connect('changed', selectionChanged)
82
90
def buttonPress(widget, event, *userParams):
84
try: path, treeViewCol, relX, relY = \
85
view.get_path_at_pos(int(event.x), int(event.y))
86
except TypeError: return
92
try: path, treeViewCol, relX, relY = \
93
view.get_path_at_pos(int(event.x), int(event.y))
94
except TypeError: return
94
for action in node.actions.values():
95
menuItem = gtk.MenuItem(action.name.capitalize())
96
menuItem.connect('activate', menuItemActivate, action.do)
99
except AttributeError: pass
100
if not menuItem: return
102
menu.popup(None, None, None, event.button, event.time)
102
for action in node.actions.values():
103
menuItem = gtk.MenuItem(action.name.capitalize())
104
menuItem.connect('activate', menuItemActivate, action.do)
106
menu.append(menuItem)
107
if not menuItem: return
109
menu.popup(None, None, None, event.button, event.time)
104
111
# I hate globals too. I think we need one here, though.
105
112
# Make it a non-integer, so we can know if it has been set yet (later).
106
113
textTextViewBufferChangedLastHandlerID = 3.141592654
108
115
def setUpTable(node):
109
"""Generic code for setting up the table under the TreeView"""
110
nameTextLabel.set_text(node.name)
111
roleNameTextLabel.set_text(node.roleName)
112
descTextLabel.set_text(node.description)
115
for action in node.actions.values(): str = ' '.join([str, action.name]).strip()
116
actionsTextLabel.set_text(str)
117
except AttributeError: actionsTextLabel.set_text('')
119
global textTextViewBufferChangedLastHandlerID
120
# Have we connected this signal yet? If so, disconnect it before proceeding.
121
if int(textTextViewBufferChangedLastHandlerID) == \
122
textTextViewBufferChangedLastHandlerID:
123
textTextView.get_buffer().disconnect(textTextViewBufferChangedLastHandlerID)
126
textTextView.set_sensitive(True)
127
buffer = textTextView.get_buffer()
128
buffer.set_text(node.text)
130
# Eeew! I'm touching tree's privates.
131
# This 'assert' will never cause an AssertionError - it
132
# will be an AttributeError.
133
assert node._Node__editableText
134
# Remember the handler ID of this connection.
135
textTextViewBufferChangedLastHandlerID = \
136
buffer.connect('changed', changeText, node)
137
except AttributeError:
138
textTextView.set_sensitive(False)
139
except AttributeError:
140
textTextView.get_buffer().set_text('')
141
textTextView.set_sensitive(False)
116
"""Generic code for setting up the table under the TreeView"""
117
nameTextLabel.set_text(node.name)
118
roleNameTextLabel.set_text(node.roleName)
119
descTextLabel.set_text(node.description)
122
for action in node.actions.values(): str = ' '.join([str, action.name]).strip()
123
actionsTextLabel.set_text(str)
125
global textTextViewBufferChangedLastHandlerID
126
# Have we connected this signal yet? If so, disconnect it before proceeding.
127
if int(textTextViewBufferChangedLastHandlerID) == \
128
textTextViewBufferChangedLastHandlerID:
129
textTextView.get_buffer().disconnect(textTextViewBufferChangedLastHandlerID)
131
if node.text is not None:
132
buffer = textTextView.get_buffer()
133
buffer.set_text(node.text)
134
# Eeew! I'm touching tree's privates.
135
if node._Node__editableText:
136
# Remember the handler ID of this connection.
137
textTextView.set_sensitive(True)
138
textTextViewBufferChangedLastHandlerID = \
139
buffer.connect('changed', changeText, node)
141
textTextView.set_sensitive(False)
143
textTextView.get_buffer().set_text('')
144
textTextView.set_sensitive(False)
143
146
def changeText(textBuffer, node):
144
node.text = textBuffer.get_text(textBuffer.get_start_iter(), \
145
textBuffer.get_end_iter())
147
node.text = textBuffer.get_text(textBuffer.get_start_iter(), \
148
textBuffer.get_end_iter())
147
150
def rowExpanded(treeview, iter, path, *userParams):
150
childRows = row.iterchildren()
153
childNodes = node.children
154
for childNode in childNodes:
155
childRow = childRows.next()
156
addChildren(childNode, childRow.iter)
157
except AttributeError: pass
153
childRows = row.iterchildren()
155
childNodes = node.children
156
for childNode in childNodes:
157
childRow = childRows.next()
158
addChildren(childNode, childRow.iter)
159
160
def rowCollapsed(treeview, iter, path, *userParams):
162
childRows = row.iterchildren()
165
childRow = childRows.next()
166
grandChildRows = childRow.iterchildren()
169
grandChildRow = grandChildRows.next()
170
model.remove(grandChildRow.iter)
171
except StopIteration: pass
172
except StopIteration: pass
163
childRows = row.iterchildren()
166
childRow = childRows.next()
167
grandChildRows = childRow.iterchildren()
170
grandChildRow = grandChildRows.next()
171
model.remove(grandChildRow.iter)
172
except StopIteration: pass
173
except StopIteration: pass
174
175
def selectionChanged(treeSelection):
175
# print "selection changed"
176
node = getSelectedNode()
177
if node: node.blink()
176
# print "selection changed"
177
node = getSelectedNode()
178
if node: node.blink()
179
180
def getSelectedNode():
182
(store, iter) = view.get_selection().get_selected()
183
if not iter: node = None
184
else: node = model[iter][0]
183
(store, iter) = view.get_selection().get_selected()
184
if not iter: node = None
185
else: node = model[iter][0]
187
188
def menuItemActivate(menuItem, *userParams):
188
method = userParams[0]
189
method = userParams[0]
191
192
def refreshAll(menuItem, *userParams):
195
196
def addNodeToModel(node, parentInTreeView = None):
197
iter = model.insert_before(parentInTreeView, None)
198
model.set_value(iter, MODEL_FIELD_NODE, node)
198
iter = model.insert_before(parentInTreeView, None)
199
model.set_value(iter, MODEL_FIELD_NODE, node)
201
202
def addChildren(node, parentInTreeView = None):
204
for child in node.children:
205
iter = addNodeToModel(child, parentInTreeView)
206
except AttributeError: pass
204
for child in node.children:
205
iter = addNodeToModel(child, parentInTreeView)
208
207
def showNode(node, parentInTreeView = None):
210
iter = addNodeToModel(node, parentInTreeView)
211
addChildren(node, iter)
209
iter = addNodeToModel(node, parentInTreeView)
210
addChildren(node, iter)
213
212
def resetModel():
217
rootPath = model.get_path(model.get_iter_root())
218
view.expand_row(rootPath, False)
216
rootPath = model.get_path(model.get_iter_root())
217
view.expand_row(rootPath, False)
220
219
def loadIcon(iconName):
222
pixbuf = gtk.gdk.pixbuf_new_from_file('icons/' + iconName)
223
except gobject.GError:
224
iconName = '/usr/share/dogtail/icons/' + iconName
225
pixbuf = gtk.gdk.pixbuf_new_from_file(iconName)
221
pixbuf = gtk.gdk.pixbuf_new_from_file('icons/' + iconName)
222
except gobject.GError:
223
iconName = '/usr/share/dogtail/icons/' + iconName
224
pixbuf = gtk.gdk.pixbuf_new_from_file(iconName)
228
227
button_xpm = loadIcon("button.xpm")
229
228
checkbutton_xpm = loadIcon("checkbutton.xpm")
251
250
window_xpm = loadIcon("window.xpm")
253
252
iconForRole = { \
254
atspi.SPI_ROLE_INVALID : None, \
255
atspi.SPI_ROLE_ACCEL_LABEL : label_xpm, \
256
atspi.SPI_ROLE_ALERT : None, \
257
atspi.SPI_ROLE_ANIMATION : None, \
258
atspi.SPI_ROLE_ARROW : None, \
259
atspi.SPI_ROLE_CALENDAR : None, \
260
atspi.SPI_ROLE_CANVAS : None, \
261
atspi.SPI_ROLE_CHECK_BOX : checkbutton_xpm, \
262
atspi.SPI_ROLE_CHECK_MENU_ITEM : checkmenuitem_xpm, \
263
atspi.SPI_ROLE_COLOR_CHOOSER : colorselection_xpm, \
264
atspi.SPI_ROLE_COLUMN_HEADER : None, \
265
atspi.SPI_ROLE_COMBO_BOX : combo_xpm, \
266
atspi.SPI_ROLE_DATE_EDITOR : None, \
267
atspi.SPI_ROLE_DESKTOP_ICON : None, \
268
atspi.SPI_ROLE_DESKTOP_FRAME : None, \
269
atspi.SPI_ROLE_DIAL : None, \
270
atspi.SPI_ROLE_DIALOG : dialog_xpm, \
271
atspi.SPI_ROLE_DIRECTORY_PANE : None, \
272
atspi.SPI_ROLE_DRAWING_AREA : None, \
273
atspi.SPI_ROLE_FILE_CHOOSER : None, \
274
atspi.SPI_ROLE_FILLER : None, \
275
atspi.SPI_ROLE_FONT_CHOOSER : None, \
276
atspi.SPI_ROLE_FRAME : window_xpm, \
277
atspi.SPI_ROLE_GLASS_PANE : None, \
278
atspi.SPI_ROLE_HTML_CONTAINER : None, \
279
atspi.SPI_ROLE_ICON : image_xpm, \
280
atspi.SPI_ROLE_IMAGE : image_xpm, \
281
atspi.SPI_ROLE_INTERNAL_FRAME : None, \
282
atspi.SPI_ROLE_LABEL : label_xpm, \
283
atspi.SPI_ROLE_LAYERED_PANE : viewport_xpm, \
284
atspi.SPI_ROLE_LIST : None, \
285
atspi.SPI_ROLE_LIST_ITEM : None, \
286
atspi.SPI_ROLE_MENU : menuitem_xpm, \
287
atspi.SPI_ROLE_MENU_BAR : menubar_xpm, \
288
atspi.SPI_ROLE_MENU_ITEM : menuitem_xpm, \
289
atspi.SPI_ROLE_OPTION_PANE : None, \
290
atspi.SPI_ROLE_PAGE_TAB : notebook_xpm, \
291
atspi.SPI_ROLE_PAGE_TAB_LIST : notebook_xpm, \
292
atspi.SPI_ROLE_PANEL : viewport_xpm, \
293
atspi.SPI_ROLE_PASSWORD_TEXT : None, \
294
atspi.SPI_ROLE_POPUP_MENU : None, \
295
atspi.SPI_ROLE_PROGRESS_BAR : None, \
296
atspi.SPI_ROLE_PUSH_BUTTON : button_xpm, \
297
atspi.SPI_ROLE_RADIO_BUTTON : None, \
298
atspi.SPI_ROLE_RADIO_MENU_ITEM : None, \
299
atspi.SPI_ROLE_ROOT_PANE : viewport_xpm, \
300
atspi.SPI_ROLE_ROW_HEADER : None, \
301
atspi.SPI_ROLE_SCROLL_BAR : vscrollbar_xpm, \
302
atspi.SPI_ROLE_SCROLL_PANE : scrolledwindow_xpm, \
303
atspi.SPI_ROLE_SEPARATOR : vseparator_xpm, \
304
atspi.SPI_ROLE_SLIDER : None, \
305
atspi.SPI_ROLE_SPIN_BUTTON : spinbutton_xpm, \
306
atspi.SPI_ROLE_SPLIT_PANE : None, \
307
atspi.SPI_ROLE_STATUS_BAR : statusbar_xpm, \
308
atspi.SPI_ROLE_TABLE : table_xpm, \
309
atspi.SPI_ROLE_TABLE_CELL : treeitem_xpm, \
310
atspi.SPI_ROLE_TABLE_COLUMN_HEADER : None, \
311
atspi.SPI_ROLE_TABLE_ROW_HEADER : None, \
312
atspi.SPI_ROLE_TEAROFF_MENU_ITEM : None, \
313
atspi.SPI_ROLE_TERMINAL : None, \
314
atspi.SPI_ROLE_TEXT : text_xpm, \
315
atspi.SPI_ROLE_TOGGLE_BUTTON : None, \
316
atspi.SPI_ROLE_TOOL_BAR : toolbar_xpm, \
317
atspi.SPI_ROLE_TOOL_TIP : None, \
318
atspi.SPI_ROLE_TREE : tree_xpm, \
319
atspi.SPI_ROLE_TREE_TABLE : tree_xpm, \
320
atspi.SPI_ROLE_UNKNOWN : unknown_xpm, \
321
atspi.SPI_ROLE_VIEWPORT : viewport_xpm, \
322
atspi.SPI_ROLE_WINDOW : window_xpm, \
323
atspi.SPI_ROLE_EXTENDED : None, \
324
atspi.SPI_ROLE_HEADER : None, \
325
atspi.SPI_ROLE_FOOTER : None, \
326
atspi.SPI_ROLE_PARAGRAPH : None, \
327
atspi.SPI_ROLE_RULER : None, \
328
atspi.SPI_ROLE_APPLICATION : None, \
329
atspi.SPI_ROLE_AUTOCOMPLETE : None, \
330
atspi.SPI_ROLE_EDITBAR : None, \
331
atspi.SPI_ROLE_EMBEDDED : None, \
332
atspi.SPI_ROLE_LAST_DEFINED: None }
253
atspi.SPI_ROLE_INVALID : None, \
254
atspi.SPI_ROLE_ACCEL_LABEL : label_xpm, \
255
atspi.SPI_ROLE_ALERT : None, \
256
atspi.SPI_ROLE_ANIMATION : None, \
257
atspi.SPI_ROLE_ARROW : None, \
258
atspi.SPI_ROLE_CALENDAR : None, \
259
atspi.SPI_ROLE_CANVAS : None, \
260
atspi.SPI_ROLE_CHECK_BOX : checkbutton_xpm, \
261
atspi.SPI_ROLE_CHECK_MENU_ITEM : checkmenuitem_xpm, \
262
atspi.SPI_ROLE_COLOR_CHOOSER : colorselection_xpm, \
263
atspi.SPI_ROLE_COLUMN_HEADER : None, \
264
atspi.SPI_ROLE_COMBO_BOX : combo_xpm, \
265
atspi.SPI_ROLE_DATE_EDITOR : None, \
266
atspi.SPI_ROLE_DESKTOP_ICON : None, \
267
atspi.SPI_ROLE_DESKTOP_FRAME : None, \
268
atspi.SPI_ROLE_DIAL : None, \
269
atspi.SPI_ROLE_DIALOG : dialog_xpm, \
270
atspi.SPI_ROLE_DIRECTORY_PANE : None, \
271
atspi.SPI_ROLE_DRAWING_AREA : None, \
272
atspi.SPI_ROLE_FILE_CHOOSER : None, \
273
atspi.SPI_ROLE_FILLER : None, \
274
atspi.SPI_ROLE_FONT_CHOOSER : None, \
275
atspi.SPI_ROLE_FRAME : window_xpm, \
276
atspi.SPI_ROLE_GLASS_PANE : None, \
277
atspi.SPI_ROLE_HTML_CONTAINER : None, \
278
atspi.SPI_ROLE_ICON : image_xpm, \
279
atspi.SPI_ROLE_IMAGE : image_xpm, \
280
atspi.SPI_ROLE_INTERNAL_FRAME : None, \
281
atspi.SPI_ROLE_LABEL : label_xpm, \
282
atspi.SPI_ROLE_LAYERED_PANE : viewport_xpm, \
283
atspi.SPI_ROLE_LIST : None, \
284
atspi.SPI_ROLE_LIST_ITEM : None, \
285
atspi.SPI_ROLE_MENU : menuitem_xpm, \
286
atspi.SPI_ROLE_MENU_BAR : menubar_xpm, \
287
atspi.SPI_ROLE_MENU_ITEM : menuitem_xpm, \
288
atspi.SPI_ROLE_OPTION_PANE : None, \
289
atspi.SPI_ROLE_PAGE_TAB : notebook_xpm, \
290
atspi.SPI_ROLE_PAGE_TAB_LIST : notebook_xpm, \
291
atspi.SPI_ROLE_PANEL : viewport_xpm, \
292
atspi.SPI_ROLE_PASSWORD_TEXT : None, \
293
atspi.SPI_ROLE_POPUP_MENU : None, \
294
atspi.SPI_ROLE_PROGRESS_BAR : None, \
295
atspi.SPI_ROLE_PUSH_BUTTON : button_xpm, \
296
atspi.SPI_ROLE_RADIO_BUTTON : None, \
297
atspi.SPI_ROLE_RADIO_MENU_ITEM : None, \
298
atspi.SPI_ROLE_ROOT_PANE : viewport_xpm, \
299
atspi.SPI_ROLE_ROW_HEADER : None, \
300
atspi.SPI_ROLE_SCROLL_BAR : vscrollbar_xpm, \
301
atspi.SPI_ROLE_SCROLL_PANE : scrolledwindow_xpm, \
302
atspi.SPI_ROLE_SEPARATOR : vseparator_xpm, \
303
atspi.SPI_ROLE_SLIDER : None, \
304
atspi.SPI_ROLE_SPIN_BUTTON : spinbutton_xpm, \
305
atspi.SPI_ROLE_SPLIT_PANE : None, \
306
atspi.SPI_ROLE_STATUS_BAR : statusbar_xpm, \
307
atspi.SPI_ROLE_TABLE : table_xpm, \
308
atspi.SPI_ROLE_TABLE_CELL : treeitem_xpm, \
309
atspi.SPI_ROLE_TABLE_COLUMN_HEADER : None, \
310
atspi.SPI_ROLE_TABLE_ROW_HEADER : None, \
311
atspi.SPI_ROLE_TEAROFF_MENU_ITEM : None, \
312
atspi.SPI_ROLE_TERMINAL : None, \
313
atspi.SPI_ROLE_TEXT : text_xpm, \
314
atspi.SPI_ROLE_TOGGLE_BUTTON : None, \
315
atspi.SPI_ROLE_TOOL_BAR : toolbar_xpm, \
316
atspi.SPI_ROLE_TOOL_TIP : None, \
317
atspi.SPI_ROLE_TREE : tree_xpm, \
318
atspi.SPI_ROLE_TREE_TABLE : tree_xpm, \
319
atspi.SPI_ROLE_UNKNOWN : unknown_xpm, \
320
atspi.SPI_ROLE_VIEWPORT : viewport_xpm, \
321
atspi.SPI_ROLE_WINDOW : window_xpm, \
322
atspi.SPI_ROLE_EXTENDED : None, \
323
atspi.SPI_ROLE_HEADER : None, \
324
atspi.SPI_ROLE_FOOTER : None, \
325
atspi.SPI_ROLE_PARAGRAPH : None, \
326
atspi.SPI_ROLE_RULER : None, \
327
atspi.SPI_ROLE_APPLICATION : None, \
328
atspi.SPI_ROLE_AUTOCOMPLETE : None, \
329
atspi.SPI_ROLE_EDITBAR : None, \
330
atspi.SPI_ROLE_EMBEDDED : None, \
331
atspi.SPI_ROLE_LAST_DEFINED: None }
334
333
def getPixbufForNode(node):
335
theme = gtk.icon_theme_get_default()
336
if node.role==atspi.SPI_ROLE_APPLICATION:
337
# FIXME: Use the pixbuf from libwcnk (if available):
338
# wnckApp = Application(node).getWnckApplication()
340
try: return theme.load_icon(node.name, 24, gtk.ICON_LOOKUP_USE_BUILTIN)
341
except gobject.GError:
342
try: return theme.load_icon(node.name.lower(), 24, gtk.ICON_LOOKUP_USE_BUILTIN)
343
except gobject.GError: return None
345
return iconForRole[node.role]
347
return theme.load_icon("gnome-fs-desktop", 24, gtk.ICON_LOOKUP_USE_BUILTIN)
334
theme = gtk.icon_theme_get_default()
336
if node.role==atspi.SPI_ROLE_APPLICATION:
337
# FIXME: Use the pixbuf from libwcnk (if available):
338
# wnckApp = Application(node).getWnckApplication()
340
try: return theme.load_icon(node.name, 24, gtk.ICON_LOOKUP_USE_BUILTIN)
341
except gobject.GError:
342
try: return theme.load_icon(node.name.lower(), 24, gtk.ICON_LOOKUP_USE_BUILTIN)
343
except gobject.GError: return None
345
return iconForRole[node.role]
347
return theme.load_icon("gnome-fs-desktop", 24, gtk.ICON_LOOKUP_USE_BUILTIN)
348
except atspi.SpiException:
349
return theme.load_icon("gtk-dialog-error", 24, gtk.ICON_LOOKUP_USE_BUILTIN)
349
351
def getNodeAttr(column, cell, model, iter, attr):
350
node = model.get_value(iter, MODEL_FIELD_NODE)
351
cell.set_property('text', getattr(node, attr))
352
node = model.get_value(iter, MODEL_FIELD_NODE)
354
text = getattr(node, attr)
355
except atspi.SpiException:
356
text = "(broken node)"
357
cell.set_property('text', text)
353
359
def getCellPixbufForNode(column, cell, model, iter):
354
node = model.get_value(iter, MODEL_FIELD_NODE)
355
pixbuf = getPixbufForNode(node)
356
cell.set_property('pixbuf', pixbuf)
360
node = model.get_value(iter, MODEL_FIELD_NODE)
361
pixbuf = getPixbufForNode(node)
362
cell.set_property('pixbuf', pixbuf)
361
nameTextLabel.set_text('')
362
roleNameTextLabel.set_text('')
363
descTextLabel.set_text('')
364
actionsTextLabel.set_text('')
365
textTextView.set_sensitive(False)
366
textTextView.get_buffer().set_text('')
368
global sniff, view, model
370
col = gtk.TreeViewColumn()
371
cellRenderer = gtk.CellRendererPixbuf()
372
col.pack_start(cellRenderer, expand = False)
373
col.set_cell_data_func(cellRenderer, getCellPixbufForNode)
375
cellRenderer = gtk.CellRendererText()
376
col.pack_end(cellRenderer, expand = False)
377
col.set_cell_data_func(cellRenderer, getNodeAttr, 'name')
379
col.set_title('Name')
381
view.insert_column(col, -1)
382
#view.insert_column_with_data_func(-1, "Role Name", \
383
# gtk.CellRendererText(), getNodeAttr, 'roleName')
384
#view.insert_column_with_data_func(-1, "Description", \
385
# gtk.CellRendererText(), getNodeAttr, 'description')
386
for column in view.get_columns():
387
column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
388
column.set_resizable(True)
392
model = gtk.TreeStore(gobject.TYPE_PYOBJECT, gobject.TYPE_STRING, \
393
gobject.TYPE_STRING, gobject.TYPE_STRING)
394
view.set_model(model)
367
nameTextLabel.set_text('')
368
roleNameTextLabel.set_text('')
369
descTextLabel.set_text('')
370
actionsTextLabel.set_text('')
371
textTextView.set_sensitive(False)
372
textTextView.get_buffer().set_text('')
374
global sniff, view, model
376
col = gtk.TreeViewColumn()
377
cellRenderer = gtk.CellRendererPixbuf()
378
col.pack_start(cellRenderer, expand = False)
379
col.set_cell_data_func(cellRenderer, getCellPixbufForNode)
381
cellRenderer = gtk.CellRendererText()
382
col.pack_end(cellRenderer, expand = False)
383
col.set_cell_data_func(cellRenderer, getNodeAttr, 'name')
385
col.set_title('Name')
387
view.insert_column(col, -1)
388
#view.insert_column_with_data_func(-1, "Role Name", \
389
# gtk.CellRendererText(), getNodeAttr, 'roleName')
390
#view.insert_column_with_data_func(-1, "Description", \
391
# gtk.CellRendererText(), getNodeAttr, 'description')
392
for column in view.get_columns():
393
column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
394
column.set_resizable(True)
398
model = gtk.TreeStore(gobject.TYPE_PYOBJECT, gobject.TYPE_STRING, \
399
gobject.TYPE_STRING, gobject.TYPE_STRING)
400
view.set_model(model)
400
406
if __name__ == '__main__': main()