99
103
self.terminal_scroll = self.builder.get_object("terminal_scroll")
100
104
self.terminal_expander = self.builder.get_object("terminal_expander")
101
105
self.status_label = self.builder.get_object("status_label")
106
self.docs_box = self.builder.get_object("docs_box")
103
108
# set up source view
239
244
self.editor_buffer.set_data('filename', self.current_filename)
240
245
self.editor_view.show()
241
246
self.editor_buffer.set_modified(False) #Reqd for check in run_snippet()
248
self.editor_viewport.show_all()
250
# update snippet information
243
252
self.location_label.set_text(self.current_filename)
244
253
self.description_label.set_text(self.snippetsdata[self.current_filename]["description"])
246
self.editor_viewport.show_all()
257
## first delete any existing docs buttons:
259
kids = self.docs_box.get_children()
264
if "docs" in self.snippetsdata[self.current_filename]:
265
docslist = self.snippetsdata[self.current_filename]["docs"].split(',')
268
url = d.lstrip().rstrip()
269
self.browser.open(url)
270
title = self.browser.title()
272
docsbutton = gtk.LinkButton(url, title)
273
docsbutton.set_alignment(0, 0)
276
self.docs_box.add(docsbutton)
277
self.docs_box.set_child_packing(docsbutton, False, False, 0, gtk.PACK_START)
279
docsbutton = gtk.LinkButton("http://wiki.ubuntu.com/PythonSnippets", _("Click to here to add documentaton for this snippet."))
280
docsbutton.set_alignment(0, 0)
283
self.docs_box.add(docsbutton)
284
self.docs_box.set_child_packing(docsbutton, False, False, 0, gtk.PACK_START)
248
288
def run_snippet(self, widget, data=None):
249
289
"""Run the currently selected snippet"""
360
399
name = re.search(r'\[SNIPPET_NAME: (.*?)]', l)
361
400
cats = re.search(r'\[SNIPPET_CATEGORIES: (.*?)]', l)
362
401
description = re.search(r'\[SNIPPET_DESCRIPTION: (.*?)]', l)
402
docs = re.search(r'\[SNIPPET_DOCS: (.*?)]', l)
364
404
if name is not None:
365
405
itemdict['name'] = name.groups()[0]
370
410
if description is not None:
371
411
itemdict['description'] = description.groups()[0]
374
# tempdict['filename'] = f
414
itemdict['docs'] = docs.groups()[0]
375
416
self.snippetsdata[f] = itemdict
377
418
self.status_label.set_text(str(len(self.snippetsdata)) + _(" snippets available"))