root/ossiedev/branches/jsnyder/trunk/tools/cornetApps/HtmlPages/views.py @ 11070

Revision 11070, 3.7 KB (checked in by edent, 2 years ago)

add more documentation

Line 
1#Create your views here
2
3from django.shortcuts import render_to_response
4from django.template import RequestContext
5from wavedash.src.WavedashController import Controller
6import wavedash.src.WaveformModel
7from django.contrib.auth.decorators import login_required
8
9"""Creates views to display the nodes
10Gets the status of the nodes
11Creates the tuples for each node position for the maps.
12"""
13
14"""
15Returns the floor_list array which stores the status of the node as ip of the node.
16@return the floor_list array that has the ip address of the node.
17"""
18def setFloorNodes():
19        floorBuffer = 10 #used to calculate the ip address of the node
20        floor1_usrp_status=[0,0,0,1,0,0,0,0,0,1,0,0]
21        floor2_usrp_status=[1,1,0,1,0,1,0,1,0,0,1,0]
22        floor3_usrp_status=[1,1,1,1,1,1,1,0,1,0,0,1]
23        floor4_usrp_status=[1,0,0,1,0,0,1,0,0,1,0,0]
24        floor_list=[floor1_usrp_status, floor2_usrp_status, floor3_usrp_status, floor4_usrp_status]
25        for floor in floor_list:
26                for index in range(len(floor)):
27                        floor[index] = floor[index]*(index+1+floorBuffer)
28                floorBuffer += 12
29        return floor_list
30       
31'''
32Displays the static ossie interface page, which also has the javascript built into it.
33'''
34def ossie_view(request):
35        return render_to_response("HtmlPages/ossie.html", locals(), context_instance=RequestContext(request))
36
37'''
38Declares the pixel value location of the nodes relative to the map.
39Each coordinate is (x,y) where x is the width and y is the height from the relative origin
40Also sets the floor_list with setFloorNodes()
41'''
42def map_view(request, floor_num):
43        floor=floor_num
44        node_position_1 = ((169,711),(170,651),(170,597),(211,576),(170,512),(170,449),(190,394),(170,334),(194,298),(170,247),(192,210),(158,145))
45        node_position_2 = ((168,708),(168,639),(168,590),(200,542),(168,508),(204,431),(229,400),(168,338),(204,324),(204,273),(204,228),(204,193))
46        node_position_3 = ((175,705),(175,653),(175,598),(206,558),(175,518),(209,452),(236,404),(158,377),(209,333),(210,285),(209,250),(207,206))
47        node_position_4 = ((184,712),(184,666),(184,613),(219,557),(184,517),(222,437),(248,405),(168,372),(221,335),(220,275),(214,226),(219,190))
48        floor_list = setFloorNodes()
49        return render_to_response("HtmlPages/map.html", locals(), context_instance=RequestContext(request))
50
51"""
52Defines a range for how many nodes are on each floor.
53Also sets the floor_list with setFloorNodes()
54"""
55def grid_view(request):
56        number_of_nodes=range(1,13)
57        floor_list = setFloorNodes()
58        return render_to_response("HtmlPages/grid.html", locals(), context_instance=RequestContext(request))
59
60"""
61Testing
62"""
63def node_menu(request):
64        nodes=[Node(id=3-1, ip=33),
65                Node(id=3-2, ip=34),
66                Node(id=3-3, ip=35),
67                Node(id=3-4, ip=36),
68                Node(id=3-5, ip=37),
69                Node(id=3-6, ip=38)]
70        return render_to_response("HtmlPages/node_menu.html", locals(), context_instance=RequestContext(request))
71
72#@login_required
73def loadNode(request, node_num):
74        return render_to_response("HtmlPages/nodes.html", locals(), context_instance=RequestContext(request))
75
76def properties_page(request):
77        return render_to_response('HtmlPages/properties.html', locals(), context_instance=RequestContext(request))
78
79def tasks_page(request):
80        return render_to_response('HtmlPages/tasks.html', locals(), context_instance=RequestContext(request))
81
82def workspace_page(request):
83        return render_to_response('HtmlPages/workspace.html', locals(), context_instance=RequestContext(request))
84
85#@login_required
86#def views_page(request, view_type):
87#       view = view_type
88#       floor_list = setFloorNodes()
89#       grid=range(1,13)
90#       node_positions_floor_1 = ((169,711),(170,651),(170,597),(211,576),(170,512),(170,449),(190,394),(170,334),(194,298),(170,247),(192,210),(158,145))
91#       return render_to_response('HtmlPages/views.html', locals(), context_instance=RequestContext(request))
Note: See TracBrowser for help on using the browser.