472,992 Members | 3,152 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 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
  4.  
  5. class mytreeapp(iris.App):
  6.     def __init__(self):
  7.         iris.App.__init__(self)
  8.         self.aphrodite = aphrodite.Aphrodite('mytreeapp')
  9.  
  10.     @iris.expose
  11.     def default(self, *args, **kwargs):
  12.         pass
  13.  
  14.     @iris.expose
  15.     def index(self, *args, **kwargs):
  16.         return CheetahRender(template="index")
  17.  
  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)
  33.  
THE CORRESPONDING VIEW PAGE(index.tmpl) WILL BE>>>>


<window>
<script>
function show(text)
{
document.getElementById('song_title').innerHTML="" ;
document.getElementById('song_title').innerHTML=te xt;
}
</script>

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

</box>
</center>
</window>


REGARDS,

Preet kanwal Singh
Sep 10 '07 #1
0 1398

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

Similar topics

2
by: Jo | last post by:
I don't know if this can be done.. But here is what i am trying to do... I have a tree menu on a frameless page. I have the menu on the right hand side and a CGI web form post on the left....
4
by: Sergio Millich | last post by:
I have an annoyîng problem with a javascript tree. When you scroll down to the bottom of the tree and click to open a node the tree is refreshed and scrolls back to the top, hiding the node. Is...
0
by: Tree menu using XML | last post by:
I have one XML file that has nodes and sub node and each and every node has the attribute call visible if its value is true then diplay this node else don't display thid node, but this condition i...
1
by: Jesper DK | last post by:
Hi, I have docked a tree view to the left on a form. When I start to populate this tree view with nodes, a horizontal scroll box appears in the bottom of the tree view even though thee tree...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
6
by: Travis | last post by:
Is there a community accepted best way to store a menu tree for an interface in a data structure. Ideally I would like something that searches fast so given a menu structure like this File / ...
3
by: Travis | last post by:
I've created a custom Tree template. The tree mimics a menu tree and has the following properties. - nodes are identified by a unique name - any node can have infinite child nodes - nodes are not...
2
by: Travis | last post by:
I'm curious how these two structures match up for my use. I've created a custom tree which is not sorted and each node can have infinite children. Why? Because each node is a menu in a simple GUI...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.