Merge lp:~dholbach/ubuntu-review-overview/js into lp:ubuntu-review-overview

Proposed by Daniel Holbach
Status: Merged
Merged at revision: 28
Proposed branch: lp:~dholbach/ubuntu-review-overview/js
Merge into: lp:ubuntu-review-overview
Diff against target: 273 lines (+120/-62)
6 files modified
.bzrignore (+1/-0)
countdown.py (+21/-49)
data.py (+9/-6)
patch-overview.py (+1/-5)
review/default.css (+85/-0)
review/example.html (+3/-2)
To merge this branch: bzr merge lp:~dholbach/ubuntu-review-overview/js
Reviewer Review Type Date Requested Status
Ubuntu Review Team Pending
Review via email: mp+27258@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-06-09 09:04:53 +0000
3+++ .bzrignore 2010-06-10 11:43:25 +0000
4@@ -4,3 +4,4 @@
5 review/meter.horiz.png
6 review/meter.png
7 review/total.txt
8+review/gadget.js
9
10=== modified file 'clean-sweep.py' (properties changed: -x to +x)
11=== modified file 'countdown.py'
12--- countdown.py 2010-06-09 09:04:53 +0000
13+++ countdown.py 2010-06-10 11:43:25 +0000
14@@ -6,42 +6,21 @@
15
16 import data
17
18-def write_css(reviewed, total):
19- css_text = """
20- .progress-bar {
21- background:url("bg.png") repeat-x;
22- border: 1px solid #cbcbcb;
23- width: 293px;
24- margin: 5px;
25- padding: 1px;
26- padding-left: 2px;
27- padding-right: 1px;
28- float: left;
29- -moz-border-radius: 10px;
30- -khtml-border-radius: 10px;
31- -webkit-border-radius: 10px;
32- border-radius: 10px;
33- }
34-
35- .bar {
36- height: 14px;
37- text-indent:-9000px;
38- background: #eee url(bar.png);
39- -moz-border-radius: 10px;
40- -khtml-border-radius: 10px;
41- -webkit-border-radius: 10px;
42- border-radius: 10px;
43- width: """
44- css_text += str(int(293*float(reviewed)/float(total)))+"px;"
45- css_text += """
46- }
47-"""
48- css_file = os.path.join(data.data_dir(), "meter.css")
49- if os.path.exists(css_file):
50- os.remove(css_file)
51- f = open(css_file, "w")
52- f.write(css_text)
53- f.close()
54+def write_js(reviewed, total):
55+ percent = str(reviewed*100/total)+"%"
56+ js_text ="""/* Ubuntu Reviews Gadget */
57+var gadget =\'<link rel="stylesheet" href="default.css" type="text/css" media="screen">\'+
58+\'<div id="badge">\'+
59+\'<div id="ubuntu-reviewers-logo"></div>\'+
60+\'<div id="ubuntu-logo"></div>\'+
61+\'<div id="progress-bar"><div id="bar" style="width:%s">%s</div></div>\'+
62+\'<div id="percentage">%s</div>\'+
63+\'<div id="ubuntu-review-team"><img src="images/3.png"><a href="http://launchpad.net/ubuntu-review" target="_blank">Powered by Ubuntu Review Gadget</a></div>\'+
64+\'</div>\';
65+document.write(gadget);
66+""" % (percent, percent, percent)
67+ js_file = os.path.join(data.data_dir(), "gadget.js")
68+ data.write_file(js_file, js_text)
69
70 def draw(reviewed, total, horizontal=False):
71 if horizontal:
72@@ -60,14 +39,6 @@
73 im.putpixel((x,y), (255,0,0))
74 im.save(os.path.join(data.data_dir(), meterfile))
75
76-def write_out(file_name, number):
77- if os.path.exists(file_name):
78- os.remove(file_name)
79- f = open(file_name, "w")
80- f.write("%s\n" % str(number))
81- f.close()
82-
83-
84 def main():
85 launchpad = data.lp_login()
86 datadir = data.data_dir()
87@@ -82,13 +53,14 @@
88 print "In the queue: %s" % (total_patches-already_reviewed_patches)
89 draw(already_reviewed_patches, total_patches, False)
90 draw(already_reviewed_patches, total_patches, True)
91- write_out(os.path.join(datadir, "in-the-queue.txt"),
92- total_patches-already_reviewed_patches)
93- write_out(os.path.join(datadir, "total.txt"),
94- total_patches)
95- write_css(already_reviewed_patches, total_patches)
96+ data.write_file(os.path.join(datadir, "in-the-queue.txt"),
97+ str(total_patches-already_reviewed_patches))
98+ data.write_file(os.path.join(datadir, "total.txt"),
99+ str(total_patches))
100+ write_js(already_reviewed_patches, total_patches)
101
102 if __name__ == "__main__":
103+ sys.exit(main())
104 try:
105 sys.exit(main())
106 except Exception, e:
107
108=== modified file 'data.py'
109--- data.py 2010-06-09 09:04:53 +0000
110+++ data.py 2010-06-10 11:43:25 +0000
111@@ -26,6 +26,13 @@
112 def data_dir():
113 return os.path.join(os.path.dirname(__file__), "review")
114
115+def write_file(file_name, content):
116+ if os.path.exists(file_name):
117+ os.remove(file_name)
118+ f = open(file_name, "w")
119+ f.write(content)
120+ f.close()
121+
122 def lp_login(anonymous=True):
123 cachedir = os.path.expanduser("~/.launchpadlib/cache/")
124 creddir = os.path.expanduser('~/.launchpadlib')
125@@ -84,9 +91,5 @@
126 return []
127
128 def write_bug_list(list_of_bugs):
129- if os.path.exists(bug_list):
130- os.remove(bug_list)
131- f = open(bug_list, "w")
132- for bug in list_of_bugs:
133- f.write("%s\n" % str(bug))
134- f.close()
135+ content = "\n".join(map(lambda a: str(a), list_of_bugs))
136+ write_file(bug_list, content)
137
138=== modified file 'patch-overview.py' (properties changed: -x to +x)
139--- patch-overview.py 2010-06-02 11:16:18 +0000
140+++ patch-overview.py 2010-06-10 11:43:25 +0000
141@@ -100,11 +100,7 @@
142 </body></html>""" % date.communicate()[0].strip()
143
144
145- if os.path.exists("index.html"):
146- os.remove("index.html")
147- f = open("index.html", "w")
148- f.write(html.encode("utf-8"))
149- f.close()
150+ data.write_file("index.html", html.encode("utf-8"))
151
152 # to get the length of a searchTasks collection
153 # int(return_value._wadl_resource.representation['total_size'])
154
155=== added file 'review/default.css'
156--- review/default.css 1970-01-01 00:00:00 +0000
157+++ review/default.css 2010-06-10 11:43:25 +0000
158@@ -0,0 +1,85 @@
159+#badge{
160+ width: 300px;
161+ border: 2px solid #cbcbcb;
162+ background-color:#F7F7F7;
163+ -moz-border-radius: 10px;
164+ -khtml-border-radius: 10px;
165+ -webkit-border-radius: 10px;
166+ border-radius: 10px;
167+ height:85px
168+}
169+
170+#ubuntu-reviewers-logo{
171+ width:106px;
172+ height:32px;
173+ float:left;
174+ color: #cbcbcb;
175+ margin-right: 8px;
176+ margin-bottom:4px;
177+}
178+
179+#ubuntu-logo{
180+ width:106px;
181+ height:25px;
182+ background:url("images/ubuntu-logo.png") no-repeat top right;
183+ float:right;
184+ color: #cbcbcb;
185+ margin-right: 8px;
186+ margin-top:5px;
187+ margin-bottom:4px;
188+}
189+
190+#progress-bar {
191+ background:url("images/default/bg.png") repeat-x;
192+ border: 1px solid #cbcbcb;
193+ width: 240px;
194+ margin: 8px;
195+ margin-right: 0;
196+ float: left;
197+ -moz-border-radius: 5px;
198+ -khtml-border-radius: 5px;
199+ -webkit-border-radius: 5px;
200+ border-radius: 5px;
201+}
202+
203+#bar {
204+ height: 15px;
205+ text-indent:-9000px;
206+ background: #eee url(images/default/bar.png);
207+ -moz-border-radius: 5px;
208+ -khtml-border-radius: 5px;
209+ -webkit-border-radius: 5px;
210+ border-radius: 5px;
211+}
212+
213+#percentage{
214+ font-family:dejavu sans, sans, verdana, arial;
215+ float: left;
216+ color: #999;
217+ margin-left: 2px;
218+ margin-top:8px;
219+}
220+
221+#ubuntu-review-team{
222+ width: 300px;
223+ font-family:dejavu sans, sans, verdana, arial;
224+ float: left;
225+ font-size:10px;
226+ color: #999;
227+ margin-left: 8px;
228+}
229+
230+#ubuntu-review-team img{
231+ vertical-align:text-bottom;
232+ border:0;
233+}
234+
235+#ubuntu-review-team a:link, a:visited{
236+ text-decoration:none;
237+ color: #999;
238+}
239+
240+#ubuntu-review-team a:hover{
241+ text-decoration:underline;
242+
243+}
244
245=== modified file 'review/example.html'
246--- review/example.html 2010-06-09 09:04:53 +0000
247+++ review/example.html 2010-06-10 11:43:25 +0000
248@@ -1,4 +1,5 @@
249 <html>
250- <head><style type="text/css" media="all">@import "meter.css";</style></head>
251- <body><div class="progress-bar"><div id="sample" class="bar">.</div></body>
252+ <body>
253+ <script type="text/javascript" src="gadget.js"></script>
254+ </body>
255 </html>
256
257=== added directory 'review/images'
258=== added file 'review/images/3.png'
259Binary files review/images/3.png 1970-01-01 00:00:00 +0000 and review/images/3.png 2010-06-10 11:43:25 +0000 differ
260=== added directory 'review/images/default'
261=== added file 'review/images/default/bar copie2.png'
262Binary files review/images/default/bar copie2.png 1970-01-01 00:00:00 +0000 and review/images/default/bar copie2.png 2010-06-10 11:43:25 +0000 differ
263=== added file 'review/images/default/bar.png'
264Binary files review/images/default/bar.png 1970-01-01 00:00:00 +0000 and review/images/default/bar.png 2010-06-10 11:43:25 +0000 differ
265=== added file 'review/images/default/bar1.png'
266Binary files review/images/default/bar1.png 1970-01-01 00:00:00 +0000 and review/images/default/bar1.png 2010-06-10 11:43:25 +0000 differ
267=== added file 'review/images/default/bg.png'
268Binary files review/images/default/bg.png 1970-01-01 00:00:00 +0000 and review/images/default/bg.png 2010-06-10 11:43:25 +0000 differ
269=== added file 'review/images/review-team.png'
270Binary files review/images/review-team.png 1970-01-01 00:00:00 +0000 and review/images/review-team.png 2010-06-10 11:43:25 +0000 differ
271=== added file 'review/images/ubuntu-logo.png'
272Binary files review/images/ubuntu-logo.png 1970-01-01 00:00:00 +0000 and review/images/ubuntu-logo.png 2010-06-10 11:43:25 +0000 differ
273=== modified file 'stats.py' (properties changed: -x to +x)

Subscribers

People subscribed via source and target branches

to all changes: