Merge lp:~samitheberber/openfilepad/gui-dev into lp:openfilepad
- gui-dev
- Merge into main
Proposed by
Sami Saada
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||
Proposed branch: | lp:~samitheberber/openfilepad/gui-dev | ||||||||
Merge into: | lp:openfilepad | ||||||||
Diff against target: |
1147 lines 19 files modified
README (+5/-4) src/gfx/home.svg (+33/-0) src/gfx/logo.svg (+171/-0) src/gfx/mugshot_new.svg (+95/-0) src/gfx/mugshot_unknown.svg (+91/-0) src/gui/__init__.py (+2/-0) src/gui/friendtab.py (+15/-0) src/gui/hometab.py (+14/-0) src/gui/mainwindow.py (+18/-0) src/gui/newfriendtab.py (+111/-0) src/gui/userfiles.py (+34/-0) src/gui/userinfo.py (+90/-0) src/gui/userpicture.py (+59/-0) src/gui/usertab.py (+19/-0) src/gui/usertabwidget.py (+66/-0) src/guicontrol.py (+76/-0) src/qfriendslol.pyw (+31/-0) src/remote.py (+6/-7) src/store.py (+15/-14) |
||||||||
To merge this branch: | bzr merge lp:~samitheberber/openfilepad/gui-dev | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martti Rannanjärvi | Approve | ||
Review via email: mp+14053@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Sami Saada (samitheberber) wrote : | # |
Revision history for this message
Martti Rannanjärvi (mrannanj) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README' | |||
2 | --- README 2009-10-26 02:34:05 +0000 | |||
3 | +++ README 2009-10-27 21:15:19 +0000 | |||
4 | @@ -7,12 +7,13 @@ | |||
5 | 7 | 7 | ||
6 | 8 | QFriendsLOL is a simple QT file drop box application that enables friends to exchange files by using OpenLookup v2. | 8 | QFriendsLOL is a simple QT file drop box application that enables friends to exchange files by using OpenLookup v2. |
7 | 9 | 9 | ||
11 | 10 | To get QFriendsLOL running you need to get the latest OpenLookup. | 10 | QFriendsLOL requires simplejson and openlookup to run. Simplejson is probably |
12 | 11 | You can download it to your home directory by commanding: | 11 | packaged by your distribution. The name of the package is python-simplejson in |
13 | 12 | cd ~ | 12 | Ubuntu and dev-python/simplejson in Gentoo. Openlookup you can download to your |
14 | 13 | home directory with these commands: | ||
15 | 14 | cd | ||
16 | 13 | svn checkout http://openlookup.googlecode.com/svn/v2 openlookup2 | 15 | svn checkout http://openlookup.googlecode.com/svn/v2 openlookup2 |
17 | 14 | 16 | ||
18 | 15 | then set python path as follows before starting QFriendsLOL: | 17 | then set python path as follows before starting QFriendsLOL: |
19 | 16 | export PYTHONPATH=~/openlookup2 | 18 | export PYTHONPATH=~/openlookup2 |
20 | 17 | 19 | ||
21 | 18 | |||
22 | 19 | 20 | ||
23 | === added directory 'src/gfx' | |||
24 | === added file 'src/gfx/home.svg' | |||
25 | --- src/gfx/home.svg 1970-01-01 00:00:00 +0000 | |||
26 | +++ src/gfx/home.svg 2009-10-27 21:15:19 +0000 | |||
27 | @@ -0,0 +1,33 @@ | |||
28 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
29 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
30 | 3 | <svg | ||
31 | 4 | xmlns:svg="http://www.w3.org/2000/svg" | ||
32 | 5 | xmlns="http://www.w3.org/2000/svg" | ||
33 | 6 | version="1.0" | ||
34 | 7 | width="16" | ||
35 | 8 | height="16" | ||
36 | 9 | id="svg1901"> | ||
37 | 10 | <defs | ||
38 | 11 | id="defs1903" /> | ||
39 | 12 | <g | ||
40 | 13 | id="layer1" | ||
41 | 14 | style="opacity:1"> | ||
42 | 15 | <g | ||
43 | 16 | transform="matrix(3.3802679e-2,0,0,3.9578024e-2,-3.7983281,-8.644124)" | ||
44 | 17 | id="g2405"> | ||
45 | 18 | <rect | ||
46 | 19 | width="302.85715" | ||
47 | 20 | height="211.42857" | ||
48 | 21 | rx="0" | ||
49 | 22 | ry="0" | ||
50 | 23 | x="188.57143" | ||
51 | 24 | y="375.21933" | ||
52 | 25 | id="rect2380" | ||
53 | 26 | style="fill:#000000;fill-opacity:1" /> | ||
54 | 27 | <path | ||
55 | 28 | d="M 340,252.36219 L 542.8571,378.07646 L 151.42857,378.07646 L 340,252.36219 z" | ||
56 | 29 | id="rect2382" | ||
57 | 30 | style="fill:#000000;fill-opacity:1" /> | ||
58 | 31 | </g> | ||
59 | 32 | </g> | ||
60 | 33 | </svg> | ||
61 | 0 | 34 | ||
62 | === added file 'src/gfx/logo.svg' | |||
63 | --- src/gfx/logo.svg 1970-01-01 00:00:00 +0000 | |||
64 | +++ src/gfx/logo.svg 2009-10-27 21:15:19 +0000 | |||
65 | @@ -0,0 +1,171 @@ | |||
66 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
67 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
68 | 3 | <svg | ||
69 | 4 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
70 | 5 | xmlns:cc="http://creativecommons.org/ns#" | ||
71 | 6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
72 | 7 | xmlns:svg="http://www.w3.org/2000/svg" | ||
73 | 8 | xmlns="http://www.w3.org/2000/svg" | ||
74 | 9 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
75 | 10 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
76 | 11 | version="1.0" | ||
77 | 12 | width="53.300831" | ||
78 | 13 | height="50.020782" | ||
79 | 14 | id="svg1901" | ||
80 | 15 | inkscape:version="0.46" | ||
81 | 16 | sodipodi:docname="qfriendslol_logo.svg" | ||
82 | 17 | sodipodi:version="0.32" | ||
83 | 18 | inkscape:output_extension="org.inkscape.output.svg.inkscape"> | ||
84 | 19 | <metadata | ||
85 | 20 | id="metadata28"> | ||
86 | 21 | <rdf:RDF> | ||
87 | 22 | <cc:Work | ||
88 | 23 | rdf:about=""> | ||
89 | 24 | <dc:format>image/svg+xml</dc:format> | ||
90 | 25 | <dc:type | ||
91 | 26 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
92 | 27 | </cc:Work> | ||
93 | 28 | </rdf:RDF> | ||
94 | 29 | </metadata> | ||
95 | 30 | <sodipodi:namedview | ||
96 | 31 | pagecolor="#ffffff" | ||
97 | 32 | bordercolor="#666666" | ||
98 | 33 | borderopacity="1" | ||
99 | 34 | objecttolerance="10" | ||
100 | 35 | gridtolerance="10" | ||
101 | 36 | guidetolerance="10" | ||
102 | 37 | inkscape:pageopacity="0" | ||
103 | 38 | inkscape:pageshadow="2" | ||
104 | 39 | inkscape:window-width="789" | ||
105 | 40 | inkscape:window-height="786" | ||
106 | 41 | id="namedview26" | ||
107 | 42 | showgrid="false" | ||
108 | 43 | inkscape:zoom="5.3299604" | ||
109 | 44 | inkscape:cx="55.118585" | ||
110 | 45 | inkscape:cy="7.1743389" | ||
111 | 46 | inkscape:window-x="0" | ||
112 | 47 | inkscape:window-y="12" | ||
113 | 48 | inkscape:window-maximized="0" | ||
114 | 49 | inkscape:current-layer="g2899" /> | ||
115 | 50 | <defs | ||
116 | 51 | id="defs1903"> | ||
117 | 52 | <inkscape:perspective | ||
118 | 53 | sodipodi:type="inkscape:persp3d" | ||
119 | 54 | inkscape:vp_x="0 : 372.04724 : 1" | ||
120 | 55 | inkscape:vp_y="0 : 1000 : 0" | ||
121 | 56 | inkscape:vp_z="1052.3622 : 372.04724 : 1" | ||
122 | 57 | inkscape:persp3d-origin="526.18109 : 248.03149 : 1" | ||
123 | 58 | id="perspective30" /> | ||
124 | 59 | </defs> | ||
125 | 60 | <g | ||
126 | 61 | transform="matrix(0.7786856,0,0,0.7880085,-69.510459,-145.8237)" | ||
127 | 62 | id="g2899"> | ||
128 | 63 | <g | ||
129 | 64 | id="g2974" | ||
130 | 65 | transform="matrix(7.1574807e-2,0,0,7.1574807e-2,82.877173,171.80829)"> | ||
131 | 66 | <g | ||
132 | 67 | transform="matrix(1.2842154,0,0,1.2690218,896.81145,162.03984)" | ||
133 | 68 | id="g2930"> | ||
134 | 69 | <g | ||
135 | 70 | id="g2561" | ||
136 | 71 | transform="matrix(0.7121539,0,0,0.7121539,-652.62997,34.07993)"> | ||
137 | 72 | <g | ||
138 | 73 | style="fill:#729fcf" | ||
139 | 74 | id="g2390"> | ||
140 | 75 | <path | ||
141 | 76 | style="fill:#729fcf" | ||
142 | 77 | id="path2382" | ||
143 | 78 | d="M 508.57143,223.79076 C 508.57143,342.1375 412.63244,438.07648 294.28571,438.07648 C 175.93897,438.07648 79.999985,342.1375 79.999985,223.79076 C 79.999985,105.44402 175.93897,9.5050375 294.28571,9.5050375 C 412.63244,9.5050375 508.57143,105.44402 508.57143,223.79076 L 508.57143,223.79076 z" /> | ||
144 | 79 | <rect | ||
145 | 80 | style="fill:#729fcf" | ||
146 | 81 | id="rect2384" | ||
147 | 82 | y="419.50504" | ||
148 | 83 | x="33.428574" | ||
149 | 84 | ry="120" | ||
150 | 85 | rx="174.28572" | ||
151 | 86 | height="474.28574" | ||
152 | 87 | width="522.85712" /> | ||
153 | 88 | </g> | ||
154 | 89 | </g> | ||
155 | 90 | <g | ||
156 | 91 | style="fill:#ef2929" | ||
157 | 92 | id="g2566" | ||
158 | 93 | transform="matrix(0.7121539,0,0,0.7121539,-280.2977,34.066399)"> | ||
159 | 94 | <g | ||
160 | 95 | style="fill:#ef2929" | ||
161 | 96 | id="g2568"> | ||
162 | 97 | <path | ||
163 | 98 | style="fill:#ef2929" | ||
164 | 99 | id="path2570" | ||
165 | 100 | d="M 508.57143,223.79076 C 508.57143,342.1375 412.63244,438.07648 294.28571,438.07648 C 175.93897,438.07648 79.999985,342.1375 79.999985,223.79076 C 79.999985,105.44402 175.93897,9.5050375 294.28571,9.5050375 C 412.63244,9.5050375 508.57143,105.44402 508.57143,223.79076 L 508.57143,223.79076 z" /> | ||
166 | 101 | <rect | ||
167 | 102 | style="fill:#ef2929" | ||
168 | 103 | id="rect2572" | ||
169 | 104 | y="419.50504" | ||
170 | 105 | x="33.428574" | ||
171 | 106 | ry="120" | ||
172 | 107 | rx="174.28572" | ||
173 | 108 | height="474.28574" | ||
174 | 109 | width="522.85712" /> | ||
175 | 110 | </g> | ||
176 | 111 | </g> | ||
177 | 112 | </g> | ||
178 | 113 | <g | ||
179 | 114 | id="g2952"> | ||
180 | 115 | <g | ||
181 | 116 | style="fill:#8ae234" | ||
182 | 117 | id="g2574" | ||
183 | 118 | transform="matrix(1.0149288,0,0,1.0029211,272.88051,175.52064)"> | ||
184 | 119 | <g | ||
185 | 120 | style="fill:#8ae234" | ||
186 | 121 | id="g2576"> | ||
187 | 122 | <path | ||
188 | 123 | style="fill:#8ae234" | ||
189 | 124 | id="path2578" | ||
190 | 125 | d="M 508.57143,223.79076 C 508.57143,342.1375 412.63244,438.07648 294.28571,438.07648 C 175.93897,438.07648 79.999985,342.1375 79.999985,223.79076 C 79.999985,105.44402 175.93897,9.5050375 294.28571,9.5050375 C 412.63244,9.5050375 508.57143,105.44402 508.57143,223.79076 L 508.57143,223.79076 z" /> | ||
191 | 126 | <rect | ||
192 | 127 | style="fill:#8ae234" | ||
193 | 128 | id="rect2580" | ||
194 | 129 | y="419.50504" | ||
195 | 130 | x="33.428574" | ||
196 | 131 | ry="120" | ||
197 | 132 | rx="174.28572" | ||
198 | 133 | height="474.28574" | ||
199 | 134 | width="522.85712" /> | ||
200 | 135 | </g> | ||
201 | 136 | </g> | ||
202 | 137 | <text | ||
203 | 138 | x="444.51709" | ||
204 | 139 | y="516.66309" | ||
205 | 140 | id="text3360" | ||
206 | 141 | xml:space="preserve" | ||
207 | 142 | style="font-size:323.3861084px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"><tspan | ||
208 | 143 | x="444.51709" | ||
209 | 144 | y="516.66309" | ||
210 | 145 | id="tspan3362">Q</tspan></text> | ||
211 | 146 | <g | ||
212 | 147 | id="g2877" | ||
213 | 148 | transform="matrix(1.0216867,0,0,1.0216867,166.7808,-619.91001)"> | ||
214 | 149 | <text | ||
215 | 150 | style="font-size:237.41375732px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" | ||
216 | 151 | xml:space="preserve" | ||
217 | 152 | id="text3364" | ||
218 | 153 | y="1561.1241" | ||
219 | 154 | x="165.02359"><tspan | ||
220 | 155 | id="tspan3366" | ||
221 | 156 | y="1561.1241" | ||
222 | 157 | x="165.02359">LOL</tspan></text> | ||
223 | 158 | <text | ||
224 | 159 | style="font-size:99.64174652px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" | ||
225 | 160 | xml:space="preserve" | ||
226 | 161 | id="text3368" | ||
227 | 162 | y="1359.7706" | ||
228 | 163 | x="178.23366"><tspan | ||
229 | 164 | id="tspan3370" | ||
230 | 165 | y="1359.7706" | ||
231 | 166 | x="178.23366">FRIENDS</tspan></text> | ||
232 | 167 | </g> | ||
233 | 168 | </g> | ||
234 | 169 | </g> | ||
235 | 170 | </g> | ||
236 | 171 | </svg> | ||
237 | 0 | 172 | ||
238 | === added file 'src/gfx/mugshot_new.svg' | |||
239 | --- src/gfx/mugshot_new.svg 1970-01-01 00:00:00 +0000 | |||
240 | +++ src/gfx/mugshot_new.svg 2009-10-27 21:15:19 +0000 | |||
241 | @@ -0,0 +1,95 @@ | |||
242 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
243 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
244 | 3 | <svg | ||
245 | 4 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
246 | 5 | xmlns:cc="http://creativecommons.org/ns#" | ||
247 | 6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
248 | 7 | xmlns:svg="http://www.w3.org/2000/svg" | ||
249 | 8 | xmlns="http://www.w3.org/2000/svg" | ||
250 | 9 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
251 | 10 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
252 | 11 | version="1.0" | ||
253 | 12 | width="57.575825" | ||
254 | 13 | height="97.375511" | ||
255 | 14 | id="svg1901" | ||
256 | 15 | sodipodi:version="0.32" | ||
257 | 16 | inkscape:version="0.46" | ||
258 | 17 | sodipodi:docname="mugshot_new.svg" | ||
259 | 18 | inkscape:output_extension="org.inkscape.output.svg.inkscape"> | ||
260 | 19 | <metadata | ||
261 | 20 | id="metadata2424"> | ||
262 | 21 | <rdf:RDF> | ||
263 | 22 | <cc:Work | ||
264 | 23 | rdf:about=""> | ||
265 | 24 | <dc:format>image/svg+xml</dc:format> | ||
266 | 25 | <dc:type | ||
267 | 26 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
268 | 27 | </cc:Work> | ||
269 | 28 | </rdf:RDF> | ||
270 | 29 | </metadata> | ||
271 | 30 | <sodipodi:namedview | ||
272 | 31 | inkscape:window-height="1022" | ||
273 | 32 | inkscape:window-width="789" | ||
274 | 33 | inkscape:pageshadow="2" | ||
275 | 34 | inkscape:pageopacity="0.0" | ||
276 | 35 | guidetolerance="10.0" | ||
277 | 36 | gridtolerance="10.0" | ||
278 | 37 | objecttolerance="10.0" | ||
279 | 38 | borderopacity="1.0" | ||
280 | 39 | bordercolor="#666666" | ||
281 | 40 | pagecolor="#ffffff" | ||
282 | 41 | id="base" | ||
283 | 42 | showgrid="false" | ||
284 | 43 | inkscape:zoom="1.8928844" | ||
285 | 44 | inkscape:cx="115.61036" | ||
286 | 45 | inkscape:cy="39.417556" | ||
287 | 46 | inkscape:window-x="0" | ||
288 | 47 | inkscape:window-y="0" | ||
289 | 48 | inkscape:current-layer="svg1901" /> | ||
290 | 49 | <defs | ||
291 | 50 | id="defs1903"> | ||
292 | 51 | <inkscape:perspective | ||
293 | 52 | sodipodi:type="inkscape:persp3d" | ||
294 | 53 | inkscape:vp_x="0 : 526.18109 : 1" | ||
295 | 54 | inkscape:vp_y="0 : 1000 : 0" | ||
296 | 55 | inkscape:vp_z="744.09448 : 526.18109 : 1" | ||
297 | 56 | inkscape:persp3d-origin="372.04724 : 350.78739 : 1" | ||
298 | 57 | id="perspective2426" /> | ||
299 | 58 | </defs> | ||
300 | 59 | <g | ||
301 | 60 | id="layer1" | ||
302 | 61 | style="opacity:1" | ||
303 | 62 | transform="matrix(0.1101177,0,0,0.1101177,-13.056815,-7.4177671)"> | ||
304 | 63 | <g | ||
305 | 64 | transform="translate(85.14287,57.857131)" | ||
306 | 65 | id="g2433" | ||
307 | 66 | style="opacity:1"> | ||
308 | 67 | <g | ||
309 | 68 | id="g2390" | ||
310 | 69 | style="fill:#729fcf"> | ||
311 | 70 | <path | ||
312 | 71 | d="M 508.57143,223.79076 C 508.57143,342.1375 412.63244,438.07648 294.28571,438.07648 C 175.93897,438.07648 79.999985,342.1375 79.999985,223.79076 C 79.999985,105.44402 175.93897,9.5050375 294.28571,9.5050375 C 412.63244,9.5050375 508.57143,105.44402 508.57143,223.79076 L 508.57143,223.79076 z" | ||
313 | 72 | id="path2382" | ||
314 | 73 | style="fill:#729fcf" /> | ||
315 | 74 | <rect | ||
316 | 75 | width="522.85712" | ||
317 | 76 | height="474.28574" | ||
318 | 77 | rx="174.28572" | ||
319 | 78 | ry="120" | ||
320 | 79 | x="33.428574" | ||
321 | 80 | y="419.50504" | ||
322 | 81 | id="rect2384" | ||
323 | 82 | style="fill:#729fcf" /> | ||
324 | 83 | </g> | ||
325 | 84 | </g> | ||
326 | 85 | <text | ||
327 | 86 | x="71.970245" | ||
328 | 87 | y="942.89124" | ||
329 | 88 | id="text2438" | ||
330 | 89 | xml:space="preserve" | ||
331 | 90 | style="font-size:731.74212646px;font-style:normal;font-weight:normal;fill:#204a87;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan | ||
332 | 91 | x="71.970245" | ||
333 | 92 | y="942.89124" | ||
334 | 93 | id="tspan2440">+</tspan></text> | ||
335 | 94 | </g> | ||
336 | 95 | </svg> | ||
337 | 0 | 96 | ||
338 | === added file 'src/gfx/mugshot_unknown.svg' | |||
339 | --- src/gfx/mugshot_unknown.svg 1970-01-01 00:00:00 +0000 | |||
340 | +++ src/gfx/mugshot_unknown.svg 2009-10-27 21:15:19 +0000 | |||
341 | @@ -0,0 +1,91 @@ | |||
342 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
343 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
344 | 3 | <svg | ||
345 | 4 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
346 | 5 | xmlns:cc="http://creativecommons.org/ns#" | ||
347 | 6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
348 | 7 | xmlns:svg="http://www.w3.org/2000/svg" | ||
349 | 8 | xmlns="http://www.w3.org/2000/svg" | ||
350 | 9 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
351 | 10 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
352 | 11 | version="1.0" | ||
353 | 12 | width="49.8494" | ||
354 | 13 | height="84.308144" | ||
355 | 14 | id="svg1901" | ||
356 | 15 | sodipodi:version="0.32" | ||
357 | 16 | inkscape:version="0.46" | ||
358 | 17 | sodipodi:docname="mugshot_unknown.svg" | ||
359 | 18 | inkscape:output_extension="org.inkscape.output.svg.inkscape"> | ||
360 | 19 | <metadata | ||
361 | 20 | id="metadata2540"> | ||
362 | 21 | <rdf:RDF> | ||
363 | 22 | <cc:Work | ||
364 | 23 | rdf:about=""> | ||
365 | 24 | <dc:format>image/svg+xml</dc:format> | ||
366 | 25 | <dc:type | ||
367 | 26 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
368 | 27 | </cc:Work> | ||
369 | 28 | </rdf:RDF> | ||
370 | 29 | </metadata> | ||
371 | 30 | <sodipodi:namedview | ||
372 | 31 | inkscape:window-height="510" | ||
373 | 32 | inkscape:window-width="487" | ||
374 | 33 | inkscape:pageshadow="2" | ||
375 | 34 | inkscape:pageopacity="0.0" | ||
376 | 35 | guidetolerance="10.0" | ||
377 | 36 | gridtolerance="10.0" | ||
378 | 37 | objecttolerance="10.0" | ||
379 | 38 | borderopacity="1.0" | ||
380 | 39 | bordercolor="#666666" | ||
381 | 40 | pagecolor="#ffffff" | ||
382 | 41 | id="base" | ||
383 | 42 | showgrid="false" | ||
384 | 43 | inkscape:zoom="2.6769428" | ||
385 | 44 | inkscape:cx="36.591392" | ||
386 | 45 | inkscape:cy="21.560543" | ||
387 | 46 | inkscape:window-x="791" | ||
388 | 47 | inkscape:window-y="0" | ||
389 | 48 | inkscape:current-layer="svg1901" /> | ||
390 | 49 | <defs | ||
391 | 50 | id="defs1903"> | ||
392 | 51 | <inkscape:perspective | ||
393 | 52 | sodipodi:type="inkscape:persp3d" | ||
394 | 53 | inkscape:vp_x="0 : 526.18109 : 1" | ||
395 | 54 | inkscape:vp_y="0 : 1000 : 0" | ||
396 | 55 | inkscape:vp_z="744.09448 : 526.18109 : 1" | ||
397 | 56 | inkscape:persp3d-origin="372.04724 : 350.78739 : 1" | ||
398 | 57 | id="perspective2542" /> | ||
399 | 58 | </defs> | ||
400 | 59 | <g | ||
401 | 60 | id="layer1" | ||
402 | 61 | style="opacity:1" | ||
403 | 62 | transform="matrix(9.5340385e-2,0,0,9.5340385e-2,-3.1870931,-0.9062139)"> | ||
404 | 63 | <g | ||
405 | 64 | id="g2390" | ||
406 | 65 | style="fill:#729fcf"> | ||
407 | 66 | <path | ||
408 | 67 | d="M 508.57143,223.79076 C 508.57143,342.1375 412.63244,438.07648 294.28571,438.07648 C 175.93897,438.07648 79.999985,342.1375 79.999985,223.79076 C 79.999985,105.44402 175.93897,9.5050375 294.28571,9.5050375 C 412.63244,9.5050375 508.57143,105.44402 508.57143,223.79076 L 508.57143,223.79076 z" | ||
409 | 68 | id="path2382" | ||
410 | 69 | style="fill:#729fcf" /> | ||
411 | 70 | <rect | ||
412 | 71 | width="522.85712" | ||
413 | 72 | height="474.28574" | ||
414 | 73 | rx="174.28572" | ||
415 | 74 | ry="120" | ||
416 | 75 | x="33.428574" | ||
417 | 76 | y="419.50504" | ||
418 | 77 | id="rect2384" | ||
419 | 78 | style="fill:#729fcf" /> | ||
420 | 79 | </g> | ||
421 | 80 | <text | ||
422 | 81 | x="159.92941" | ||
423 | 82 | y="632.41937" | ||
424 | 83 | transform="scale(0.8084629,1.2369151)" | ||
425 | 84 | id="text2386" | ||
426 | 85 | xml:space="preserve" | ||
427 | 86 | style="font-size:778.21777344px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#204a87;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Rudelsberg;-inkscape-font-specification:Rudelsberg Medium"><tspan | ||
428 | 87 | x="159.92941" | ||
429 | 88 | y="632.41937" | ||
430 | 89 | id="tspan2388">?</tspan></text> | ||
431 | 90 | </g> | ||
432 | 91 | </svg> | ||
433 | 0 | 92 | ||
434 | === added directory 'src/gui' | |||
435 | === added file 'src/gui/__init__.py' | |||
436 | --- src/gui/__init__.py 1970-01-01 00:00:00 +0000 | |||
437 | +++ src/gui/__init__.py 2009-10-27 21:15:19 +0000 | |||
438 | @@ -0,0 +1,2 @@ | |||
439 | 1 | #!/usr/bin/python2.6 | ||
440 | 2 | # -*- coding: utf-8 -*- | ||
441 | 0 | 3 | ||
442 | === added file 'src/gui/friendtab.py' | |||
443 | --- src/gui/friendtab.py 1970-01-01 00:00:00 +0000 | |||
444 | +++ src/gui/friendtab.py 2009-10-27 21:15:19 +0000 | |||
445 | @@ -0,0 +1,15 @@ | |||
446 | 1 | #!/usr/bin/python2.6 | ||
447 | 2 | # -*- coding: utf-8 -*- | ||
448 | 3 | |||
449 | 4 | from userfiles import UserFiles | ||
450 | 5 | from userinfo import UserInfo | ||
451 | 6 | from usertab import UserTab | ||
452 | 7 | |||
453 | 8 | |||
454 | 9 | class FriendTab(UserTab): | ||
455 | 10 | |||
456 | 11 | def __init__(self, control, friendId, *args): | ||
457 | 12 | apply(UserTab.__init__, (self, control, ) + args) | ||
458 | 13 | self._friendId = friendId | ||
459 | 14 | self.addWidget(UserInfo(control, self._friendId)) | ||
460 | 15 | self.addWidget(UserFiles(control, self._friendId)) | ||
461 | 0 | 16 | ||
462 | === added file 'src/gui/hometab.py' | |||
463 | --- src/gui/hometab.py 1970-01-01 00:00:00 +0000 | |||
464 | +++ src/gui/hometab.py 2009-10-27 21:15:19 +0000 | |||
465 | @@ -0,0 +1,14 @@ | |||
466 | 1 | #!/usr/bin/python2.6 | ||
467 | 2 | # -*- coding: utf-8 -*- | ||
468 | 3 | |||
469 | 4 | from userfiles import UserFiles | ||
470 | 5 | from userinfo import UserInfo | ||
471 | 6 | from usertab import UserTab | ||
472 | 7 | |||
473 | 8 | |||
474 | 9 | class HomeTab(UserTab): | ||
475 | 10 | |||
476 | 11 | def __init__(self, control, *args): | ||
477 | 12 | apply(UserTab.__init__, (self, control, ) + args) | ||
478 | 13 | self.addWidget(UserInfo(control)) | ||
479 | 14 | self.addWidget(UserFiles(control)) | ||
480 | 0 | 15 | ||
481 | === added file 'src/gui/mainwindow.py' | |||
482 | --- src/gui/mainwindow.py 1970-01-01 00:00:00 +0000 | |||
483 | +++ src/gui/mainwindow.py 2009-10-27 21:15:19 +0000 | |||
484 | @@ -0,0 +1,18 @@ | |||
485 | 1 | #!/usr/bin/python2.6 | ||
486 | 2 | # -*- coding: utf-8 -*- | ||
487 | 3 | |||
488 | 4 | from usertabwidget import UserTabWidget | ||
489 | 5 | |||
490 | 6 | from PyQt4.QtGui import QIcon | ||
491 | 7 | from PyQt4.QtGui import QMainWindow | ||
492 | 8 | |||
493 | 9 | |||
494 | 10 | class MainWindow(QMainWindow): | ||
495 | 11 | |||
496 | 12 | def __init__(self, control, *args): | ||
497 | 13 | apply(QMainWindow.__init__, (self, ) + args) | ||
498 | 14 | self.setWindowTitle(u'QFriendsLOL') | ||
499 | 15 | self._control = control | ||
500 | 16 | self.setWindowIcon(QIcon(self._control.getGFXPath() + '/logo.svg')) | ||
501 | 17 | self._userTabs = UserTabWidget(control) | ||
502 | 18 | self.setCentralWidget(self._userTabs) | ||
503 | 0 | 19 | ||
504 | === added file 'src/gui/newfriendtab.py' | |||
505 | --- src/gui/newfriendtab.py 1970-01-01 00:00:00 +0000 | |||
506 | +++ src/gui/newfriendtab.py 2009-10-27 21:15:19 +0000 | |||
507 | @@ -0,0 +1,111 @@ | |||
508 | 1 | #!/usr/bin/python2.6 | ||
509 | 2 | # -*- coding: utf-8 -*- | ||
510 | 3 | |||
511 | 4 | from usertab import UserTab | ||
512 | 5 | |||
513 | 6 | from PyQt4.QtGui import QLabel | ||
514 | 7 | from PyQt4.QtGui import QWidget | ||
515 | 8 | from PyQt4.QtGui import QHBoxLayout | ||
516 | 9 | from PyQt4.QtGui import QVBoxLayout | ||
517 | 10 | from PyQt4.QtGui import QPixmap | ||
518 | 11 | from PyQt4.QtGui import QLineEdit | ||
519 | 12 | from PyQt4.QtGui import QPushButton | ||
520 | 13 | from PyQt4.QtGui import QScrollArea | ||
521 | 14 | from PyQt4.QtCore import Qt | ||
522 | 15 | from PyQt4.QtCore import QObject | ||
523 | 16 | from PyQt4.QtCore import SIGNAL | ||
524 | 17 | from PyQt4.QtCore import SLOT | ||
525 | 18 | |||
526 | 19 | |||
527 | 20 | class NewFriendTab(UserTab): | ||
528 | 21 | |||
529 | 22 | def __init__(self, control, *args): | ||
530 | 23 | apply(UserTab.__init__, (self, control, ) + args) | ||
531 | 24 | self._searchBox() | ||
532 | 25 | self._searchResults() | ||
533 | 26 | |||
534 | 27 | def _searchBox(self): | ||
535 | 28 | searchBoxWidget = QWidget() | ||
536 | 29 | self.addWidget(searchBoxWidget) | ||
537 | 30 | searchBoxLayout = QHBoxLayout() | ||
538 | 31 | searchBoxWidget.setLayout(searchBoxLayout) | ||
539 | 32 | |||
540 | 33 | searchBoxLayout.addWidget(self._searchBoxPicture()) | ||
541 | 34 | searchBoxLayout.addWidget(self._searchBoxDataField()) | ||
542 | 35 | searchBoxLayout.addWidget(self._searchBoxSubmit()) | ||
543 | 36 | |||
544 | 37 | QObject.connect(self._addButton, SIGNAL('pressed()'), self._searchUser) | ||
545 | 38 | QObject.connect(self._searchField, SIGNAL('returnPressed()'), self._searchUser) | ||
546 | 39 | |||
547 | 40 | def _searchBoxPicture(self): | ||
548 | 41 | picture = QLabel() | ||
549 | 42 | picture.setPixmap(QPixmap(self._control.getGFXPath() + '/mugshot_new.svg')) | ||
550 | 43 | return picture | ||
551 | 44 | |||
552 | 45 | def _searchBoxDataField(self): | ||
553 | 46 | self._searchField = QLineEdit() | ||
554 | 47 | self._errorMessage = QLabel() | ||
555 | 48 | self._errorMessage.hide() | ||
556 | 49 | |||
557 | 50 | searchData = QWidget() | ||
558 | 51 | searchLayout = QVBoxLayout() | ||
559 | 52 | searchLayout.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop); | ||
560 | 53 | searchData.setLayout(searchLayout) | ||
561 | 54 | |||
562 | 55 | searchLayout.addWidget(QLabel(u'Enter email or user id:')) | ||
563 | 56 | searchLayout.addWidget(self._searchField) | ||
564 | 57 | searchLayout.addWidget(self._errorMessage) | ||
565 | 58 | return searchData | ||
566 | 59 | |||
567 | 60 | def _searchBoxSubmit(self): | ||
568 | 61 | self._addButton = QPushButton(u'Add') | ||
569 | 62 | self._addButton.setAutoDefault(True) | ||
570 | 63 | self._addButton.setDefault(True) | ||
571 | 64 | return self._addButton | ||
572 | 65 | |||
573 | 66 | def _searchResults(self): | ||
574 | 67 | self._results = QScrollArea() | ||
575 | 68 | self.addWidget(self._results) | ||
576 | 69 | |||
577 | 70 | def _searchUser(self): | ||
578 | 71 | searchData = str(self._searchField.text()) | ||
579 | 72 | hits = [uid for uid in self._control.getRemote().findUser(searchData) \ | ||
580 | 73 | if not uid == self._control.getRemote().localIdentityHex()] | ||
581 | 74 | |||
582 | 75 | old = self._results.widget() | ||
583 | 76 | if old: | ||
584 | 77 | old.destroy() | ||
585 | 78 | self._results.setWidget(QWidget()) | ||
586 | 79 | |||
587 | 80 | if len(hits) == 0: | ||
588 | 81 | self._errorMessage.setText(u'No such user.') | ||
589 | 82 | self._errorMessage.show() | ||
590 | 83 | elif len(hits) > 1: | ||
591 | 84 | self._errorMessage.setText(u'Many hits from such user.') | ||
592 | 85 | self._errorMessage.show() | ||
593 | 86 | self._addToSearchResults(hits) | ||
594 | 87 | else: | ||
595 | 88 | hit = hits[0] | ||
596 | 89 | if hit in self._control.getStore().getFriends(): | ||
597 | 90 | self._errorMessage.setText(u'Found user is already in your friends.') | ||
598 | 91 | self._errorMessage.show() | ||
599 | 92 | else: | ||
600 | 93 | self._searchField.setText(u'') | ||
601 | 94 | self._errorMessage.setText(u'') | ||
602 | 95 | self._errorMessage.hide() | ||
603 | 96 | if not self._control.getRemote().isValidId(searchData): | ||
604 | 97 | self._control.addUser(hit, searchData) | ||
605 | 98 | else: | ||
606 | 99 | self._control.addUser(hit) | ||
607 | 100 | |||
608 | 101 | def _addToSearchResults(self, hits): | ||
609 | 102 | results = QWidget() | ||
610 | 103 | resultsLayout = QVBoxLayout() | ||
611 | 104 | results.setLayout(resultsLayout) | ||
612 | 105 | for hit in hits: | ||
613 | 106 | resultsLayout.addWidget(self._morphHit(hit)) | ||
614 | 107 | self._results.setWidget(results) | ||
615 | 108 | |||
616 | 109 | def _morphHit(self, hit): | ||
617 | 110 | #TODO: Add better view. | ||
618 | 111 | return QLabel(u'%s' % hit) | ||
619 | 0 | 112 | ||
620 | === added file 'src/gui/userfiles.py' | |||
621 | --- src/gui/userfiles.py 1970-01-01 00:00:00 +0000 | |||
622 | +++ src/gui/userfiles.py 2009-10-27 21:15:19 +0000 | |||
623 | @@ -0,0 +1,34 @@ | |||
624 | 1 | #!/usr/bin/python2.6 | ||
625 | 2 | # -*- coding: utf-8 -*- | ||
626 | 3 | |||
627 | 4 | from PyQt4.QtGui import QLabel | ||
628 | 5 | from PyQt4.QtGui import QScrollArea | ||
629 | 6 | from PyQt4.QtGui import QVBoxLayout | ||
630 | 7 | from PyQt4.QtCore import Qt | ||
631 | 8 | |||
632 | 9 | |||
633 | 10 | class UserFiles(QScrollArea): | ||
634 | 11 | |||
635 | 12 | def __init__(self, control, userId = None, *args): | ||
636 | 13 | apply(QScrollArea.__init__, (self, ) + args) | ||
637 | 14 | |||
638 | 15 | self._control = control | ||
639 | 16 | self._userId = self._control.getRemote().localIdentityHex() \ | ||
640 | 17 | if userId == None else userId | ||
641 | 18 | |||
642 | 19 | self._layout = QVBoxLayout() | ||
643 | 20 | self.setLayout(self._layout) | ||
644 | 21 | |||
645 | 22 | self.update() | ||
646 | 23 | |||
647 | 24 | def update(self): | ||
648 | 25 | files = self._control.getRemote().getfilenames(self._userId) | ||
649 | 26 | if files: | ||
650 | 27 | for file in files: | ||
651 | 28 | fileLabel = QLabel(u'%s' % file) | ||
652 | 29 | fileLabel.setAlignment(Qt.AlignLeft|Qt.AlignTop) | ||
653 | 30 | self._layout.addWidget(fileLabel) | ||
654 | 31 | else: | ||
655 | 32 | notFoundLabel = QLabel(u'No files found.') | ||
656 | 33 | notFoundLabel.setAlignment(Qt.AlignHCenter|Qt.AlignTop) | ||
657 | 34 | self._layout.addWidget(notFoundLabel) | ||
658 | 0 | 35 | ||
659 | === added file 'src/gui/userinfo.py' | |||
660 | --- src/gui/userinfo.py 1970-01-01 00:00:00 +0000 | |||
661 | +++ src/gui/userinfo.py 2009-10-27 21:15:19 +0000 | |||
662 | @@ -0,0 +1,90 @@ | |||
663 | 1 | #!/usr/bin/python2.6 | ||
664 | 2 | # -*- coding: utf-8 -*- | ||
665 | 3 | |||
666 | 4 | from userpicture import UserPicture | ||
667 | 5 | |||
668 | 6 | from PyQt4.QtGui import QHBoxLayout | ||
669 | 7 | from PyQt4.QtGui import QLabel | ||
670 | 8 | from PyQt4.QtGui import QLineEdit | ||
671 | 9 | from PyQt4.QtGui import QPushButton | ||
672 | 10 | from PyQt4.QtGui import QVBoxLayout | ||
673 | 11 | from PyQt4.QtGui import QWidget | ||
674 | 12 | from PyQt4.QtCore import Qt | ||
675 | 13 | from PyQt4.QtCore import QObject | ||
676 | 14 | from PyQt4.QtCore import SIGNAL | ||
677 | 15 | from PyQt4.QtCore import SLOT | ||
678 | 16 | |||
679 | 17 | |||
680 | 18 | class UserInfo(QWidget): | ||
681 | 19 | |||
682 | 20 | def __init__(self, control, userId = None, *args): | ||
683 | 21 | apply(QWidget.__init__, (self, ) + args) | ||
684 | 22 | self._control = control | ||
685 | 23 | self._layout = QHBoxLayout() | ||
686 | 24 | self._layout.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop); | ||
687 | 25 | self.setLayout(self._layout) | ||
688 | 26 | self._email = None | ||
689 | 27 | self._layout.addWidget(UserPicture(self._control, userId)) | ||
690 | 28 | if userId: | ||
691 | 29 | self._friendHeader(userId) | ||
692 | 30 | else: | ||
693 | 31 | self._userHeader() | ||
694 | 32 | self._uid = userId | ||
695 | 33 | |||
696 | 34 | def _userHeader(self): | ||
697 | 35 | emailData = self._control.getStore().getEmail() | ||
698 | 36 | if not emailData: | ||
699 | 37 | emailData = '' | ||
700 | 38 | self._email = QLineEdit(u'%s' % emailData) | ||
701 | 39 | QObject.connect(self._email, SIGNAL('returnPressed()'), self._changeEmail) | ||
702 | 40 | |||
703 | 41 | data = QWidget() | ||
704 | 42 | dataLayout = QVBoxLayout() | ||
705 | 43 | dataLayout.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop); | ||
706 | 44 | data.setLayout(dataLayout) | ||
707 | 45 | |||
708 | 46 | userId = QLabel(u'User id: %s' % self._control.getRemote().localIdentityHex()) | ||
709 | 47 | userId.setTextInteractionFlags(Qt.TextSelectableByMouse) | ||
710 | 48 | dataLayout.addWidget(userId) | ||
711 | 49 | |||
712 | 50 | email = QWidget() | ||
713 | 51 | emailLayout = QHBoxLayout() | ||
714 | 52 | email.setLayout(emailLayout) | ||
715 | 53 | emailLayout.addWidget(QLabel(u'Email:')) | ||
716 | 54 | emailLayout.addWidget(self._email) | ||
717 | 55 | dataLayout.addWidget(email) | ||
718 | 56 | |||
719 | 57 | self._layout.addWidget(data) | ||
720 | 58 | |||
721 | 59 | def _friendHeader(self, friendId): | ||
722 | 60 | data = QWidget() | ||
723 | 61 | |||
724 | 62 | dataLayout = QVBoxLayout() | ||
725 | 63 | dataLayout.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop); | ||
726 | 64 | |||
727 | 65 | userId = QLabel(u'User id: %s' % friendId) | ||
728 | 66 | userId.setTextInteractionFlags(Qt.TextSelectableByMouse) | ||
729 | 67 | dataLayout.addWidget(userId) | ||
730 | 68 | |||
731 | 69 | emailData = self._control.getStore().getEmail(friendId) | ||
732 | 70 | if emailData: | ||
733 | 71 | email = QLabel(u'Email: %s' % emailData) | ||
734 | 72 | email.setTextInteractionFlags(Qt.TextSelectableByMouse) | ||
735 | 73 | dataLayout.addWidget(email) | ||
736 | 74 | |||
737 | 75 | data.setLayout(dataLayout) | ||
738 | 76 | self._layout.addWidget(data) | ||
739 | 77 | |||
740 | 78 | actionButton = QPushButton(u'Forget') | ||
741 | 79 | QObject.connect(actionButton, SIGNAL('pressed()'), self._forgetUser) | ||
742 | 80 | self._layout.addWidget(actionButton) | ||
743 | 81 | |||
744 | 82 | def _forgetUser(self): | ||
745 | 83 | self._control.forgetUser(self._uid) | ||
746 | 84 | |||
747 | 85 | def _changeEmail(self): | ||
748 | 86 | self._control.changeEmail(str(self._email.text())) | ||
749 | 87 | |||
750 | 88 | def _changeMugshot(self): | ||
751 | 89 | #self._control.changeMugshot(str(self._email.text())) | ||
752 | 90 | pass | ||
753 | 0 | 91 | ||
754 | === added file 'src/gui/userpicture.py' | |||
755 | --- src/gui/userpicture.py 1970-01-01 00:00:00 +0000 | |||
756 | +++ src/gui/userpicture.py 2009-10-27 21:15:19 +0000 | |||
757 | @@ -0,0 +1,59 @@ | |||
758 | 1 | #!/usr/bin/python2.6 | ||
759 | 2 | # -*- coding: utf-8 -*- | ||
760 | 3 | |||
761 | 4 | from PyQt4.QtGui import QHBoxLayout | ||
762 | 5 | from PyQt4.QtGui import QImage | ||
763 | 6 | from PyQt4.QtGui import QPushButton | ||
764 | 7 | from PyQt4.QtGui import QPixmap | ||
765 | 8 | from PyQt4.QtGui import QIcon | ||
766 | 9 | from PyQt4.QtGui import QFileDialog | ||
767 | 10 | from PyQt4.QtCore import Qt | ||
768 | 11 | from PyQt4.QtCore import QSize | ||
769 | 12 | from PyQt4.QtCore import QObject | ||
770 | 13 | from PyQt4.QtCore import SIGNAL | ||
771 | 14 | from PyQt4.QtCore import SLOT | ||
772 | 15 | |||
773 | 16 | |||
774 | 17 | class UserPicture(QPushButton): | ||
775 | 18 | |||
776 | 19 | def __init__(self, control, userId = None, *args): | ||
777 | 20 | apply(QPushButton.__init__, (self, ) + args) | ||
778 | 21 | self._control = control | ||
779 | 22 | self._userId = userId | ||
780 | 23 | self.setIconSize(QSize(100, 100)) | ||
781 | 24 | self.setFlat(True) | ||
782 | 25 | self.update() | ||
783 | 26 | if userId: | ||
784 | 27 | QObject.connect(self, SIGNAL('pressed()'), self._pictureUpdate) | ||
785 | 28 | else: | ||
786 | 29 | QObject.connect(self, SIGNAL('pressed()'), self._pictureChange) | ||
787 | 30 | |||
788 | 31 | def update(self): | ||
789 | 32 | mugshot = self._control.getStore().getMugshot(self._userId) | ||
790 | 33 | if mugshot: | ||
791 | 34 | mugData = QPixmap() | ||
792 | 35 | mugData.loadFromData(mugshot) | ||
793 | 36 | pictureData = mugData.scaled(100,100, Qt.KeepAspectRatio) | ||
794 | 37 | else: | ||
795 | 38 | pictureData = QPixmap(self._control.getGFXPath() + '/mugshot_unknown.svg') | ||
796 | 39 | self.setIcon(QIcon(pictureData)) | ||
797 | 40 | |||
798 | 41 | def _pictureChange(self): | ||
799 | 42 | filePath = QFileDialog.getOpenFileName(None, u'Open Image', '', 'Image Files (*.png *.jpg *.bmp *.svg)'); | ||
800 | 43 | import os.path | ||
801 | 44 | if os.path.isfile(filePath): | ||
802 | 45 | file = open(filePath, 'r') | ||
803 | 46 | data = file.read() | ||
804 | 47 | file.close() | ||
805 | 48 | self._control.changeMugshot(data) | ||
806 | 49 | self.update() | ||
807 | 50 | |||
808 | 51 | def _pictureUpdate(self): | ||
809 | 52 | try: | ||
810 | 53 | mugshot = self._control.getRemote().retrieve('mugshot', self._userId) | ||
811 | 54 | except: | ||
812 | 55 | mugshot = None | ||
813 | 56 | if mugshot: | ||
814 | 57 | self._control.getStore().putMugshot(mugshot, self._userId) | ||
815 | 58 | self.update() | ||
816 | 59 | self._control.refreshTab(self._userId) | ||
817 | 0 | 60 | ||
818 | === added file 'src/gui/usertab.py' | |||
819 | --- src/gui/usertab.py 1970-01-01 00:00:00 +0000 | |||
820 | +++ src/gui/usertab.py 2009-10-27 21:15:19 +0000 | |||
821 | @@ -0,0 +1,19 @@ | |||
822 | 1 | #!/usr/bin/python2.6 | ||
823 | 2 | # -*- coding: utf-8 -*- | ||
824 | 3 | |||
825 | 4 | from PyQt4.QtGui import QWidget | ||
826 | 5 | from PyQt4.QtGui import QVBoxLayout | ||
827 | 6 | from PyQt4.QtCore import Qt | ||
828 | 7 | |||
829 | 8 | |||
830 | 9 | class UserTab(QWidget): | ||
831 | 10 | |||
832 | 11 | def __init__(self, control, *args): | ||
833 | 12 | apply(QWidget.__init__, (self, ) + args) | ||
834 | 13 | self._control = control | ||
835 | 14 | self._layout = QVBoxLayout() | ||
836 | 15 | self._layout.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop); | ||
837 | 16 | self.setLayout(self._layout) | ||
838 | 17 | |||
839 | 18 | def addWidget(self, widget): | ||
840 | 19 | self._layout.addWidget(widget) | ||
841 | 0 | 20 | ||
842 | === added file 'src/gui/usertabwidget.py' | |||
843 | --- src/gui/usertabwidget.py 1970-01-01 00:00:00 +0000 | |||
844 | +++ src/gui/usertabwidget.py 2009-10-27 21:15:19 +0000 | |||
845 | @@ -0,0 +1,66 @@ | |||
846 | 1 | #!/usr/bin/python2.6 | ||
847 | 2 | # -*- coding: utf-8 -*- | ||
848 | 3 | |||
849 | 4 | from hometab import HomeTab | ||
850 | 5 | from friendtab import FriendTab | ||
851 | 6 | from newfriendtab import NewFriendTab | ||
852 | 7 | |||
853 | 8 | from PyQt4.QtGui import QIcon | ||
854 | 9 | from PyQt4.QtGui import QTabWidget | ||
855 | 10 | from PyQt4.QtGui import QPixmap | ||
856 | 11 | |||
857 | 12 | |||
858 | 13 | class UserTabWidget(QTabWidget): | ||
859 | 14 | |||
860 | 15 | def __init__(self, control, *args): | ||
861 | 16 | apply(QTabWidget.__init__, (self, ) + args) | ||
862 | 17 | self._control = control | ||
863 | 18 | self._control.addUserTabWidget(self) | ||
864 | 19 | self._addUserTab() | ||
865 | 20 | self._addFriendTabs() | ||
866 | 21 | self._addNewFriendTab() | ||
867 | 22 | |||
868 | 23 | def _addUserTab(self): | ||
869 | 24 | self.addTab(HomeTab(self._control), QIcon(self._control.getGFXPath() + '/home.svg'), u'&Home') | ||
870 | 25 | |||
871 | 26 | def _addFriendTabs(self): | ||
872 | 27 | order = 0 | ||
873 | 28 | for friendId in self._control.getStore().getFriends(): | ||
874 | 29 | (icon, title) = self._getFriendTabInfo(friendId) | ||
875 | 30 | self.addTab(FriendTab(self._control, friendId), icon, u'%s' % title) | ||
876 | 31 | self._control.addUserTab((order, friendId)) | ||
877 | 32 | order+=1 | ||
878 | 33 | |||
879 | 34 | def addFriendTab(self, friendId): | ||
880 | 35 | pos = self.count()-1 | ||
881 | 36 | order = pos-1 | ||
882 | 37 | (icon, title) = self._getFriendTabInfo(friendId) | ||
883 | 38 | self.insertTab(pos, FriendTab(self._control, friendId), icon, u'%s' % title) | ||
884 | 39 | self._control.addUserTab((order, friendId)) | ||
885 | 40 | self.setCurrentIndex(pos) | ||
886 | 41 | |||
887 | 42 | def _getFriendTabInfo(self, uid): | ||
888 | 43 | email = self._control.getStore().getEmail(uid) | ||
889 | 44 | |||
890 | 45 | if email == None: | ||
891 | 46 | title = uid[:5] | ||
892 | 47 | else: | ||
893 | 48 | title = email.split('@')[0] | ||
894 | 49 | |||
895 | 50 | return (self.getFriendIcon(uid), title) | ||
896 | 51 | |||
897 | 52 | def getFriendIcon(self, uid): | ||
898 | 53 | mugshot = self._control.getStore().getMugshot(uid) | ||
899 | 54 | if mugshot: | ||
900 | 55 | iconData = QPixmap() | ||
901 | 56 | iconData.loadFromData(mugshot) | ||
902 | 57 | icon = QIcon(iconData) | ||
903 | 58 | else: | ||
904 | 59 | icon = self._loadUnknownMugshot() | ||
905 | 60 | return icon | ||
906 | 61 | |||
907 | 62 | def _addNewFriendTab(self): | ||
908 | 63 | self.addTab(NewFriendTab(self._control), u'+') | ||
909 | 64 | |||
910 | 65 | def _loadUnknownMugshot(self): | ||
911 | 66 | return QIcon(self._control.getGFXPath() + '/mugshot_unknown.svg') | ||
912 | 0 | 67 | ||
913 | === added file 'src/guicontrol.py' | |||
914 | --- src/guicontrol.py 1970-01-01 00:00:00 +0000 | |||
915 | +++ src/guicontrol.py 2009-10-27 21:15:19 +0000 | |||
916 | @@ -0,0 +1,76 @@ | |||
917 | 1 | #!/usr/bin/python2.6 | ||
918 | 2 | # -*- coding: utf-8 -*- | ||
919 | 3 | |||
920 | 4 | from remote import Remote | ||
921 | 5 | from store import Store | ||
922 | 6 | from realfs import Realfs | ||
923 | 7 | |||
924 | 8 | import os | ||
925 | 9 | |||
926 | 10 | |||
927 | 11 | class GUIControl(object): | ||
928 | 12 | |||
929 | 13 | def __init__(self): | ||
930 | 14 | self._gfx = '' | ||
931 | 15 | self._store = Store(Realfs([os.environ['HOME'], '.qfriendslol'])) | ||
932 | 16 | self._remote = Remote() | ||
933 | 17 | self._tabW = None | ||
934 | 18 | self._tabs = [] | ||
935 | 19 | |||
936 | 20 | def setGFXPath(self, path): | ||
937 | 21 | self._gfx = path | ||
938 | 22 | |||
939 | 23 | def getGFXPath(self): | ||
940 | 24 | return self._gfx | ||
941 | 25 | |||
942 | 26 | def getRemote(self): | ||
943 | 27 | return self._remote | ||
944 | 28 | |||
945 | 29 | def getStore(self): | ||
946 | 30 | return self._store | ||
947 | 31 | |||
948 | 32 | def addUserTabWidget(self, tabW): | ||
949 | 33 | self._tabW = tabW | ||
950 | 34 | |||
951 | 35 | def addUserTab(self, tuple): | ||
952 | 36 | self._tabs.append(tuple) | ||
953 | 37 | |||
954 | 38 | def changeEmail(self, email): | ||
955 | 39 | if not email == self.getStore().getEmail(): | ||
956 | 40 | self.getStore().putEmail(email) | ||
957 | 41 | self.getRemote().advertise(email) | ||
958 | 42 | |||
959 | 43 | def changeMugshot(self, mugshot): | ||
960 | 44 | if not mugshot == self.getStore().getMugshot(): | ||
961 | 45 | self.getStore().putMugshot(mugshot) | ||
962 | 46 | self.getRemote().store('mugshot', mugshot) | ||
963 | 47 | |||
964 | 48 | def addUser(self, uid, email = None): | ||
965 | 49 | self.getStore().addFriend(uid) | ||
966 | 50 | if email: | ||
967 | 51 | self.getStore().putEmail(email, uid) | ||
968 | 52 | self.updateUserData(uid) | ||
969 | 53 | self._tabW.addFriendTab(uid) | ||
970 | 54 | |||
971 | 55 | def forgetUser(self, uid): | ||
972 | 56 | self.getStore().removeFriend(uid) | ||
973 | 57 | index = map(lambda (x,_): x, filter(lambda (_,y): y == uid, | ||
974 | 58 | self._tabs))[0] | ||
975 | 59 | self._tabs = filter(lambda (x,_): x < index, self._tabs) + map( | ||
976 | 60 | lambda (x,y): (x-1,y), filter( | ||
977 | 61 | lambda (x,_): x > index, self._tabs)) | ||
978 | 62 | self._tabW.removeTab(index+1) | ||
979 | 63 | |||
980 | 64 | def updateUserData(self, uid): | ||
981 | 65 | try: | ||
982 | 66 | rdata = self.getRemote().retrieve('mugshot', uid) | ||
983 | 67 | except: | ||
984 | 68 | rdata = None | ||
985 | 69 | |||
986 | 70 | if rdata: | ||
987 | 71 | self.getStore().putMugshot(rdata, uid) | ||
988 | 72 | |||
989 | 73 | def refreshTab(self, userId): | ||
990 | 74 | index = map(lambda (x,_): x, filter(lambda (_,y): y == userId, | ||
991 | 75 | self._tabs))[0]+1 | ||
992 | 76 | self._tabW.setTabIcon(index, self._tabW.getFriendIcon(userId)) | ||
993 | 0 | 77 | ||
994 | === added file 'src/qfriendslol.pyw' | |||
995 | --- src/qfriendslol.pyw 1970-01-01 00:00:00 +0000 | |||
996 | +++ src/qfriendslol.pyw 2009-10-27 21:15:19 +0000 | |||
997 | @@ -0,0 +1,31 @@ | |||
998 | 1 | #!/usr/bin/python2.6 | ||
999 | 2 | # -*- coding: utf-8 -*- | ||
1000 | 3 | |||
1001 | 4 | from guicontrol import GUIControl | ||
1002 | 5 | from gui.mainwindow import MainWindow | ||
1003 | 6 | |||
1004 | 7 | import sys | ||
1005 | 8 | import os.path | ||
1006 | 9 | from PyQt4.QtGui import QApplication | ||
1007 | 10 | |||
1008 | 11 | def main(): | ||
1009 | 12 | app = QApplication(sys.argv) | ||
1010 | 13 | |||
1011 | 14 | control = GUIControl() | ||
1012 | 15 | control.setGFXPath(os.path.dirname(__file__) + '/gfx') | ||
1013 | 16 | #configTestStore(control.getStore()) | ||
1014 | 17 | |||
1015 | 18 | window = MainWindow(control) | ||
1016 | 19 | window.show() | ||
1017 | 20 | |||
1018 | 21 | app.exec_() | ||
1019 | 22 | |||
1020 | 23 | def configTestStore(store): | ||
1021 | 24 | store.putEmail('me@localhost') | ||
1022 | 25 | store.addFriend('8682065025227700138022978937487170069337') | ||
1023 | 26 | store.putEmail('frank@gmail.com', '8682065025227700138022978937487170069337') | ||
1024 | 27 | store.putMugshot(open(os.path.dirname(__file__) + '/../branding/qfriendslol_logo_64x64.png').read(), '8682065025227700138022978937487170069337') | ||
1025 | 28 | store.addFriend('e4e8743ffd801b2a126de53607c9ccd383fb71b8') | ||
1026 | 29 | |||
1027 | 30 | if __name__ == '__main__': | ||
1028 | 31 | main() | ||
1029 | 0 | 32 | ||
1030 | === modified file 'src/remote.py' | |||
1031 | --- src/remote.py 2009-10-27 14:38:48 +0000 | |||
1032 | +++ src/remote.py 2009-10-27 21:15:19 +0000 | |||
1033 | @@ -54,7 +54,7 @@ | |||
1034 | 54 | qfriendslol-1-metsä.jpg → piece1 | 54 | qfriendslol-1-metsä.jpg → piece1 |
1035 | 55 | ''' | 55 | ''' |
1036 | 56 | keyformat = 'qfriendslol-%s-' + filename | 56 | keyformat = 'qfriendslol-%s-' + filename |
1038 | 57 | block = int(self.get(keyformat % 0, userid)) | 57 | block = self.get(keyformat % 0, userid) |
1039 | 58 | if block == None: | 58 | if block == None: |
1040 | 59 | raise Error('Header unavailable') | 59 | raise Error('Header unavailable') |
1041 | 60 | try: | 60 | try: |
1042 | @@ -119,24 +119,23 @@ | |||
1043 | 119 | f = open('uppi.jpeg') | 119 | f = open('uppi.jpeg') |
1044 | 120 | upattava = f.read() | 120 | upattava = f.read() |
1045 | 121 | f.close() | 121 | f.close() |
1047 | 122 | r.store('mugshot.jpeg',upattava) | 122 | r.store('mugshot',upattava) |
1048 | 123 | 123 | ||
1049 | 124 | 124 | ||
1050 | 125 | r.advertise('muumi@golf.uk') | 125 | r.advertise('muumi@golf.uk') |
1051 | 126 | users = r.findUser('muumi@golf.uk') | 126 | users = r.findUser('muumi@golf.uk') |
1052 | 127 | user = users[0] | 127 | user = users[0] |
1053 | 128 | print user | 128 | print user |
1055 | 129 | (size,time)= r.fileinfo('mugshot.jpeg', user) | 129 | (size,time)= r.fileinfo('mugshot', user) |
1056 | 130 | 130 | ||
1057 | 131 | from logic import seconds2string | 131 | from logic import seconds2string |
1058 | 132 | print seconds2string(time) | 132 | print seconds2string(time) |
1059 | 133 | print '%sB' % size | 133 | print '%sB' % size |
1060 | 134 | 134 | ||
1062 | 135 | r.putfilenames(['mugshot.jpeg']) | 135 | r.putfilenames(['mugshot']) |
1063 | 136 | 136 | ||
1065 | 137 | data = r.retrieve('mugshot.jpeg', user) | 137 | data = r.retrieve('mugshot', user) |
1066 | 138 | 138 | ||
1068 | 139 | f = open('mugshot.jpeg','w') | 139 | f = open('mugshot','w') |
1069 | 140 | f.write(data) | 140 | f.write(data) |
1070 | 141 | f.close() | 141 | f.close() |
1071 | 142 | |||
1072 | 143 | 142 | ||
1073 | === modified file 'src/store.py' | |||
1074 | --- src/store.py 2009-10-27 00:55:02 +0000 | |||
1075 | +++ src/store.py 2009-10-27 21:15:19 +0000 | |||
1076 | @@ -5,21 +5,21 @@ | |||
1077 | 5 | 5 | ||
1078 | 6 | def __init__(self, fs): | 6 | def __init__(self, fs): |
1079 | 7 | self._fs = fs | 7 | self._fs = fs |
1081 | 8 | self._friends = [] | 8 | self._updFriends() |
1082 | 9 | 9 | ||
1083 | 10 | def putMugshot(self, pic, userid = None): | 10 | def putMugshot(self, pic, userid = None): |
1084 | 11 | if (userid == None): | 11 | if (userid == None): |
1086 | 12 | self._fs.write(['mugshot.jpeg'], pic) | 12 | self._fs.write(['mugshot'], pic) |
1087 | 13 | elif self._isValidId(userid) and userid in self.getFriends(): | 13 | elif self._isValidId(userid) and userid in self.getFriends(): |
1089 | 14 | self._fs.write([self._getFriendFolderName(userid), 'mugshot.jpeg'], pic) | 14 | self._fs.write(['friends', self._getFriendFolderName(userid), 'mugshot'], pic) |
1090 | 15 | else: | 15 | else: |
1091 | 16 | raise ValueError | 16 | raise ValueError |
1092 | 17 | 17 | ||
1093 | 18 | def getMugshot(self, userid = None): | 18 | def getMugshot(self, userid = None): |
1094 | 19 | if (userid == None): | 19 | if (userid == None): |
1096 | 20 | return self._fs.read(['mugshot.jpeg']) | 20 | return self._fs.read(['mugshot']) |
1097 | 21 | elif self._isValidId(userid) and userid in self.getFriends(): | 21 | elif self._isValidId(userid) and userid in self.getFriends(): |
1099 | 22 | return self._fs.read([self._getFriendFolderName(userid), 'mugshot.jpeg']) | 22 | return self._fs.read(['friends', self._getFriendFolderName(userid), 'mugshot']) |
1100 | 23 | else: | 23 | else: |
1101 | 24 | raise ValueError | 24 | raise ValueError |
1102 | 25 | 25 | ||
1103 | @@ -27,7 +27,7 @@ | |||
1104 | 27 | if (userid == None): | 27 | if (userid == None): |
1105 | 28 | self._fs.write(['email.txt'], email) | 28 | self._fs.write(['email.txt'], email) |
1106 | 29 | elif self._isValidId(userid) and userid in self.getFriends(): | 29 | elif self._isValidId(userid) and userid in self.getFriends(): |
1108 | 30 | self._fs.write([self._getFriendFolderName(userid), 'email.txt'], email) | 30 | self._fs.write(['friends', self._getFriendFolderName(userid), 'email.txt'], email) |
1109 | 31 | else: | 31 | else: |
1110 | 32 | raise ValueError | 32 | raise ValueError |
1111 | 33 | 33 | ||
1112 | @@ -35,7 +35,7 @@ | |||
1113 | 35 | if (userid == None): | 35 | if (userid == None): |
1114 | 36 | return self._fs.read(['email.txt']) | 36 | return self._fs.read(['email.txt']) |
1115 | 37 | elif self._isValidId(userid) and userid in self.getFriends(): | 37 | elif self._isValidId(userid) and userid in self.getFriends(): |
1117 | 38 | return self._fs.read([self._getFriendFolderName(userid), 'email.txt']) | 38 | return self._fs.read(['friends', self._getFriendFolderName(userid), 'email.txt']) |
1118 | 39 | else: | 39 | else: |
1119 | 40 | raise ValueError | 40 | raise ValueError |
1120 | 41 | 41 | ||
1121 | @@ -56,18 +56,19 @@ | |||
1122 | 56 | return map(lambda (_, id): id, self._friends) | 56 | return map(lambda (_, id): id, self._friends) |
1123 | 57 | 57 | ||
1124 | 58 | def _updFriends(self): | 58 | def _updFriends(self): |
1130 | 59 | self._friends = [] | 59 | self._friends = filter(lambda (_, uid): self._isValidId(uid), map(lambda folder: tuple(folder.split('-')), self._fs.ls(['friends']))) |
1131 | 60 | for item in self._fs.ls(['friends']): | 60 | |
1127 | 61 | item = item.split('-') | ||
1128 | 62 | if (len(item) == 2) and (self._isValidId(item[1])): | ||
1129 | 63 | self._friends.append((item[0], item[1])) | ||
1132 | 64 | 61 | ||
1133 | 65 | def _getFriendFolderName(self, userid): | 62 | def _getFriendFolderName(self, userid): |
1134 | 66 | return "%s-%s" % (self._getFriendNum(userid), userid) | 63 | return "%s-%s" % (self._getFriendNum(userid), userid) |
1135 | 67 | 64 | ||
1136 | 68 | def _getFriendNum(self, userid): | 65 | def _getFriendNum(self, userid): |
1139 | 69 | return map(lambda (order,_): order, filter(lambda (_,id): id == userid, | 66 | orders = map(lambda (order,_): order, filter(lambda (_,id): id == userid, |
1140 | 70 | self._friends))[0] | 67 | self._friends)) |
1141 | 68 | if orders: | ||
1142 | 69 | return orders[0] | ||
1143 | 70 | else: | ||
1144 | 71 | return -1 | ||
1145 | 71 | 72 | ||
1146 | 72 | def _nextFriendNum(self): | 73 | def _nextFriendNum(self): |
1147 | 73 | max = 0 | 74 | max = 0 |
There is working gui, which should be merged in trunk.