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

Revision 11069, 3.6 KB (checked in by edent, 3 years ago)

add 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'''
10Returns the floor_list array which stores the status of the node as ip of the node.
11@return the floor_list array that has the ip address of the node.
12'''
13def setFloorNodes():
14        floorBuffer = 10 #used to calculate the ip address of the node
15        floor1_usrp_status=[0,0,0,1,0,0,0,0,0,1,0,0]
16        floor2_usrp_status=[1,1,0,1,0,1,0,1,0,0,1,0]
17        floor3_usrp_status=[1,1,1,1,1,1,1,0,1,0,0,1]
18        floor4_usrp_status=[1,0,0,1,0,0,1,0,0,1,0,0]
19        floor_list=[floor1_usrp_status, floor2_usrp_status, floor3_usrp_status, floor4_usrp_status]
20        for floor in floor_list:
21                for index in range(len(floor)):
22                        floor[index] = floor[index]*(index+1+floorBuffer)
23                floorBuffer += 12
24        return floor_list
25       
26'''
27Displays the static ossie interface page, which also has the javascript built into it.
28'''
29def ossie_view(request):
30        return render_to_response("HtmlPages/ossie.html", locals(), context_instance=RequestContext(request))
31
32'''
33Declares the pixel value location of the nodes relative to the map.
34Each coordinate is (x,y) where x is the width and y is the height from the relative origin
35Also sets the floor_list with setFloorNodes()
36'''
37def map_view(request, floor_num):
38        floor=floor_num
39        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))
40        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))
41        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))
42        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))
43        floor_list = setFloorNodes()
44        return render_to_response("HtmlPages/map.html", locals(), context_instance=RequestContext(request))
45
46"""
47Defines a range for how many nodes are on each floor.
48Also sets the floor_list with setFloorNodes()
49"""
50def grid_view(request):
51        number_of_nodes=range(1,13)
52        floor_list = setFloorNodes()
53        return render_to_response("HtmlPages/grid.html", locals(), context_instance=RequestContext(request))
54
55"""
56Testing
57"""
58def node_menu(request):
59        nodes=[Node(id=3-1, ip=33),
60                Node(id=3-2, ip=34),
61                Node(id=3-3, ip=35),
62                Node(id=3-4, ip=36),
63                Node(id=3-5, ip=37),
64                Node(id=3-6, ip=38)]
65        return render_to_response("HtmlPages/node_menu.html", locals(), context_instance=RequestContext(request))
66
67#@login_required
68def loadNode(request, node_num):
69        return render_to_response("HtmlPages/nodes.html", locals(), context_instance=RequestContext(request))
70
71def properties_page(request):
72        return render_to_response('HtmlPages/properties.html', locals(), context_instance=RequestContext(request))
73
74def tasks_page(request):
75        return render_to_response('HtmlPages/tasks.html', locals(), context_instance=RequestContext(request))
76
77def workspace_page(request):
78        return render_to_response('HtmlPages/workspace.html', locals(), context_instance=RequestContext(request))
79
80#@login_required
81#def views_page(request, view_type):
82#       view = view_type
83#       floor_list = setFloorNodes()
84#       grid=range(1,13)
85#       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))
86#       return render_to_response('HtmlPages/views.html', locals(), context_instance=RequestContext(request))
Note: See TracBrowser for help on using the browser.