~davidc3/onehundredscopes/cities

« back to all changes in this revision

Viewing changes to src/unity-scope-cities

  • Committer: David Callé
  • Date: 2011-12-03 00:20:22 UTC
  • Revision ID: davidc@framli.eu-20111203002022-9koo92mtwaw1e4ld
Generate the clock icon to actually show the time

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
                                try:
167
167
                                        for i in data_timezone['time_zone']:
168
168
                                                comment = i['localtime']
 
169
                                                print comment
169
170
                                                comment = comment.split(' ')[1]
170
171
                                                icon = 'http://cdn4.iconfinder.com/data/icons/Mobile-Icons/128/04_maps.png'
171
172
                                                model.append('http://maps.google.com/maps?q=%s' % title, icon, 0, "text/html",title, comment, '')
172
 
                                                model.append('', 'clock', 0, "text/html", comment, '', '')
 
173
                                                
 
174
                                                
 
175
                                                hours = int(comment.split(':')[0])
 
176
                                                minutes = int(comment.split(':')[1])
 
177
                                                from PIL import Image
 
178
                                                clock_back = Image.open("/usr/share/unity/lenses/utilities/clock_empty.png")
 
179
                                                clock_hours = Image.open("/usr/share/unity/lenses/utilities/clock_hours.png")
 
180
                                                clock_minutes = Image.open("/usr/share/unity/lenses/utilities/clock_minutes.png")
 
181
                                                
 
182
                                                clock_hours = clock_hours.rotate((hours*-30)-(minutes*1/2))
 
183
                                                clock_minutes = clock_minutes.rotate(minutes*-6)
 
184
                                                i
 
185
                                                clock_back.paste(clock_hours, (0, 0), clock_hours)
 
186
                                                clock_back.paste(clock_minutes, (0, 0), clock_minutes)
 
187
                                                clock_back.save('/tmp/%s.png' % comment)
 
188
                                                
 
189
                                                model.append('', '/tmp/%s.png' % comment, 0, "text/html", comment, '', '')
173
190
                                                
174
191
                                except (KeyError):
175
192
                                        pass