GTG

Merge lp:~gtg-user/gtg/urgency-color-api into lp:~gtg/gtg/old-trunk

Proposed by Wolter HV
Status: Merged
Merged at revision: 1208
Proposed branch: lp:~gtg-user/gtg/urgency-color-api
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 353 lines (+138/-65)
2 files modified
GTG/plugins/urgency_color/preferences.ui (+62/-24)
GTG/plugins/urgency_color/urgency_color.py (+76/-41)
To merge this branch: bzr merge lp:~gtg-user/gtg/urgency-color-api
Reviewer Review Type Date Requested Status
Bertrand Rousseau (community) Approve
Izidor Matušov code Approve
Review via email: mp+106581@code.launchpad.net

Commit message

Merged branch ~gtg-user/gtg/urgency-color-api to fix bug #1002160

Description of the change

This merge proposal will add a fix to the bug #1002160. The branch only modifies the Urgency Color plugin, so it shouldn't be create conflicts.

To post a comment you must log in.
Revision history for this message
Bertrand Rousseau (bertrand-rousseau) wrote :

Hi Wolter,

Thanks a lot for your patch!

There seems to be an issue with your branch: every *.py scripts have been marked as executable. This is not the case in trunk. Could you please fix this?

review: Needs Fixing (code, run)
Revision history for this message
Wolter HV (wolterh) wrote :

Should I run a chmod -x to every python script?

Revision history for this message
Bertrand Rousseau (bertrand-rousseau) wrote :

Only those originally marked as executable should stay as such.

On Wed, May 23, 2012 at 7:06 AM, Wolter Hellmund <email address hidden> wrote:
> Should I run a chmod -x to every python script?
>
> --
> https://code.launchpad.net/~gtg-user/gtg/urgency-color-api/+merge/106581
> You are reviewing the proposed merge of lp:~gtg-user/gtg/urgency-color-api into lp:gtg.

--
Bertrand Rousseau

lp:~gtg-user/gtg/urgency-color-api updated
1185. By Wolter HV

Attempted to fix file permissions on Bertrand Rousseau's request (Great catch! A lot of the files had different permissions because I had branched on NTFS which doesn't support linux permissions). Did so: 1. Branched lp:gtg on an ext4 FS. 2. Copied the plugin files to this new branch. 3. Corrected the permissions on the copied files. 4. Tested. 5. Comitting now.

Revision history for this message
Wolter HV (wolterh) wrote :

Ok I now know what was happening. I had been working on an NTFS partition, which doesn't support Linux partitions, so all the branch's permissions were ignored and modified. I bet not only python scripts' permissions were modified.

I have moved my workspace to an ext4 filesystem and attempted to fix the problem. I tried to fix the problem (please check if I did a good job or if its still not done) and included a little explanation in the commit message.

lp:~gtg-user/gtg/urgency-color-api updated
1186. By Wolter HV

Removed patch filename from the .bzrignore list (which already ignores patches, thus the line was superfluous)

Revision history for this message
Izidor Matušov (izidor) wrote :

=== modified file '.bzrignore' (properties changed: -x to +x)

.bzignore has still +x, please remove it. Otherwise it looks good to me and it could be merged.

review: Approve (code)
lp:~gtg-user/gtg/urgency-color-api updated
1187. By Wolter HV

.bzrignore permissions restored as suggested by izidor

Revision history for this message
Wolter HV (wolterh) wrote :

Bertrand so you think the branch is ready for merging?

Revision history for this message
Bertrand Rousseau (bertrand-rousseau) wrote :

Hi,

I approve the code. I also made it run successfully.

I have a small remark, though: you changed the color labels to priority labels in the code (red, yellow, green, to high, low, med). It's a good idea, but could you also update the comments as well, so that the code is consistent?

review: Needs Fixing
Revision history for this message
Wolter HV (wolterh) wrote :

Ok, I had forgot about that! Thanks for reminding.

lp:~gtg-user/gtg/urgency-color-api updated
1188. By Wolter HV

