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