Merge lp://qastaging/~appi2012/gnome-activity-journal/bettertheming into lp://qastaging/gnome-activity-journal
- bettertheming
- Merge into trunk
Proposed by
appi2012
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp://qastaging/~appi2012/gnome-activity-journal/bettertheming |
Merge into: | lp://qastaging/gnome-activity-journal |
Diff against target: |
268 lines (+124/-39) 4 files modified
src/daywidgets.py (+46/-14) src/main.py (+45/-7) src/ui_utils.py (+6/-6) src/widgets.py (+27/-12) |
To merge this branch: | bzr merge lp://qastaging/~appi2012/gnome-activity-journal/bettertheming |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Seif Lotfy | Approve | ||
Review via email: mp+17046@code.qastaging.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
appi2012 (appi2012) wrote : | # |
Revision history for this message
Seif Lotfy (seif) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/daywidgets.py' |
2 | --- src/daywidgets.py 2010-01-08 18:40:31 +0000 |
3 | +++ src/daywidgets.py 2010-01-08 21:23:16 +0000 |
4 | @@ -97,9 +97,22 @@ |
5 | def change_style(widget, style): |
6 | rc_style = self.style |
7 | color = rc_style.bg[gtk.STATE_NORMAL] |
8 | - color.red = color.red * 105 / 100 |
9 | - color.green = color.green * 105 / 100 |
10 | - color.blue = color.blue * 105 / 100 |
11 | + |
12 | + if color.red * 125/100 > 65535.0: |
13 | + color.red = 65535.0 |
14 | + else: |
15 | + color.red = color.red * 125 / 100 |
16 | + |
17 | + if color.green * 125/100 > 65535.0: |
18 | + color.green = 65535.0 |
19 | + else: |
20 | + color.green = color.green * 125 / 100 |
21 | + |
22 | + if color.blue * 125/100 > 65535.0: |
23 | + color.blue = 65535.0 |
24 | + else: |
25 | + color.blue = color.blue * 125 / 100 |
26 | + |
27 | evbox2.modify_bg(gtk.STATE_NORMAL, color) |
28 | |
29 | self.connect("style-set", change_style) |
30 | @@ -144,11 +157,11 @@ |
31 | |
32 | def change_style(widget, style): |
33 | rc_style = self.style |
34 | - color = rc_style.bg[gtk.STATE_NORMAL] |
35 | - color.red = color.red*2/3 |
36 | - color.green = color.green*2/3 |
37 | - color.blue = color.blue*2/3 |
38 | - #label1.modify_text(gtk.STATE_NORMAL, color) |
39 | + color = rc_style.bg[gtk.STATE_NORMAL] |
40 | + fcolor = rc_style.fg[gtk.STATE_NORMAL] |
41 | + color.red = (2*color.red + fcolor.red)/3 |
42 | + color.green = (2*color.green + fcolor.green)/3 |
43 | + color.blue = (2*color.blue + fcolor.blue)/3 |
44 | self.label.modify_fg(gtk.STATE_NORMAL, color) |
45 | |
46 | |
47 | @@ -292,9 +305,13 @@ |
48 | x, y = event.area.width, event.area.height |
49 | context.set_font_size(20) |
50 | if self.leading: |
51 | - context.set_source_rgba(1, 1, 1, 1) |
52 | + fg = self.style.text[gtk.STATE_SELECTED] |
53 | + red, green, blue = fg.red/65535.0, fg.green/65535.0, fg.blue/65535.0 |
54 | + context.set_source_rgba(red, green, blue, 1) |
55 | else: |
56 | - context.set_source_rgba(0.2, 0.2, 0.2, 1) |
57 | + fg = self.style.fg[gtk.STATE_NORMAL] |
58 | + red, green, blue = fg.red/65535.0, fg.green/65535.0, fg.blue/65535.0 |
59 | + context.set_source_rgba(red, green, blue, 1) |
60 | |
61 | xbearing, ybearing, width, height, xadvance, yadvance = context.text_extents(self.day) |
62 | a = (x-width)/2 |
63 | @@ -311,9 +328,14 @@ |
64 | x, y = event.area.width, event.area.height |
65 | context.set_font_size(12) |
66 | if self.leading: |
67 | - context.set_source_rgba(1, 1, 1, 1) |
68 | + fg = self.style.text[gtk.STATE_SELECTED] |
69 | + red, green, blue = fg.red/65535.0, fg.green/65535.0, fg.blue/65535.0 |
70 | + context.set_source_rgba(red, green, blue, 1) |
71 | else: |
72 | - context.set_source_rgba(0.7, 0.7, 0.7, 1) |
73 | + fg = self.style.fg[gtk.STATE_NORMAL] |
74 | + bg = self.style.bg[gtk.STATE_NORMAL] |
75 | + red, green, blue = (2*bg.red+fg.red)/3/65535.0, (2*bg.green+fg.green)/3/65535.0, (2*bg.blue+fg.blue)/3/65535.0 |
76 | + context.set_source_rgba(red, green, blue, 1) |
77 | |
78 | xbearing, ybearing, width, height, xadvance, yadvance = context.text_extents(self.date) |
79 | a = (x-width)/2 |
80 | @@ -327,14 +349,24 @@ |
81 | bg = self.style.bg[3] |
82 | red, green, blue = bg.red/65535.0, bg.green/65535.0, bg.blue/65535.0 |
83 | else: |
84 | - red, green, blue = 1, 1, 1 |
85 | + bg = self.style.bg[gtk.STATE_NORMAL] |
86 | + red = (bg.red * 125 / 100)/65535.0 |
87 | + green = (bg.green * 125 / 100)/65535.0 |
88 | + blue = (bg.blue * 125 / 100)/65535.0 |
89 | |
90 | # Draw |
91 | x = 0; y = 0 |
92 | r = 5 |
93 | w, h = event.area.width, event.area.height |
94 | # Temporary color, I will fix this later when I have a chance to sleep. |
95 | - context.set_source_rgba(red, green, blue, 1) |
96 | + grad = cairo.LinearGradient(0, 3*event.area.height, 0, 0) |
97 | + grad.add_color_stop_rgb(0, 0, 0, 0) |
98 | + grad.add_color_stop_rgb(1, red, green, blue) |
99 | + |
100 | + if self.leading: |
101 | + context.set_source(grad) |
102 | + else: |
103 | + context.set_source_rgba(red, green, blue, 1) |
104 | |
105 | context.new_sub_path() |
106 | context.arc(r+x, r+y, r, math.pi, 3 * math.pi /2) |
107 | |
108 | === modified file 'src/main.py' |
109 | --- src/main.py 2010-01-08 18:40:31 +0000 |
110 | +++ src/main.py 2010-01-08 21:23:16 +0000 |
111 | @@ -58,23 +58,40 @@ |
112 | self.backbtn.add(gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_NONE)) |
113 | self.backbtn.set_relief(gtk.RELIEF_NONE) |
114 | self.backbtn.set_focus_on_click(False) |
115 | - self.backbtn.set_tooltip_text(_("Go back in time")) |
116 | + self.backbtn.set_tooltip_text(_("Go Back in Time")) |
117 | + |
118 | self.fwdbtn = gtk.Button() |
119 | + self.fwdbtn.set_sensitive(False) |
120 | self.fwdbtn.set_relief(gtk.RELIEF_NONE) |
121 | self.fwdbtn.add(gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_NONE)) |
122 | self.fwdbtn.set_focus_on_click(False) |
123 | - self.fwdbtn.set_tooltip_text(_("Look into the future")) |
124 | - self.backbtn.connect("clicked", lambda w: self.activityview.jump(-86400)) |
125 | - self.fwdbtn.connect("clicked", lambda w: self.activityview.jump(86400)) |
126 | + self.fwdbtn.set_tooltip_text(_("Look into the Future")) |
127 | + |
128 | + self.ffwdbtn = gtk.Button() |
129 | + self.ffwdbtn.set_sensitive(False) |
130 | + self.ffwdbtn.set_relief(gtk.RELIEF_NONE) |
131 | + self.ffwdbtn.add(gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_NONE)) |
132 | + self.ffwdbtn.add(gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)) |
133 | + self.ffwdbtn.set_focus_on_click(False) |
134 | + self.ffwdbtn.set_tooltip_text(_("Jump to Today")) |
135 | + |
136 | + self.backbtn.connect("clicked", self.moveback) |
137 | + self.fwdbtn.connect("clicked", self.moveup) |
138 | + self.ffwdbtn.connect("clicked", self.jumpup) |
139 | |
140 | # We configure the view so that the left/right buttons touch the |
141 | # left/right edges in order to utilize Fitts law. This is accomplished |
142 | # by having no padding on the HBox |
143 | self.add(self.vbox) |
144 | + self.rbox = gtk.VBox() |
145 | + self.rbox.pack_start(self.ffwdbtn, False, 20) |
146 | + self.rbox.pack_start(self.fwdbtn) |
147 | + |
148 | hbox = gtk.HBox() |
149 | + |
150 | hbox.pack_start(self.backbtn, False, False) |
151 | hbox.pack_start(self.activityview) |
152 | - hbox.pack_start(self.fwdbtn, False, False) |
153 | + hbox.pack_start(self.rbox, False, False) |
154 | |
155 | btn = gtk.Button() |
156 | self.vbox.pack_start(btn, True, True, 6) |
157 | @@ -88,8 +105,29 @@ |
158 | self.show_all() |
159 | self.connect("configure-event", self._on_size_changed) |
160 | btn.hide() |
161 | - |
162 | - |
163 | +<<<<<<< TREE |
164 | + |
165 | + |
166 | +======= |
167 | + |
168 | + def jumpup(self, data=None): |
169 | + self.activityview._set_today_timestamp() |
170 | + self.fwdbtn.set_sensitive(False) |
171 | + self.ffwdbtn.set_sensitive(False) |
172 | + |
173 | + def moveup(self, data=None): |
174 | + self.activityview.jump(86400) |
175 | + dayinfocus = int(time.mktime(time.strptime(time.strftime("%d %B %Y") , "%d %B %Y"))) |
176 | + if (dayinfocus) < self.activityview.end: |
177 | + self.fwdbtn.set_sensitive(False) |
178 | + self.ffwdbtn.set_sensitive(False) |
179 | + |
180 | + def moveback(self, data=None): |
181 | + self.activityview.jump(-86400) |
182 | + self.fwdbtn.set_sensitive(True) |
183 | + self.ffwdbtn.set_sensitive(True) |
184 | + |
185 | +>>>>>>> MERGE-SOURCE |
186 | def _request_size(self): |
187 | screen = self._screen.get_monitor_geometry( |
188 | self._screen.get_monitor_at_point(*self.get_position())) |
189 | |
190 | === modified file 'src/ui_utils.py' |
191 | --- src/ui_utils.py 2010-01-07 16:54:16 +0000 |
192 | +++ src/ui_utils.py 2010-01-08 21:23:16 +0000 |
193 | @@ -377,10 +377,10 @@ |
194 | # it may just be a "bookmark event". |
195 | # |
196 | # Also, how this is implemented now won't work fine with i18n. |
197 | - Interpretation.VIDEO.uri: Source(Interpretation.VIDEO, "gnome-mime-video", "Video watched", "Videos watched"), |
198 | - Interpretation.MUSIC.uri: Source(Interpretation.MUSIC, "gnome-mime-audio", "Audio played", "Audio played"), |
199 | - Interpretation.IMAGE.uri: Source(Interpretation.IMAGE, "image", "Image viewed", "Images viewed"), |
200 | - Interpretation.DOCUMENT.uri: Source(Interpretation.DOCUMENT, "stock_new-presentation", "Document edited or read ", "Documents edited or read "), |
201 | - Interpretation.SOURCECODE.uri: Source(Interpretation.SOURCECODE, "applications-development", "Code edited or read", "Code edited or read"), |
202 | - Interpretation.UNKNOWN.uri: Source(Interpretation.UNKNOWN, "applications-other", "Other activity", "Other activities"), |
203 | + Interpretation.VIDEO.uri: Source(Interpretation.VIDEO, "gnome-mime-video", "Worked with a Video", "Worked with Videos"), |
204 | + Interpretation.MUSIC.uri: Source(Interpretation.MUSIC, "gnome-mime-audio", "Worked with Audio", "Worked with Audio"), |
205 | + Interpretation.IMAGE.uri: Source(Interpretation.IMAGE, "image", "Worked with an Image", "Worked with some Images"), |
206 | + Interpretation.DOCUMENT.uri: Source(Interpretation.DOCUMENT, "stock_new-presentation", "Edited or Read Document", "Edited or Read Documents"), |
207 | + Interpretation.SOURCECODE.uri: Source(Interpretation.SOURCECODE, "applications-development", "Edited or Read Code", "Edited or Read Code"), |
208 | + Interpretation.UNKNOWN.uri: Source(Interpretation.UNKNOWN, "applications-other", "Other Activity", "Other Activities"), |
209 | } |
210 | |
211 | === modified file 'src/widgets.py' |
212 | --- src/widgets.py 2010-01-08 18:40:31 +0000 |
213 | +++ src/widgets.py 2010-01-08 21:23:16 +0000 |
214 | @@ -178,16 +178,30 @@ |
215 | |
216 | def change_style(widget, style): |
217 | rc_style = self.style |
218 | - color = rc_style.text [gtk.STATE_SELECTED] |
219 | - color.red = color.red * 985 / 1000 |
220 | - color.green = color.green * 985 / 1000 |
221 | - color.blue = color.blue * 985 / 1000 |
222 | + color = rc_style.bg[gtk.STATE_NORMAL] |
223 | + |
224 | + if color.red * 125/100 > 65535.0: |
225 | + color.red = 65535.0 |
226 | + else: |
227 | + color.red = color.red * 125 / 100 |
228 | + |
229 | + if color.green * 125/100 > 65535.0: |
230 | + color.green = 65535.0 |
231 | + else: |
232 | + color.green = color.green * 125 / 100 |
233 | + |
234 | + if color.blue * 125/100 > 65535.0: |
235 | + color.blue = 65535.0 |
236 | + else: |
237 | + color.blue = color.blue * 125 / 100 |
238 | + |
239 | btn.modify_bg(gtk.STATE_NORMAL, color) |
240 | |
241 | - color = rc_style.bg[gtk.STATE_NORMAL] |
242 | - color.red = color.red*2/3 |
243 | - color.green = color.green*2/3 |
244 | - color.blue = color.blue*2/3 |
245 | + color = rc_style.bg[gtk.STATE_NORMAL] |
246 | + fcolor = rc_style.fg[gtk.STATE_NORMAL] |
247 | + color.red = (2*color.red + fcolor.red)/3 |
248 | + color.green = (2*color.green + fcolor.green)/3 |
249 | + color.blue = (2*color.blue + fcolor.blue)/3 |
250 | label.modify_fg(gtk.STATE_NORMAL, color) |
251 | self.img.modify_fg(gtk.STATE_NORMAL, color) |
252 | |
253 | @@ -234,10 +248,11 @@ |
254 | |
255 | def change_style(widget, style): |
256 | rc_style = self.style |
257 | - color = rc_style.bg[gtk.STATE_NORMAL] |
258 | - color.red = color.red*2/3 |
259 | - color.green = color.green*2/3 |
260 | - color.blue = color.blue*2/3 |
261 | + color = rc_style.bg[gtk.STATE_NORMAL] |
262 | + fcolor = rc_style.fg[gtk.STATE_NORMAL] |
263 | + color.red = (2*color.red + fcolor.red)/3 |
264 | + color.green = (2*color.green + fcolor.green)/3 |
265 | + color.blue = (2*color.blue + fcolor.blue)/3 |
266 | label.modify_fg(gtk.STATE_NORMAL, color) |
267 | |
268 | self.connect("style-set", change_style) |
This branch contains some coloring fixes, which make gnome-activity- journal look better, especially on dark themes. (Almost) all colors used in this branch are based on the gtk theme, and thus help the app blend in with the system. Also, it uses more versatile code to determine the shaded text colors, such as those used when listing the day part names ("Morning", etc.): instead of saying the color should be 2/3 * the normal fg color, it blends the background and foreground colors, using 1 part fg and 2 parts bg. This way, it results in the current, light gray color on light themes, but changes to match darker themes as well as themes with wacky colors.
The code is fairly simple, and should be easy to apply to the new calendar widget as well (which looks really nice, but it doesnt graph any of the data that gets clumped into a category widget ("4 Read or Edited Code"))
I hope this code helps.