[gnoduino] fix processing of example files
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino] fix processing of example files
- Date: Mon, 2 Apr 2012 21:40:29 +0000 (UTC)
commit 7de984e1b8a235016ebfec1067057ec1e486702b
Author: Lucian Langa <lucilanga gnome org>
Date: Mon Apr 2 23:36:18 2012 +0200
fix processing of example files
src/ui.py | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/ui.py b/src/ui.py
index 6f1b42c..fdad5c2 100644
--- a/src/ui.py
+++ b/src/ui.py
@@ -642,7 +642,9 @@ def exampleProcess(widget):
def populateExamples():
submenu = gtk.Menu()
for dir in ["examples", "libraries"]:
- d = os.listdir(misc.get_path(dir))
+ if misc.get_path(dir, "\0") != "\0":
+ d = os.listdir(misc.get_path(dir))
+ else: continue
q = []
for i in d: q.append(misc.get_path(os.path.join(dir, i)))
for c in sorted(q):
@@ -670,11 +672,14 @@ def populateExamples():
item.connect("activate", exampleProcess)
subitem.append(item)
break
- if ext: menuItem.set_submenu(subitem)
+ if ext:
+ menuItem.set_submenu(subitem)
+ submenu.append(menuItem)
else:
- menuItem.set_data("file", os.path.join(c, i))
- menuItem.connect("activate", exampleProcess)
- submenu.append(menuItem)
+ if os.path.basename(os.path.split(c)[0]) == "examples":
+ menuItem.set_data("file", os.path.join(c, i))
+ menuItem.connect("activate", exampleProcess)
+ submenu.append(menuItem)
ex = gtk.MenuItem(_("E_xamples"), use_underline=True)
ex.set_submenu(submenu)
gui.get_object("filemenu").insert(ex, 2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]