473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1412

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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.