471,337 Members | 1,120 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Need help in TREE MENU in PYTHON

Hello all,
Am working on PYTHON +BRANWAVE(framework)
Actually am Trying 2 make a tree menu using d both. Am not able 2 target the (.tmpl) files and not getting how 2 make frames in .tmpl file...

Can anyone get me a demo screen 4 d same showing a tree on the left and when we click any link in the tree, corresponding page(.tmpl) page opens up on right...

This is a simple Tree Example>>>>>>> file name="mytreeapp.py"
Expand|Select|Wrap|Line Numbers
  1. import iris
  2. import aphrodite
  3. from plugins.CheetahPlugin import CheetahRender
  5. class mytreeapp(iris.App):
  6.     def __init__(self):
  7.         iris.App.__init__(self)
  8.         self.aphrodite = aphrodite.Aphrodite('mytreeapp')
  10.     @iris.expose
  11.     def default(self, *args, **kwargs):
  12.         pass
  14.     @iris.expose
  15.     def index(self, *args, **kwargs):
  16.         return CheetahRender(template="index")
  18.     @iris.expose    
  19.     def tree(self):
  20.         data = [
  21.         {'title':'Rock Music', 'description':'Rock Albums', 'icon':'/mytreeapp/resources/avatars/a1.png', 'items':[
  22.             {'title':'Reckless (1984)', 'description': 'Bryan Adams','items':[{'title':'Summer of 69','description':'B.Adams,J.Vallance','link':'javascript:show("Summer of 69")'},{'title':'One Night Love Affair','description':'B.Adams,J.Vallance','link':'javascript:show("One Night Love Affair")'},{'title':'Heaven','description':'B.Adams,J.Vallance','link':'javascript:show("Heaven")'}]},
  23.             {'title':'Bon Jovi (1984)', 'description': 'Jon Bon Jovi','items':[{'title':'Runaway','description':'Jon Bon Jovi, George Karak','link':'javascript:show("Runaway")'},{'title': "She Don't Know Me",'description':'Mark Avsec','link':'javascript:show("She Don\'t Know Me")'},{'title':'Shot Through The Heart','description':'Bon Jovi, Jack Ponti','link':'javascript:show("Shot Through The Heart")'}]},
  24.             {'title':'The Open Door (2006)', 'description': 'Evanescence','items':[{'title':'Sweet Sacrifice','description':'Amy Lee, Terry Balsamo','link':'javascript:show("Sweet Sacrifice")'},{'title': "Call Me When You're Sober",'description':'Amy Lee, Terry Balsamo','link':'javascript:show("Call Me When You\'re Sober")'},{'title':'Weight of the World','description':'Amy Lee, Terry Balsamo','link':'javascript:show("Weight of the World")'}]}
  25.         ]},
  26.         {'title':'Pop Music', 'description':'Pop Albums', 'icon':'/mytreeapp/resources/avatars/a2.png','items':[
  27.             {'title':'Millennium (1999)', 'description': 'Backstreet Boys','items':[{'title':'Larger than life','description':'Littrell, Lundin, Martin, Orpin','link':'javascript:show("Larger than life")'},{'title':"I Want It That Way",'description':'Carlsson, Martin, Orpin','link':'javascript:show("I Want It That Way")'},{'title':"Show Me the Meaning of Being Lonely",'description':'Crichlow, Martin','link':'javascript:show("Show Me the Meaning of Being Lonely")'}]},
  28.             {'title':'Baby one more time (1999)', 'description': 'Britney Spears','items':[{'title':'...Baby One More Time','description':'M.Martin','link':'javascript:show("...Baby One More Time")'},{'title':'Sometimes','description':'J. Elofsson, P. Magnusson, D. Kreuger, M. Martin','link':'javascript:show("Sometimes")'},{'title':'From the Bottom of My Broken Heart','description':'E. Foster White','link':'javascript:show("From the Bottom of My Broken Heart")'}]},
  29.             {'title':'Escape (2001)', 'description': 'Enrique Iglesias','items':[{'title':'Escape','description':'DioGuardi,Iglesias,Morales,Siegel','link':'javascript:show("Escape")'},{'title':"Don't Turn Off the Lights",'description':'DioGuardi,Iglesias,Morales,Siegel','link':'javascript:show("Don\'t Turn Off the Lights")'},{'title':'Hero','description':'Taylor,Iglesias,Barry','link':'javascript:show("Hero")'}]}
  30.         ]}    
  31.         ]
  32.         iris.json(data)

function show(text)
document.getElementById('song_title').innerHTML="" ;
document.getElementById('song_title').innerHTML=te xt;

<center><box title='Demo Tree' style="width:400px">
<div style="text-align:left;overflow:auto;height:300px;" >
<tree id="mytree" url="/mytreeapp/tree" />
<box title="Song Title" style="width:500px;">
<div id='song_title'>



Preet kanwal Singh
Sep 10 '07 #1
0 1345

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Jo | last post: by
4 posts views Thread by Sergio Millich | last post: by
reply views Thread by Tree menu using XML | last post: by
1 post views Thread by Jesper DK | last post: by
66 posts views Thread by genestarwing | last post: by
6 posts views Thread by Travis | last post: by
3 posts views Thread by Travis | last post: by
2 posts views Thread by Travis | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.