Updated a couple of comments replacing color references with urgency references as to satisfy Bertrand's suggestion

Revision history for this message
Wolter HV (wolterh) wrote :

I corrected the comments, if there is anything else needed before the plugin can be merged let me know!

Revision history for this message
Bertrand Rousseau (bertrand-rousseau) wrote :

Yes, there are still comments to update in prefs_update_widgets()

review: Needs Fixing
lp:~gtg-user/gtg/urgency-color-api updated
1189. By Wolter HV

Fixed a last triplet of comments that referenced urgency status by color

Revision history for this message
Wolter HV (wolterh) wrote :

> Yes, there are still comments to update in prefs_update_widgets()

Next time I'll do a case insensitive search :) Fixed.

Revision history for this message
Bertrand Rousseau (bertrand-rousseau) wrote :

Ok. Approve.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/plugins/urgency_color/preferences.ui'
2--- GTG/plugins/urgency_color/preferences.ui 2012-03-05 15:23:05 +0000
3+++ GTG/plugins/urgency_color/preferences.ui 2012-07-13 17:03:24 +0000
4@@ -111,17 +111,55 @@
5 <property name="can_focus">False</property>
6 <property name="spacing">5</property>
7 <child>
8- <object class="GtkHBox" id="hbox_colors_red">
9- <property name="visible">True</property>
10- <property name="can_focus">False</property>
11- <child>
12- <object class="GtkColorButton" id="colorbutton_red">
13- <property name="use_action_appearance">False</property>
14- <property name="visible">True</property>
15- <property name="can_focus">True</property>
16- <property name="receives_default">True</property>
17- <property name="use_action_appearance">False</property>
18- <signal name="color-set" handler="on_prefs_colorbutton_red_changed" swapped="no"/>
19+ <object class="GtkHBox" id="hbox_colors_overdue">
20+ <property name="visible">True</property>
21+ <property name="can_focus">False</property>
22+ <child>
23+ <object class="GtkColorButton" id="colorbutton_overdue">
24+ <property name="use_action_appearance">False</property>
25+ <property name="visible">True</property>
26+ <property name="can_focus">True</property>
27+ <property name="receives_default">True</property>
28+ <property name="use_action_appearance">False</property>
29+ <signal name="color-set" handler="on_prefs_colorbutton_overdue_changed" swapped="no"/>
30+ </object>
31+ <packing>
32+ <property name="expand">False</property>
33+ <property name="fill">True</property>
34+ <property name="position">0</property>
35+ </packing>
36+ </child>
37+ <child>
38+ <object class="GtkLabel" id="label20">
39+ <property name="visible">True</property>
40+ <property name="can_focus">False</property>
41+ <property name="label" translatable="yes">Overdue</property>
42+ </object>
43+ <packing>
44+ <property name="expand">True</property>
45+ <property name="fill">True</property>
46+ <property name="position">1</property>
47+ </packing>
48+ </child>
49+ </object>
50+ <packing>
51+ <property name="expand">False</property>
52+ <property name="fill">True</property>
53+ <property name="position">0</property>
54+ </packing>
55+ </child>
56+ <child>
57+ <object class="GtkHBox" id="hbox_colors_high">
58+ <property name="visible">True</property>
59+ <property name="can_focus">False</property>
60+ <child>
61+ <object class="GtkColorButton" id="colorbutton_high">
62+ <property name="use_action_appearance">False</property>
63+ <property name="visible">True</property>
64+ <property name="can_focus">True</property>
65+ <property name="receives_default">True</property>
66+ <property name="use_action_appearance">False</property>
67+ <signal name="color-set" handler="on_prefs_colorbutton_high_changed" swapped="no"/>
68 </object>
69 <packing>
70 <property name="expand">False</property>
71@@ -133,7 +171,7 @@
72 <object class="GtkLabel" id="label5">
73 <property name="visible">True</property>
74 <property name="can_focus">False</property>
75- <property name="label" translatable="yes">In danger zone</property>
76+ <property name="label" translatable="yes">High</property>
77 </object>
78 <packing>
79 <property name="expand">True</property>
80@@ -145,21 +183,21 @@
81 <packing>
82 <property name="expand">False</property>
83 <property name="fill">True</property>
84- <property name="position">0</property>
85+ <property name="position">1</property>
86 </packing>
87 </child>
88 <child>
89- <object class="GtkHBox" id="hbox_colors_yellow">
90+ <object class="GtkHBox" id="hbox_colors_normal">
91 <property name="visible">True</property>
92 <property name="can_focus">False</property>
93 <child>
94- <object class="GtkColorButton" id="colorbutton_yellow">
95+ <object class="GtkColorButton" id="colorbutton_normal">
96 <property name="use_action_appearance">False</property>
97 <property name="visible">True</property>
98 <property name="can_focus">True</property>
99 <property name="receives_default">True</property>
100 <property name="use_action_appearance">False</property>
101- <signal name="color-set" handler="on_prefs_colorbutton_yellow_changed" swapped="no"/>
102+ <signal name="color-set" handler="on_prefs_colorbutton_normal_changed" swapped="no"/>
103 </object>
104 <packing>
105 <property name="expand">False</property>
106@@ -171,7 +209,7 @@
107 <object class="GtkLabel" id="label6">
108 <property name="visible">True</property>
109 <property name="can_focus">False</property>
110- <property name="label" translatable="yes">Should work on it</property>
111+ <property name="label" translatable="yes">Normal</property>
112 </object>
113 <packing>
114 <property name="expand">True</property>
115@@ -183,21 +221,21 @@
116 <packing>
117 <property name="expand">False</property>
118 <property name="fill">True</property>
119- <property name="position">1</property>
120+ <property name="position">2</property>
121 </packing>
122 </child>
123 <child>
124- <object class="GtkHBox" id="hbox_colors_green">
125+ <object class="GtkHBox" id="hbox_colors_low">
126 <property name="visible">True</property>
127 <property name="can_focus">False</property>
128 <child>
129- <object class="GtkColorButton" id="colorbutton_green">
130+ <object class="GtkColorButton" id="colorbutton_low">
131 <property name="use_action_appearance">False</property>
132 <property name="visible">True</property>
133 <property name="can_focus">True</property>
134 <property name="receives_default">True</property>
135 <property name="use_action_appearance">False</property>
136- <signal name="color-set" handler="on_prefs_colorbutton_green_changed" swapped="no"/>
137+ <signal name="color-set" handler="on_prefs_colorbutton_low_changed" swapped="no"/>
138 </object>
139 <packing>
140 <property name="expand">False</property>
141@@ -209,7 +247,7 @@
142 <object class="GtkLabel" id="label7">
143 <property name="visible">True</property>
144 <property name="can_focus">False</property>
145- <property name="label" translatable="yes">Don't worry about it</property>
146+ <property name="label" translatable="yes">Low</property>
147 </object>
148 <packing>
149 <property name="expand">True</property>
150@@ -221,7 +259,7 @@
151 <packing>
152 <property name="expand">False</property>
153 <property name="fill">True</property>
154- <property name="position">2</property>
155+ <property name="position">3</property>
156 </packing>
157 </child>
158 </object>
159@@ -232,7 +270,7 @@
160 <object class="GtkLabel" id="label2">
161 <property name="visible">True</property>
162 <property name="can_focus">False</property>
163- <property name="label" translatable="yes">&lt;b&gt;Colors&lt;/b&gt;</property>
164+ <property name="label" translatable="yes">&lt;b&gt;Urgency level color&lt;/b&gt;</property>
165 <property name="use_markup">True</property>
166 </object>
167 </child>
168
169=== modified file 'GTG/plugins/urgency_color/urgency_color.py'
170--- GTG/plugins/urgency_color/urgency_color.py 2012-05-02 08:49:19 +0000
171+++ GTG/plugins/urgency_color/urgency_color.py 2012-07-13 17:03:24 +0000
172@@ -26,9 +26,10 @@
173 PLUGIN_NAME = 'Urgency Color'
174 DEFAULT_PREFS = {
175 'reddays': 30,
176- 'color_green': '#cfff84',
177- 'color_yellow': '#ffed84',
178- 'color_red': '#ff9784'}
179+ 'color_low': '#cfff84',
180+ 'color_normal': '#ffed84',
181+ 'color_high': '#ff9784',
182+ 'color_overdue': '#b8b8b8'}
183
184 def __init__(self):
185 self._plugin_api = None
186@@ -41,15 +42,20 @@
187 self.prefs_load()
188 self.prefs_init()
189 # Set color function
190+ self._refresh_task_color()
191+
192+ def _refresh_task_color(self):
193 self._plugin_api.set_bgcolor_func(self.bgcolor)
194
195 def _get_color(self, colindex):
196 if colindex == 0:
197- return self._pref_data['color_green']
198+ return self._pref_data['color_low']
199 elif colindex == 1:
200- return self._pref_data['color_yellow']
201+ return self._pref_data['color_normal']
202 elif colindex == 2:
203- return self._pref_data['color_red']
204+ return self._pref_data['color_high']
205+ elif colindex == 3:
206+ return self._pref_data['color_overdue']
207 else:
208 return None
209
210@@ -67,6 +73,8 @@
211 color = 1
212 if daysleft <= reddays:
213 color = 2
214+ if daysleft < 0:
215+ color = 3
216 # This list should be implemented in the settings
217 #print "Giving color"
218 return self._get_color(color)
219@@ -106,14 +114,17 @@
220 # Spin button
221 self.spinbutton_reddays = self.builder.get_object('spinbutton_reddays')
222
223- # Colorbutton - RED
224- self.colorbutton_red = self.builder.get_object('colorbutton_red')
225-
226- # Colorbutton - YELLOW
227- self.colorbutton_yellow = self.builder.get_object('colorbutton_yellow')
228-
229- # Colorbutton - GREEN
230- self.colorbutton_green = self.builder.get_object('colorbutton_green')
231+ # Colorbutton - OVERDUE
232+ self.colorbutton_overdue = self.builder.get_object('colorbutton_overdue')
233+
234+ # Colorbutton - HIGH
235+ self.colorbutton_high = self.builder.get_object('colorbutton_high')
236+
237+ # Colorbutton - NORMAL
238+ self.colorbutton_normal = self.builder.get_object('colorbutton_normal')
239+
240+ # Colorbutton - LOW
241+ self.colorbutton_low = self.builder.get_object('colorbutton_low')
242
243 # Buttons
244 self.button_apply = self.builder.get_object('button_apply')
245@@ -132,27 +143,32 @@
246 self.on_prefs_reset,
247 'on_prefs_spinbutton_reddays_changed':
248 self.on_prefs_spinbutton_reddays_changed,
249- 'on_prefs_colorbutton_red_changed':
250- self.on_prefs_colorbutton_red_changed,
251- 'on_prefs_colorbutton_yellow_changed':
252- self.on_prefs_colorbutton_yellow_changed,
253- 'on_prefs_colorbutton_green_changed':
254- self.on_prefs_colorbutton_green_changed}
255+ 'on_prefs_colorbutton_overdue_changed':
256+ self.on_prefs_colorbutton_overdue_changed,
257+ 'on_prefs_colorbutton_high_changed':
258+ self.on_prefs_colorbutton_high_changed,
259+ 'on_prefs_colorbutton_normal_changed':
260+ self.on_prefs_colorbutton_normal_changed,
261+ 'on_prefs_colorbutton_low_changed':
262+ self.on_prefs_colorbutton_low_changed}
263 self.builder.connect_signals(SIGNAL_CONNECTIONS_DIC)
264
265 def prefs_update_widgets(self):
266 """ Synchronizes the widgets with the data in _pref_data """
267 # Spin button
268 self.spinbutton_reddays.set_value(self._pref_data['reddays'])
269- # Colorbutton - RED
270- self.colorbutton_red.set_color( \
271- gtk.gdk.color_parse(self._pref_data['color_red']))
272- # Colorbutton - YELLOW
273- self.colorbutton_yellow.set_color( \
274- gtk.gdk.color_parse(self._pref_data['color_yellow']))
275- # Colorbutton - GREEN
276- self.colorbutton_green.set_color( \
277- gtk.gdk.color_parse(self._pref_data['color_green']))
278+ # Colorbutton - OVERDUE
279+ self.colorbutton_overdue.set_color( \
280+ gtk.gdk.color_parse(self._pref_data['color_overdue']))
281+ # Colorbutton - HIGH
282+ self.colorbutton_high.set_color( \
283+ gtk.gdk.color_parse(self._pref_data['color_high']))
284+ # Colorbutton - NORMAL
285+ self.colorbutton_normal.set_color( \
286+ gtk.gdk.color_parse(self._pref_data['color_normal']))
287+ # Colorbutton - LOW
288+ self.colorbutton_low.set_color( \
289+ gtk.gdk.color_parse(self._pref_data['color_low']))
290
291 def on_prefs_cancel(self, widget=None, data=None):
292 self.prefs_update_widgets()
293@@ -162,6 +178,7 @@
294 def on_prefs_apply(self, widget=None, data=None):
295 self._pref_data = self._pref_data_potential
296 self.prefs_store()
297+ self._refresh_task_color()
298 self.prefs_window.hide()
299
300 def on_prefs_reset(self, widget=None, data=None):
301@@ -176,7 +193,21 @@
302 if not data or not isinstance(data, dict):
303 self._pref_data = dict(self.DEFAULT_PREFS)
304 else:
305- self._pref_data = data
306+ # CORRECT NAMES FROM OLD PREFERENCES
307+ # This is a dirty fix and thus should be removed in a
308+ # distant future, when nobody has "red", "yellow" or "green"
309+ # settings
310+ namepairs = {'red':'high','yellow':'normal','green':'low'}
311+ for key,val in data.iteritems():
312+ for oldname,newname in namepairs.iteritems():
313+ if key == "color_"+oldname:
314+ data['color_'+newname] = data.pop(key)
315+ # Add new preferences where not present
316+ for setting in self.DEFAULT_PREFS.iterkeys():
317+ if setting not in data:
318+ data[setting] = self.DEFAULT_PREFS[setting]
319+ self._pref_data = dict(data)
320+
321
322 def prefs_store(self):
323 self._plugin_api.save_configuration_object( \
324@@ -188,14 +219,18 @@
325 self._pref_data_potential['reddays'] = \
326 self.spinbutton_reddays.get_value()
327
328- def on_prefs_colorbutton_red_changed(self, widget=None, data=None):
329- self._pref_data_potential['color_red'] = \
330- self.colorbutton_red.get_color().to_string()
331-
332- def on_prefs_colorbutton_yellow_changed(self, widget=None, data=None):
333- self._pref_data_potential['color_yellow'] = \
334- self.colorbutton_yellow.get_color().to_string()
335-
336- def on_prefs_colorbutton_green_changed(self, widget=None, data=None):
337- self._pref_data_potential['color_green'] = \
338- self.colorbutton_green.get_color().to_string()
339+ def on_prefs_colorbutton_overdue_changed(self, widget=None, data=None):
340+ self._pref_data_potential['color_overdue'] = \
341+ self.colorbutton_overdue.get_color().to_string()
342+
343+ def on_prefs_colorbutton_high_changed(self, widget=None, data=None):
344+ self._pref_data_potential['color_high'] = \
345+ self.colorbutton_high.get_color().to_string()
346+
347+ def on_prefs_colorbutton_normal_changed(self, widget=None, data=None):
348+ self._pref_data_potential['color_normal'] = \
349+ self.colorbutton_normal.get_color().to_string()
350+
351+ def on_prefs_colorbutton_low_changed(self, widget=None, data=None):
352+ self._pref_data_potential['color_low'] = \
353+ self.colorbutton_low.get_color().to_string()

Subscribers

People subscribed via source and target branches

to status/vote changes: