@@ -1,105 +1,107 | |||
|
1 | 1 | from django.db import models |
|
2 | 2 | from django.utils import timezone |
|
3 | 3 | |
|
4 | 4 | class Profile(models.Model): |
|
5 | 5 | |
|
6 | 6 | name = models.CharField(max_length=250) |
|
7 | 7 | date_create = models.DateTimeField() |
|
8 | 8 | date_modified = models.DateTimeField(null=True) |
|
9 | 9 | hits = models.PositiveIntegerField() |
|
10 | 10 | state = models.PositiveSmallIntegerField() |
|
11 | 11 | |
|
12 | 12 | class Meta: |
|
13 | 13 | db_table = "abs_profile_antenna" |
|
14 | 14 | |
|
15 | 15 | def save(self): |
|
16 | 16 | if self.pk is None: |
|
17 | 17 | self.date_create = timezone.now() |
|
18 | 18 | self.hits = 0 |
|
19 | 19 | self.state = 1 |
|
20 | 20 | else: |
|
21 | 21 | self.date_modified = timezone.now() |
|
22 | 22 | super(Profile, self).save() |
|
23 | 23 | |
|
24 | 24 | def __unicode__(self): |
|
25 | 25 | return u'%s' % self.name |
|
26 | 26 | |
|
27 | 27 | class Pattern(models.Model): |
|
28 | 28 | |
|
29 | 29 | profile = models.ForeignKey(Profile) |
|
30 | 30 | value = models.PositiveIntegerField() |
|
31 | 31 | date_create = models.DateTimeField() |
|
32 | 32 | date_modified = models.DateTimeField(null=True) |
|
33 | 33 | hits = models.PositiveIntegerField() |
|
34 | 34 | state = models.PositiveSmallIntegerField() |
|
35 | 35 | |
|
36 | 36 | class Meta: |
|
37 | 37 | db_table = "abs_pattern_antenna" |
|
38 | 38 | |
|
39 | 39 | def save(self, *args, **kwargs): |
|
40 | 40 | if not self.pk: |
|
41 | 41 | self.date_create = timezone.now() |
|
42 | 42 | self.hits = 0 |
|
43 | 43 | self.state = 1 |
|
44 | 44 | else: |
|
45 | 45 | self.date_modified = timezone.now() |
|
46 | 46 | super(Pattern, self).save(*args, **kwargs) |
|
47 | 47 | |
|
48 | 48 | def __unicode__(self): |
|
49 | 49 | return u'%s' % self.value |
|
50 | 50 | |
|
51 | 51 | |
|
52 | 52 | class AntennaUp(models.Model): |
|
53 | 53 | |
|
54 | 54 | pattern = models.ForeignKey(Pattern) |
|
55 | 55 | value = models.TextField() |
|
56 | tx = models.TextField() | |
|
57 | rx = models.TextField() | |
|
58 | ues = models.CharField(max_length=120) | |
|
56 | tx = models.TextField(null=True) | |
|
57 | rx = models.TextField(null=True) | |
|
58 | ues = models.CharField(max_length=120, null=True) | |
|
59 | only_rx = models.PositiveSmallIntegerField(default=0) | |
|
59 | 60 | date_create = models.DateTimeField() |
|
60 | 61 | date_modified = models.DateTimeField(null=True) |
|
61 | 62 | hits = models.PositiveIntegerField() |
|
62 | 63 | state = models.PositiveSmallIntegerField() |
|
63 | 64 | |
|
64 | 65 | class Meta: |
|
65 | 66 | db_table = "abs_antenna_up" |
|
66 | 67 | |
|
67 | 68 | def save(self, *args, **kwargs): |
|
68 | 69 | if self.pk is None: |
|
69 | 70 | self.date_create = timezone.now() |
|
70 | 71 | self.hits = 0 |
|
71 | 72 | self.state = 1 |
|
72 | 73 | else: |
|
73 | 74 | self.date_modified = timezone.now() |
|
74 | 75 | super(AntennaUp, self).save(*args, **kwargs) |
|
75 | 76 | |
|
76 | 77 | def __unicode__(self): |
|
77 | 78 | return u'%s' % self.value |
|
78 | 79 | |
|
79 | 80 | |
|
80 | 81 | class AntennaDown(models.Model): |
|
81 | 82 | |
|
82 | 83 | pattern = models.ForeignKey(Pattern) |
|
83 | 84 | value = models.TextField() |
|
84 | tx = models.TextField() | |
|
85 | rx = models.TextField() | |
|
86 | ues = models.CharField(max_length=120) | |
|
85 | tx = models.TextField(null=True) | |
|
86 | rx = models.TextField(null=True) | |
|
87 | ues = models.CharField(max_length=120, null=True) | |
|
88 | only_rx = models.PositiveSmallIntegerField(default=0) | |
|
87 | 89 | date_create = models.DateTimeField() |
|
88 | 90 | date_modified = models.DateTimeField(null=True) |
|
89 | 91 | hits = models.PositiveIntegerField() |
|
90 | 92 | state = models.PositiveSmallIntegerField() |
|
91 | 93 | |
|
92 | 94 | class Meta: |
|
93 | 95 | db_table = "abs_antenna_down" |
|
94 | 96 | |
|
95 | 97 | def save(self, *args, **kwargs): |
|
96 | 98 | if self.pk is None: |
|
97 | 99 | self.date_create = timezone.now() |
|
98 | 100 | self.hits = 0 |
|
99 | 101 | self.state = 1 |
|
100 | 102 | else: |
|
101 | 103 | self.date_modified = timezone.now() |
|
102 | 104 | super(AntennaDown, self).save(*args, **kwargs) |
|
103 | 105 | |
|
104 | 106 | def __unicode__(self): |
|
105 | 107 | return u'%s' % self.value |
@@ -1,281 +1,264 | |||
|
1 | 1 | from django.shortcuts import render_to_response, redirect |
|
2 | 2 | from abscontrol.models import Profile, Pattern, AntennaDown, AntennaUp |
|
3 | 3 | from util.readABSFile import readABSFile |
|
4 | 4 | |
|
5 | 5 | txtAntenna = "[[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ |
|
6 | 6 | "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ |
|
7 | 7 | "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ |
|
8 | 8 | "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ |
|
9 | 9 | "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ |
|
10 | 10 | "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \ |
|
11 | 11 | "[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \ |
|
12 | 12 | "[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]]" |
|
13 | 13 | |
|
14 | 14 | txtTxUp = "[[1,1,1,1,1,1,1,1]," \ |
|
15 | 15 | "[1,1,1,1,1,1,1,1]," \ |
|
16 | 16 | "[1,1,1,1,1,1,1,1]," \ |
|
17 | 17 | "[1,1,1,1,1,1,1,1]," \ |
|
18 | 18 | "[1,1,1,1,1,1,1,1]," \ |
|
19 | 19 | "[1,1,1,1,1,1,1,1]," \ |
|
20 | 20 | "[1,1,1,1,1,1,1,1]," \ |
|
21 | 21 | "[1,1,1,1,1,1,1,1]]" |
|
22 | 22 | |
|
23 | 23 | txtTxDown = "[[1,1,1,1,0,0,0,0]," \ |
|
24 | 24 | "[1,1,1,1,0,0,0,0]," \ |
|
25 | 25 | "[1,1,1,1,0,0,0,0]," \ |
|
26 | 26 | "[1,1,1,1,0,0,0,0]," \ |
|
27 | 27 | "[0,0,0,0,1,1,1,1]," \ |
|
28 | 28 | "[0,0,0,0,1,1,1,1]," \ |
|
29 | 29 | "[0,0,0,0,1,1,1,1]," \ |
|
30 | 30 | "[0,0,0,0,1,1,1,1]]" |
|
31 | 31 | |
|
32 | 32 | txtRxUp = "[[0,0,0,0,1,1,1,1]," \ |
|
33 | 33 | "[0,0,0,0,1,1,1,1]," \ |
|
34 | 34 | "[0,0,0,0,1,1,1,1]," \ |
|
35 | 35 | "[0,0,0,0,1,1,1,1]," \ |
|
36 | 36 | "[1,1,1,1,1,1,1,1]," \ |
|
37 | 37 | "[1,1,1,1,1,1,1,1]," \ |
|
38 | 38 | "[1,1,1,1,1,1,1,1]," \ |
|
39 | 39 | "[1,1,1,1,1,1,1,1]]" |
|
40 | 40 | |
|
41 | 41 | txtRxDown = "[[1,1,1,1,1,1,1,1]," \ |
|
42 | 42 | "[1,1,1,1,1,1,1,1]," \ |
|
43 | 43 | "[1,1,1,1,1,1,1,1]," \ |
|
44 | 44 | "[1,1,1,1,1,1,1,1]," \ |
|
45 | 45 | "[1,1,1,1,1,1,1,1]," \ |
|
46 | 46 | "[1,1,1,1,1,1,1,1]," \ |
|
47 | 47 | "[1,1,1,1,1,1,1,1]," \ |
|
48 | 48 | "[1,1,1,1,1,1,1,1]]" |
|
49 | 49 | |
|
50 | 50 | txtUes = "[0.533333,0.00000,1.06667,0.00000]" |
|
51 | 51 | |
|
52 | 52 | def index(request): |
|
53 | 53 | #latest_poll_list = profileAntenna.objects.all().order_by('-pub_date')[:5] |
|
54 | 54 | profile_list = Profile.objects.all() |
|
55 | 55 | return render_to_response('abscontrol/index.html', {'profile_list': profile_list}) |
|
56 | 56 | |
|
57 | 57 | def new(request): |
|
58 | 58 | profile_list = Profile.objects.all() |
|
59 | 59 | |
|
60 | 60 | return render_to_response('abscontrol/new.html', {'profile_list': profile_list, |
|
61 | 61 | 'txtAntenna' : txtAntenna, |
|
62 | 62 | 'txtUes' : txtUes, 'txtTxUp' : txtTxUp, |
|
63 | 63 | 'txtTxDown' : txtTxDown, 'txtRxUp' : txtRxUp, |
|
64 | 64 | 'txtRxDown' : txtRxDown, |
|
65 | 65 | }) |
|
66 | 66 | |
|
67 | 67 | def save(request): |
|
68 | 68 | |
|
69 | 69 | txtProfile = request.POST["txtProfile"] |
|
70 | 70 | |
|
71 | 71 | txtAntennaUp = request.POST["txtAntennaUp"] |
|
72 | 72 | txtTxUp = request.POST["txtTxUp"] |
|
73 | 73 | txtRxUp = request.POST["txtRxUp"] |
|
74 | 74 | txtUesUp = request.POST["txtUesUp"] |
|
75 | 75 | |
|
76 | 76 | txtAntennaDown = request.POST["txtAntennaDown"] |
|
77 | 77 | txtTxDown = request.POST["txtTxDown"] |
|
78 | 78 | txtRxDown = request.POST["txtRxDown"] |
|
79 | 79 | txtUesDown = request.POST["txtUesDown"] |
|
80 | 80 | |
|
81 | 81 | newprofile = Profile(name=txtProfile) |
|
82 | 82 | newprofile.save() |
|
83 | 83 | |
|
84 | 84 | newpattern = newprofile.pattern_set.create(value=1) |
|
85 | 85 | newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) |
|
86 | 86 | newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) |
|
87 | 87 | |
|
88 | 88 | newurl = '/abscontrol/view/%d' % newprofile.id |
|
89 | 89 | |
|
90 | 90 | return redirect(newurl) |
|
91 | 91 | |
|
92 | 92 | def view(request, profile_id): |
|
93 | 93 | nextPattern = 0 |
|
94 | 94 | |
|
95 | 95 | if request.method == 'GET' and 'pattern' in request.GET: |
|
96 | 96 | pattern_value = request.GET["pattern"] |
|
97 | 97 | else: |
|
98 | 98 | pattern_value = 1 |
|
99 | 99 | |
|
100 | 100 | profile_list = Profile.objects.all() |
|
101 | 101 | objProfile = Profile.objects.get(pk=profile_id) |
|
102 | 102 | |
|
103 | 103 | lsPatterns = objProfile.pattern_set.all() |
|
104 | 104 | patternChoosen = objProfile.pattern_set.get(value=pattern_value) |
|
105 | 105 | objAntennaUp = patternChoosen.antennaup_set.get() |
|
106 | 106 | objAntennaDown = patternChoosen.antennadown_set.get() |
|
107 | 107 | |
|
108 | 108 | if len(lsPatterns) > 1: |
|
109 | 109 | if pattern_value == 1: |
|
110 | 110 | nextValuePattern = pattern_value + 1 |
|
111 | 111 | nextPattern = objProfile.pattern_set.get(value=nextValuePattern) |
|
112 | 112 | |
|
113 | 113 | |
|
114 | 114 | return render_to_response('abscontrol/view.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
115 | 115 | 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, |
|
116 | 116 | 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, |
|
117 | 117 | 'nextPattern' : nextPattern, |
|
118 | 118 | }) |
|
119 | 119 | |
|
120 | 120 | def edit(request, profile_id): |
|
121 | 121 | if request.method == 'GET' and 'pattern' in request.GET: |
|
122 | 122 | pattern_value = request.GET["pattern"] |
|
123 | 123 | else: |
|
124 | 124 | pattern_value = 1 |
|
125 | 125 | |
|
126 | 126 | profile_list = Profile.objects.all() |
|
127 | 127 | objProfile = Profile.objects.get(pk=profile_id) |
|
128 | 128 | |
|
129 | 129 | lsPatterns = objProfile.pattern_set.all() |
|
130 | 130 | patternChoosen = objProfile.pattern_set.get(value=pattern_value) |
|
131 | 131 | objAntennaUp = patternChoosen.antennaup_set.get() |
|
132 | 132 | objAntennaDown = patternChoosen.antennadown_set.get() |
|
133 | 133 | |
|
134 | 134 | return render_to_response('abscontrol/edit.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
135 | 135 | 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, |
|
136 | 136 | 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, |
|
137 | 137 | }) |
|
138 | 138 | |
|
139 | 139 | def addPattern(request, profile_id): |
|
140 | 140 | profile_list = Profile.objects.all() |
|
141 | 141 | objProfile = Profile.objects.get(pk=profile_id) |
|
142 | 142 | |
|
143 | 143 | return render_to_response('abscontrol/addPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
144 | 144 | 'txtAntenna' : txtAntenna, 'txtUes' : txtUes, |
|
145 | 145 | 'txtTxUp' : txtTxUp, 'txtTxDown' : txtTxDown, |
|
146 | 146 | 'txtRxUp' : txtRxUp, 'txtRxDown' : txtRxDown, |
|
147 | 147 | }) |
|
148 | 148 | |
|
149 | 149 | def editPattern(request, profile_id, pattern_id): |
|
150 | 150 | profile_list = Profile.objects.all() |
|
151 | 151 | objProfile = Profile.objects.get(pk=profile_id) |
|
152 | 152 | lsPatterns = objProfile.pattern_set.all() |
|
153 | 153 | patternChoosen = Pattern.objects.get(pk=pattern_id) |
|
154 | 154 | objAntennaUp = patternChoosen.antennaup_set.get() |
|
155 | 155 | objAntennaDown = patternChoosen.antennadown_set.get() |
|
156 | 156 | |
|
157 | 157 | return render_to_response('abscontrol/editPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
158 | 158 | 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, |
|
159 | 159 | 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, |
|
160 | 160 | }) |
|
161 | 161 | |
|
162 | 162 | def savePattern(request, profile_id): |
|
163 | 163 | pattern_id = 0 |
|
164 | 164 | method = "save" |
|
165 | 165 | |
|
166 | 166 | if 'pattern_id' in request.POST: |
|
167 | 167 | pattern_id = request.POST["pattern_id"] |
|
168 | 168 | method = "update" |
|
169 | 169 | |
|
170 | 170 | maxValuePattern = 0 |
|
171 | 171 | txtAntennaUp = request.POST["txtAntennaUp"] |
|
172 | 172 | txtTxUp = request.POST["txtTxUp"] |
|
173 | 173 | txtRxUp = request.POST["txtRxUp"] |
|
174 | 174 | txtUesUp = request.POST["txtUesUp"] |
|
175 | 175 | |
|
176 | 176 | txtAntennaDown = request.POST["txtAntennaDown"] |
|
177 | 177 | txtTxDown = request.POST["txtTxDown"] |
|
178 | 178 | txtRxDown = request.POST["txtRxDown"] |
|
179 | 179 | txtUesDown = request.POST["txtUesDown"] |
|
180 | 180 | |
|
181 | 181 | if method == "save": |
|
182 | 182 | objProfile = Profile.objects.get(pk=profile_id) |
|
183 | 183 | lsPatterns = objProfile.pattern_set.all() |
|
184 | 184 | for element in lsPatterns: |
|
185 | 185 | if element.value > maxValuePattern: |
|
186 | 186 | maxPattern = element.value |
|
187 | 187 | |
|
188 | 188 | if maxPattern < 10 : |
|
189 | 189 | newValuePattern = maxPattern + 1 |
|
190 | 190 | newpattern = objProfile.pattern_set.create(value=newValuePattern) |
|
191 | 191 | newpattern.antennaup_set.create(value=txtAntennaUp,tx=txtTxUp,rx=txtRxUp,ues=txtUesUp) |
|
192 | 192 | newpattern.antennadown_set.create(value=txtAntennaDown,tx=txtTxDown,rx=txtRxDown,ues=txtUesDown) |
|
193 | 193 | |
|
194 | 194 | newurl = '/abscontrol/%d/view/%d' % (int(profile_id), newpattern.id) |
|
195 | 195 | else: |
|
196 | 196 | newurl = '/abscontrol/edit/%d' % (int(profile_id)) |
|
197 | 197 | else: |
|
198 | 198 | txtAntennaUpId = request.POST["txtAntennaUpId"] |
|
199 | 199 | objAntennaUp = AntennaUp.objects.get(pk=txtAntennaUpId) |
|
200 | 200 | objAntennaUp.value = txtAntennaUp |
|
201 | 201 | objAntennaUp.tx = txtTxUp |
|
202 | 202 | objAntennaUp.rx = txtRxUp |
|
203 | 203 | objAntennaUp.ues = txtUesUp |
|
204 | 204 | objAntennaUp.save() |
|
205 | 205 | |
|
206 | 206 | txtAntennaDownId = request.POST["txtAntennaDownId"] |
|
207 | 207 | objAntennaDown = AntennaDown.objects.get(pk=txtAntennaDownId) |
|
208 | 208 | objAntennaDown.value = txtAntennaDown |
|
209 | 209 | objAntennaDown.tx = txtTxDown |
|
210 | 210 | objAntennaDown.rx = txtRxDown |
|
211 | 211 | objAntennaDown.ues = txtUesDown |
|
212 | 212 | objAntennaDown.save() |
|
213 | 213 | |
|
214 | 214 | newurl = '/abscontrol/%d/view/%d' % (int(profile_id), int(pattern_id)) |
|
215 | 215 | |
|
216 | 216 | return redirect(newurl) |
|
217 | 217 | |
|
218 | 218 | def viewPattern(request, profile_id, pattern_id): |
|
219 | 219 | |
|
220 | 220 | profile_list = Profile.objects.all() |
|
221 | 221 | objProfile = Profile.objects.get(pk=profile_id) |
|
222 | 222 | |
|
223 | 223 | patternChoosen = Pattern.objects.get(pk=pattern_id) |
|
224 | 224 | |
|
225 | 225 | objAntennaUp = patternChoosen.antennaup_set.get() |
|
226 | 226 | objAntennaDown = patternChoosen.antennadown_set.get() |
|
227 | 227 | |
|
228 | 228 | lsPatterns = objProfile.pattern_set.all() |
|
229 | 229 | |
|
230 | 230 | return render_to_response('abscontrol/viewPattern.html', {'objProfile': objProfile, 'profile_list': profile_list, |
|
231 | 231 | 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns, |
|
232 | 232 | 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown, |
|
233 | 233 | }) |
|
234 | 234 | |
|
235 | 235 | def deletePattern(request, profile_id, pattern_id): |
|
236 | 236 | newurl = '/abscontrol/edit/%d' % int(profile_id) |
|
237 | 237 | |
|
238 | 238 | return redirect(newurl) |
|
239 | 239 | |
|
240 | 240 | def importProfile(request): |
|
241 | 241 | |
|
242 | 242 | return render_to_response('abscontrol/import.html', { }) |
|
243 | 243 | |
|
244 | 244 | def saveImport(request): |
|
245 | 245 | if request.method == 'POST': |
|
246 | 246 | txtFilename = request.FILES['txtFile'] |
|
247 | 247 | if txtFilename: |
|
248 | 248 | destination = open('/tmp/'+txtFilename.name, 'wb+') |
|
249 | 249 | for chunk in txtFilename.chunks(): |
|
250 | 250 | destination.write(chunk) |
|
251 | 251 | destination.close() |
|
252 | 252 | filename = '/tmp/'+txtFilename.name |
|
253 | 253 | readFile = readABSFile(filename) |
|
254 | 254 | expName, num_patterns, patterns = readFile.getMetadata() |
|
255 | ||
|
256 | ''' | |
|
257 | f = open('/tmp/'+txtFilename.name, 'r') | |
|
258 | newContent = f.readlines() | |
|
259 | f.close() | |
|
260 | content = "" | |
|
261 | for i,line in enumerate(newContent): | |
|
262 | if i == 0: | |
|
263 | newLine = line.replace("'","") | |
|
264 | pos = newLine.find("=") | |
|
265 | expName = newLine[pos+1:].strip() | |
|
266 | elif i == 2: | |
|
267 | pos = line.find("=") | |
|
268 | num_patterns = line[pos+1:].strip() | |
|
269 | else: | |
|
270 | content += line | |
|
271 | ''' | |
|
272 | 255 | else: |
|
273 | 256 | txtFilename = "Error" |
|
274 | 257 | #content = "Error" |
|
275 | 258 | expName = "" |
|
276 | 259 | num_patterns = 0 |
|
277 | 260 | |
|
278 | 261 | return render_to_response('abscontrol/upload.html', {'txtFilename': txtFilename, 'patterns' : patterns, |
|
279 | 262 | 'expName' : expName, 'num_patterns' : num_patterns, |
|
280 | 263 | }) |
|
281 | 264 |
@@ -1,81 +1,85 | |||
|
1 | 1 | /* |
|
2 | 2 | * font-family: 'Droid Sans', sans-serif; |
|
3 | 3 | * font-family: 'Ubuntu', sans-serif; |
|
4 | 4 | * font-family: 'Open Sans', sans-serif; |
|
5 | 5 | * font-family: 'Open Sans Condensed', sans-serif; |
|
6 | 6 | * font-family: 'Roboto Condensed', sans-serif; |
|
7 | 7 | */ |
|
8 | 8 | |
|
9 |
body { font-size: 1 |
|
|
9 | body { font-size: 12px; } | |
|
10 | 10 | header {border: 1px solid #fcc; font-size: 2em; height: 50px; text-align: center; line-height: 50px} |
|
11 | 11 | #schema {margin: 0 auto; width: 980px; border: 1px solid #f00; padding: 10px 10px 10px 10px} |
|
12 | 12 | #content {border: 1px solid #1cc; margin-top: 5px; margin-bottom: 5px} |
|
13 | 13 | #content #leftcolumn {float: left;border: 1px solid #c55; width: 150px; } |
|
14 | 14 | #content #maincolumn {float: left; border: 1px solid #000; width: 800px; padding-left: 20px;} |
|
15 | 15 | footer {border: 1px solid #200; font-size: 0.9em; height: 30px; text-align: center; line-height: 20px} |
|
16 | 16 | |
|
17 | 17 | .cleardivs {clear: both; border: 0px solid #400; height: 0px} |
|
18 | 18 | /****************************************************************************************/ |
|
19 | 19 | /****** ESTILOS GENERALES *****************/ |
|
20 | 20 | /****************************************************************************************/ |
|
21 | 21 | .mnu{ height: 22px; border: 0px solid #c55 !important;} |
|
22 | 22 | .mnu li{ display:inline;} |
|
23 | 23 | .MnuVertical, .MnuHorizontal { font-family: 'Droid Sans', sans-serif; font-size: 1.2em; font-style: italic; text-shadow: 2px 2px #eee} |
|
24 | 24 | .MnuHorizontal ul{ list-style: none; list-style-type: none; margin: 0;} |
|
25 | 25 | |
|
26 | 26 | /*.MnuHorizontal{ display: -webkit-box; -webkit-box-orient:horizontal;}*/ |
|
27 | 27 | /*.MnuHorizontal a{ display:block; padding:10px; -webkit-box-flex:1; text-align:center; }*/ |
|
28 | 28 | |
|
29 | 29 | /****************************************************************************************/ |
|
30 | 30 | /****** MENU DE NAVEGACION DE PERFILES **********************************/ |
|
31 | 31 | /****************************************************************************************/ |
|
32 | 32 | #content #infoProfiles {border: 1px solid #d00 !important; width: 140px; margin: 0px; padding-top: 2px; padding-bottom: 2px} |
|
33 | 33 | .lblInfo {padding-left: 12px; line-height: 20px;} |
|
34 | 34 | #infoProfiles select {padding-left: 12px; line-height: 20px;margin-left: 12px} |
|
35 | 35 | #content nav {border: 0px solid #c55 !important; margin: 0px;} |
|
36 | 36 | |
|
37 | 37 | #leftcolumn #mnuProfiles{ margin: 5px 0px; border: 0px solid #1494F6 !important; } |
|
38 | 38 | #mnuProfiles ul{list-style: none; list-style-type: none; margin: 0; padding-left: 20px; border: 0px solid #f00 !important} |
|
39 | 39 | #mnuProfiles li{ width: 80px; padding: 2px; border: 0px solid #c55 !important; line-height: 22px} |
|
40 | 40 | #mnuProfiles a{ font-weight: normal; color: #1494F6; display: block; border: 0px solid #1cc !important; text-align: left} |
|
41 | 41 | |
|
42 | 42 | /****************************************************************************************/ |
|
43 | 43 | /******** FORMULARIO DE PERFILES *************************************/ |
|
44 | 44 | /****************************************************************************************/ |
|
45 | 45 | #divProfile { border: 0px solid #dff; margin: 10px 0px; padding: 10px 10px; width: 500px } |
|
46 | 46 | .flsAntenna { margin: 10px 0px; width: 750px; padding: 10px 10px } |
|
47 |
#divPattern textarea,input[type=text],label{ font-family: |
|
|
47 | #divPattern textarea,input[type=text],label{ font-family: "Open Sans"; font-size: inherit; } | |
|
48 | 48 | |
|
49 | 49 | #divPattern textarea {resize: none; overflow: hidden} |
|
50 | 50 | |
|
51 | 51 | .divAntenna { float: left; margin: 10px; height: 160px; border: 0px solid #fcc !important; width: 260px } |
|
52 | 52 | .divAntenna label{ display: block } |
|
53 |
.txtAntenna { |
|
|
54 |
.divAntenna p{ |
|
|
53 | .txtAntenna { width: 250px; max-width: 250px; height: 135px; max-height: 140px; } | |
|
54 | .divAntenna p{ width: 250px; max-width: 250px; height: 130px; max-height: 130px; border: 1px solid #eee !important} | |
|
55 | 55 | |
|
56 | 56 | .divTx { display: block; float: left; margin: 10px; height: 150px } |
|
57 | 57 | .divTx label{ display: block } |
|
58 |
.divTx textarea{ width: 135px; max-width: 135px; height: 1 |
|
|
59 |
.divTx p{ width: 135px; max-width: 135px; height: 1 |
|
|
58 | .divTx textarea{ width: 135px; max-width: 135px; height: 135px; max-height: 140px; text-align: justify } | |
|
59 | .divTx p{ width: 135px; max-width: 135px; height: 130px; max-height: 130px; text-align: justify } | |
|
60 | 60 | |
|
61 | 61 | .divUes { display: block; margin: 10px} |
|
62 | 62 | .divUes input[type=text] { width: 240px; max-width: 240px;} |
|
63 | 63 | |
|
64 | 64 | /****************************************************************************************/ |
|
65 | 65 | /****** MENU DE NAVEGACION DE PATRONES **********************************/ |
|
66 | 66 | /****************************************************************************************/ |
|
67 | 67 | #divMnuPattern{ width: 280px; height: 25px; display: block; border: 0px solid #1cc !important; float: left; margin-left: 500px} |
|
68 | 68 | #divMnuPattern li{ float: left; display: block; width: 60px; border: 0px solid #2cc !important} |
|
69 | 69 | #divMnuPattern a{ display: block; line-height: 22px; text-decoration: none; padding: 0px 5px; |
|
70 | 70 | border-bottom: 1px solid #1494F6 !important; margin: 0px 2px; text-align: center; color: #1494F6 |
|
71 | 71 | } |
|
72 | 72 | #infoPattern{ display: block; border: 1px solid #1494f6 !important, margin: 5px 2px; } |
|
73 | 73 | |
|
74 | 74 | #navPatterns{ margin: 10px auto; border: 0px solid #d00 !important; width: 500px; height: 30px; font-family: 'Ubuntu', sans-serif; font-size: 14px; |
|
75 | 75 | padding: 10px 0px} |
|
76 | 76 | #navPatternList{ margin: 0px auto; border: 1px solid #ecc !important} |
|
77 | 77 | #navPatternList ul{ list-style: none; list-style-type: none; margin: 0;} |
|
78 | 78 | #navPatternList ul li{ float: left; width: 50px; border: 1px solid #eee !important; } |
|
79 | 79 | #navPatternList a{ width: 50px; border: 0px solid #1cc !important; display: block; text-align: center; line-height: 25px} |
|
80 | 80 | .lnkPattern{ background-color: #ccc !important; color: #eee;} |
|
81 | 81 | .lnkPatternSelected{ background-color: #2cc !important; color: #fff;} |
|
82 | ||
|
83 | .divListofPatterns{ width: 650px; display: block; border: 1px solid #1cc !important; margin: 0 auto} | |
|
84 | .divPattern{ width: 600px; display: block; border: 1px solid #f00 !important; margin: 2px auto; } | |
|
85 |
@@ -1,36 +1,37 | |||
|
1 | 1 | {% extends "abscontrol/index.html" %} |
|
2 | 2 | {% block title %}ABS CONTROL:::::IMPORT PROFILE{% endblock %} |
|
3 | 3 | |
|
4 | 4 | {% block content %} |
|
5 | 5 | <div id="content"> |
|
6 | 6 | <div id="divPattern"> |
|
7 | 7 | <div class="divUes"> |
|
8 | <label for="lblFile">File:</label> | |
|
9 | <label for="lblFilename">{{ txtFilename }}</label> | |
|
8 | <label for="lblFile">File: {{ txtFilename }}</label> | |
|
10 | 9 | </div> |
|
11 | 10 | <div class="divUes"> |
|
12 | <label for="lblExperiment">Experiment:</label> | |
|
13 | <p>{{ expName }}</p> | |
|
14 | <label for="lblNumber">Number of patterns:</label> | |
|
15 | <p>{{ num_patterns }}</p> | |
|
11 | <label for="lblExperiment">Experiment: {{ expName }}</label><br /> | |
|
12 | <label for="lblNumber">Number of patterns: {{ num_patterns }}</label> | |
|
16 | 13 | </div> |
|
17 | 14 | {% if patterns %} |
|
18 | <div> | |
|
15 | <div class="divListofPatterns"> | |
|
19 | 16 | {% for element in patterns %} |
|
20 | <div> | |
|
21 | <label for="lblNumber">Pattern: {{ element.number }}</label> | |
|
17 | <div class="divPattern"> | |
|
18 | <div> | |
|
19 | <label for="lblNumber">Pattern: {{ element.number }}</label> | |
|
20 | </div> | |
|
21 | <div class="divAntenna"> | |
|
22 | <label for="lblAntennaUp">Antenna Up:</label> | |
|
23 | <p>{{ element.up }}</p> | |
|
24 | </div> | |
|
25 | <div class="divAntenna"> | |
|
26 | <label for="lblAntennaDown">Antenna Down:</label> | |
|
27 | <p>{{ element.down }}</p> | |
|
28 | </div> | |
|
29 | <div class="cleardivs"></div> | |
|
22 | 30 | </div> |
|
23 | <div> | |
|
24 | <label for="lblAntennaUp">Antenna Up:</label> | |
|
25 | <p>{{ element.up }}</p> | |
|
26 | </div> | |
|
27 | <div> | |
|
28 | <label for="lblAntennaDown">Antenna Down:</label> | |
|
29 | <p>{{ element.down }}</p> | |
|
30 | </div> | |
|
31 | <div class="cleardivs"></div> | |
|
31 | 32 | {% endfor %} |
|
32 | 33 | </div> |
|
33 | 34 | {% endif %} |
|
34 | 35 | </div> |
|
35 | 36 | </div> |
|
36 | 37 | {% endblock %} |
@@ -1,50 +1,70 | |||
|
1 | 1 | ''' |
|
2 | 2 | Created on May 2, 2013 |
|
3 | 3 | |
|
4 | 4 | @author: Jose Antonio Sal y Rosas Celi |
|
5 | 5 | @contact: jose.salyrosas@jro.igp.gob.pe |
|
6 | 6 | ''' |
|
7 | 7 | |
|
8 | 8 | class readABSFile(object): |
|
9 | 9 | |
|
10 | 10 | __scriptName = "readABSFile.py" |
|
11 | 11 | |
|
12 | 12 | def __init__(self, filename): |
|
13 | 13 | self.fileName = filename |
|
14 | 14 | self.content = "" |
|
15 | 15 | self.exp_name = "" |
|
16 | 16 | self.number_patterns = 0 |
|
17 | 17 | self.patterns = {} |
|
18 | 18 | |
|
19 | 19 | def readFile(self): |
|
20 | 20 | f = open(self.fileName, 'r') |
|
21 | 21 | self.content = f.readlines() |
|
22 | 22 | f.close() |
|
23 | 23 | |
|
24 | 24 | def getMetadata(self): |
|
25 | 25 | self.readFile() |
|
26 | 26 | |
|
27 | 27 | newLine = self.content[0].replace("'","") |
|
28 | 28 | pos = newLine.find("=") |
|
29 | 29 | self.exp_name = newLine[pos+1:].strip() |
|
30 | 30 | |
|
31 | 31 | pos = self.content[2].find("=") |
|
32 | 32 | self.number_patterns = int(self.content[2][pos+1:].strip()) |
|
33 | 33 | |
|
34 | 34 | self.patterns = self.getPatterns(self.content[3:]) |
|
35 | 35 | |
|
36 | 36 | return self.exp_name, self.number_patterns, self.patterns |
|
37 | 37 | |
|
38 | 38 | def getPatterns(self, content): |
|
39 | 39 | lsPattern = [] |
|
40 | index = 8 | |
|
40 | patterns = self.getValueofPattern(content) | |
|
41 | for element in patterns: | |
|
42 | if element != "": | |
|
43 | strValue = element.replace("=","/") | |
|
44 | pattern = strValue.split("/") | |
|
45 | dicPattern = {"number" : pattern[0], "up" : pattern[1], "down" : pattern[2]} | |
|
46 | lsPattern.append(dicPattern) | |
|
41 | 47 | |
|
42 | for i in range(0, self.number_patterns): | |
|
43 | first = i+index | |
|
44 | second = first+index | |
|
45 | antennaUp = content[i:first] | |
|
46 | antennaDown = content[first+1:second] | |
|
47 | dicPattern = {"number" : content[i], "up" : antennaUp, "down" : antennaDown} | |
|
48 | lsPattern.append(dicPattern) | |
|
48 | return lsPattern | |
|
49 | ||
|
50 | def getValueofPattern(self, content): | |
|
51 | strValue = "".join(element.replace("\n","+").strip() for element in content) | |
|
52 | strValue = strValue.replace("\r","+") | |
|
53 | strValue = strValue.replace("$","") | |
|
54 | strValue = strValue.replace("]]+++[[","]]/[[") | |
|
55 | strValue = strValue.replace("]]++[[","]]/[[") | |
|
56 | strValue = strValue.replace("]]+[[","]]/[[") | |
|
57 | strValue = strValue.replace("],++[","],[") | |
|
58 | strValue = strValue.replace("],+[","],[") | |
|
59 | strValue = strValue.replace("]]+++","]]|") | |
|
60 | strValue = strValue.replace("]]++","]]|") | |
|
61 | strValue = strValue.replace("]]+","]]|") | |
|
62 | strValue = strValue.replace(" =++[[","=[[") | |
|
63 | strValue = strValue.replace("=++[[","=[[") | |
|
64 | strValue = strValue.replace(" =+[[","=[[") | |
|
65 | strValue = strValue.replace("=+[[","=[[") | |
|
66 | strValue = strValue.replace("+","").strip() | |
|
67 | #print strValue | |
|
68 | lsPatterns = strValue.split("|") | |
|
49 | 69 | |
|
50 | return lsPattern No newline at end of file | |
|
70 | return lsPatterns No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now