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

Proposed by Daniel Holbach
Status: Merged
Merged at revision: 25
Proposed branch: lp:~dholbach/ubuntu-review-overview/css
Merge into: lp:ubuntu-review-overview
Diff against target: 130 lines (+58/-6)
4 files modified
.bzrignore (+5/-1)
countdown.py (+46/-5)
data.py (+3/-0)
review/example.html (+4/-0)
To merge this branch: bzr merge lp:~dholbach/ubuntu-review-overview/css
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Review via email: mp+27122@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

<nigelbabu> dholbach: ok, ack :D

review: Approve

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-02 11:16:18 +0000
3+++ .bzrignore 2010-06-09 09:07:26 +0000
4@@ -1,2 +1,6 @@
5 bug_list
6-meter.png
7+review/in-the-queue.txt
8+review/meter.css
9+review/meter.horiz.png
10+review/meter.png
11+review/total.txt
12
13=== modified file 'countdown.py'
14--- countdown.py 2010-06-08 15:09:22 +0000
15+++ countdown.py 2010-06-09 09:07:26 +0000
16@@ -6,22 +6,59 @@
17
18 import data
19
20+def write_css(reviewed, total):
21+ css_text = """
22+ .progress-bar {
23+ background:url("bg.png") repeat-x;
24+ border: 1px solid #cbcbcb;
25+ width: 293px;
26+ margin: 5px;
27+ padding: 1px;
28+ padding-left: 2px;
29+ padding-right: 1px;
30+ float: left;
31+ -moz-border-radius: 10px;
32+ -khtml-border-radius: 10px;
33+ -webkit-border-radius: 10px;
34+ border-radius: 10px;
35+ }
36+
37+ .bar {
38+ height: 14px;
39+ text-indent:-9000px;
40+ background: #eee url(bar.png);
41+ -moz-border-radius: 10px;
42+ -khtml-border-radius: 10px;
43+ -webkit-border-radius: 10px;
44+ border-radius: 10px;
45+ width: """
46+ css_text += str(int(293*float(reviewed)/float(total)))+"px;"
47+ css_text += """
48+ }
49+"""
50+ css_file = os.path.join(data.data_dir(), "meter.css")
51+ if os.path.exists(css_file):
52+ os.remove(css_file)
53+ f = open(css_file, "w")
54+ f.write(css_text)
55+ f.close()
56+
57 def draw(reviewed, total, horizontal=False):
58 if horizontal:
59 size = [200, 20]
60- x_range = [1, int(reviewed*size[0]/total)]
61+ x_range = [1, reviewed*size[0]/total]
62 y_range = [1, size[1]]
63 meterfile = "meter.horiz.png"
64 else:
65 meterfile = "meter.png"
66 size = [20, 200]
67 x_range = [1, size[0]]
68- y_range = [size[1]-int(reviewed*size[1]/total), size[1]]
69+ y_range = [size[1]-reviewed*size[1]/total, size[1]]
70 im = Image.new("RGB", (size[0], size[1]))
71 for x in range(x_range[0], x_range[1]):
72 for y in range(y_range[0], y_range[1]):
73 im.putpixel((x,y), (255,0,0))
74- im.save(meterfile)
75+ im.save(os.path.join(data.data_dir(), meterfile))
76
77 def write_out(file_name, number):
78 if os.path.exists(file_name):
79@@ -33,6 +70,7 @@
80
81 def main():
82 launchpad = data.lp_login()
83+ datadir = data.data_dir()
84 ubuntu = launchpad.distributions['ubuntu']
85 total_patches = data.get_count(ubuntu.searchTasks(has_patch=True, status=data.open_status))
86 already_reviewed_patches = data.get_count(ubuntu.searchTasks(has_patch=True,
87@@ -44,8 +82,11 @@
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("in-the-queue.txt", int(total_patches-already_reviewed_patches))
92- write_out("total.txt", total_patches)
93+ write_out(os.path.join(datadir, "in-the-queue.txt"),
94+ total_patches-already_reviewed_patches)
95+ write_out(os.path.join(datadir, "total.txt"),
96+ total_patches)
97+ write_css(already_reviewed_patches, total_patches)
98
99 if __name__ == "__main__":
100 try:
101
102=== modified file 'data.py'
103--- data.py 2010-06-02 13:06:00 +0000
104+++ data.py 2010-06-09 09:07:26 +0000
105@@ -23,6 +23,9 @@
106 import sys
107 import os
108
109+def data_dir():
110+ return os.path.join(os.path.dirname(__file__), "review")
111+
112 def lp_login(anonymous=True):
113 cachedir = os.path.expanduser("~/.launchpadlib/cache/")
114 creddir = os.path.expanduser('~/.launchpadlib')
115
116=== added directory 'review'
117=== added file 'review/bar.png'
118Binary files review/bar.png 1970-01-01 00:00:00 +0000 and review/bar.png 2010-06-09 09:07:26 +0000 differ
119=== added file 'review/bg.png'
120Binary files review/bg.png 1970-01-01 00:00:00 +0000 and review/bg.png 2010-06-09 09:07:26 +0000 differ
121=== added file 'review/example.html'
122--- review/example.html 1970-01-01 00:00:00 +0000
123+++ review/example.html 2010-06-09 09:07:26 +0000
124@@ -0,0 +1,4 @@
125+<html>
126+ <head><style type="text/css" media="all">@import "meter.css";</style></head>
127+ <body><div class="progress-bar"><div id="sample" class="bar">.</div></body>
128+</html>
129
130=== renamed file 'launchpad.css' => 'review/launchpad.css'

Subscribers

People subscribed via source and target branches

to all changes: