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
=== modified file 'GTG/plugins/urgency_color/preferences.ui'
--- GTG/plugins/urgency_color/preferences.ui 2012-03-05 15:23:05 +0000
+++ GTG/plugins/urgency_color/preferences.ui 2012-07-13 17:03:24 +0000
@@ -111,17 +111,55 @@
111 <property name="can_focus">False</property>111 <property name="can_focus">False</property>
112 <property name="spacing">5</property>112 <property name="spacing">5</property>
113 <child>113 <child>
114 <object class="GtkHBox" id="hbox_colors_red">114 <object class="GtkHBox" id="hbox_colors_overdue">
115 <property name="visible">True</property>115 <property name="visible">True</property>
116 <property name="can_focus">False</property>116 <property name="can_focus">False</property>
117 <child>117 <child>
118 <object class="GtkColorButton" id="colorbutton_red">118 <object class="GtkColorButton" id="colorbutton_overdue">
119 <property name="use_action_appearance">False</property>119 <property name="use_action_appearance">False</property>
120 <property name="visible">True</property>120 <property name="visible">True</property>
121 <property name="can_focus">True</property>121 <property name="can_focus">True</property>
122 <property name="receives_default">True</property>122 <property name="receives_default">True</property>
123 <property name="use_action_appearance">False</property>123 <property name="use_action_appearance">False</property>
124 <signal name="color-set" handler="on_prefs_colorbutton_red_changed" swapped="no"/>124 <signal name="color-set" handler="on_prefs_colorbutton_overdue_changed" swapped="no"/>
125 </object>
126 <packing>
127 <property name="expand">False</property>
128 <property name="fill">True</property>
129 <property name="position">0</property>
130 </packing>
131 </child>
132 <child>
133 <object class="GtkLabel" id="label20">
134 <property name="visible">True</property>
135 <property name="can_focus">False</property>
136 <property name="label" translatable="yes">Overdue</property>
137 </object>
138 <packing>
139 <property name="expand">True</property>
140 <property name="fill">True</property>
141 <property name="position">1</property>
142 </packing>
143 </child>
144 </object>
145 <packing>
146 <property name="expand">False</property>
147 <property name="fill">True</property>
148 <property name="position">0</property>
149 </packing>
150 </child>
151 <child>
152 <object class="GtkHBox" id="hbox_colors_high">
153 <property name="visible">True</property>
154 <property name="can_focus">False</property>
155 <child>
156 <object class="GtkColorButton" id="colorbutton_high">
157 <property name="use_action_appearance">False</property>
158 <property name="visible">True</property>
159 <property name="can_focus">True</property>
160 <property name="receives_default">True</property>
161 <property name="use_action_appearance">False</property>
162 <signal name="color-set" handler="on_prefs_colorbutton_high_changed" swapped="no"/>
125 </object>163 </object>
126 <packing>164 <packing>
127 <property name="expand">False</property>165 <property name="expand">False</property>
@@ -133,7 +171,7 @@
133 <object class="GtkLabel" id="label5">171 <object class="GtkLabel" id="label5">
134 <property name="visible">True</property>172 <property name="visible">True</property>
135 <property name="can_focus">False</property>173 <property name="can_focus">False</property>
136 <property name="label" translatable="yes">In danger zone</property>174 <property name="label" translatable="yes">High</property>
137 </object>175 </object>
138 <packing>176 <packing>
139 <property name="expand">True</property>177 <property name="expand">True</property>
@@ -145,21 +183,21 @@
145 <packing>183 <packing>
146 <property name="expand">False</property>184 <property name="expand">False</property>
147 <property name="fill">True</property>185 <property name="fill">True</property>
148 <property name="position">0</property>186 <property name="position">1</property>
149 </packing>187 </packing>
150 </child>188 </child>
151 <child>189 <child>
152 <object class="GtkHBox" id="hbox_colors_yellow">190 <object class="GtkHBox" id="hbox_colors_normal">
153 <property name="visible">True</property>191 <property name="visible">True</property>
154 <property name="can_focus">False</property>192 <property name="can_focus">False</property>
155 <child>193 <child>
156 <object class="GtkColorButton" id="colorbutton_yellow">194 <object class="GtkColorButton" id="colorbutton_normal">
157 <property name="use_action_appearance">False</property>195 <property name="use_action_appearance">False</property>
158 <property name="visible">True</property>196 <property name="visible">True</property>
159 <property name="can_focus">True</property>197 <property name="can_focus">True</property>
160 <property name="receives_default">True</property>198 <property name="receives_default">True</property>
161 <property name="use_action_appearance">False</property>199 <property name="use_action_appearance">False</property>
162 <signal name="color-set" handler="on_prefs_colorbutton_yellow_changed" swapped="no"/>200 <signal name="color-set" handler="on_prefs_colorbutton_normal_changed" swapped="no"/>
163 </object>201 </object>
164 <packing>202 <packing>
165 <property name="expand">False</property>203 <property name="expand">False</property>
@@ -171,7 +209,7 @@
171 <object class="GtkLabel" id="label6">209 <object class="GtkLabel" id="label6">
172 <property name="visible">True</property>210 <property name="visible">True</property>
173 <property name="can_focus">False</property>211 <property name="can_focus">False</property>
174 <property name="label" translatable="yes">Should work on it</property>212 <property name="label" translatable="yes">Normal</property>
175 </object>213 </object>
176 <packing>214 <packing>
177 <property name="expand">True</property>215 <property name="expand">True</property>
@@ -183,21 +221,21 @@
183 <packing>221 <packing>
184 <property name="expand">False</property>222 <property name="expand">False</property>
185 <property name="fill">True</property>223 <property name="fill">True</property>
186 <property name="position">1</property>224 <property name="position">2</property>
187 </packing>225 </packing>
188 </child>226 </child>
189 <child>227 <child>
190 <object class="GtkHBox" id="hbox_colors_green">228 <object class="GtkHBox" id="hbox_colors_low">
191 <property name="visible">True</property>229 <property name="visible">True</property>
192 <property name="can_focus">False</property>230 <property name="can_focus">False</property>
193 <child>231 <child>
194 <object class="GtkColorButton" id="colorbutton_green">232 <object class="GtkColorButton" id="colorbutton_low">
195 <property name="use_action_appearance">False</property>233 <property name="use_action_appearance">False</property>
196 <property name="visible">True</property>234 <property name="visible">True</property>
197 <property name="can_focus">True</property>235 <property name="can_focus">True</property>
198 <property name="receives_default">True</property>236 <property name="receives_default">True</property>
199 <property name="use_action_appearance">False</property>237 <property name="use_action_appearance">False</property>
200 <signal name="color-set" handler="on_prefs_colorbutton_green_changed" swapped="no"/>238 <signal name="color-set" handler="on_prefs_colorbutton_low_changed" swapped="no"/>
201 </object>239 </object>
202 <packing>240 <packing>
203 <property name="expand">False</property>241 <property name="expand">False</property>
@@ -209,7 +247,7 @@
209 <object class="GtkLabel" id="label7">247 <object class="GtkLabel" id="label7">
210 <property name="visible">True</property>248 <property name="visible">True</property>
211 <property name="can_focus">False</property>249 <property name="can_focus">False</property>
212 <property name="label" translatable="yes">Don't worry about it</property>250 <property name="label" translatable="yes">Low</property>
213 </object>251 </object>
214 <packing>252 <packing>
215 <property name="expand">True</property>253 <property name="expand">True</property>
@@ -221,7 +259,7 @@
221 <packing>259 <packing>
222 <property name="expand">False</property>260 <property name="expand">False</property>
223 <property name="fill">True</property>261 <property name="fill">True</property>
224 <property name="position">2</property>262 <property name="position">3</property>
225 </packing>263 </packing>
226 </child>264 </child>
227 </object>265 </object>
@@ -232,7 +270,7 @@
232 <object class="GtkLabel" id="label2">270 <object class="GtkLabel" id="label2">
233 <property name="visible">True</property>271 <property name="visible">True</property>
234 <property name="can_focus">False</property>272 <property name="can_focus">False</property>
235 <property name="label" translatable="yes">&lt;b&gt;Colors&lt;/b&gt;</property>273 <property name="label" translatable="yes">&lt;b&gt;Urgency level color&lt;/b&gt;</property>
236 <property name="use_markup">True</property>274 <property name="use_markup">True</property>
237 </object>275 </object>
238 </child>276 </child>
239277
=== modified file 'GTG/plugins/urgency_color/urgency_color.py'
--- GTG/plugins/urgency_color/urgency_color.py 2012-05-02 08:49:19 +0000
+++ GTG/plugins/urgency_color/urgency_color.py 2012-07-13 17:03:24 +0000
@@ -26,9 +26,10 @@
26 PLUGIN_NAME = 'Urgency Color'26 PLUGIN_NAME = 'Urgency Color'
27 DEFAULT_PREFS = {27 DEFAULT_PREFS = {
28 'reddays': 30,28 'reddays': 30,
29 'color_green': '#cfff84',29 'color_low': '#cfff84',
30 'color_yellow': '#ffed84',30 'color_normal': '#ffed84',
31 'color_red': '#ff9784'}31 'color_high': '#ff9784',
32 'color_overdue': '#b8b8b8'}
3233
33 def __init__(self):34 def __init__(self):
34 self._plugin_api = None35 self._plugin_api = None
@@ -41,15 +42,20 @@
41 self.prefs_load()42 self.prefs_load()
42 self.prefs_init()43 self.prefs_init()
43 # Set color function44 # Set color function
45 self._refresh_task_color()
46
47 def _refresh_task_color(self):
44 self._plugin_api.set_bgcolor_func(self.bgcolor)48 self._plugin_api.set_bgcolor_func(self.bgcolor)
4549
46 def _get_color(self, colindex):50 def _get_color(self, colindex):
47 if colindex == 0:51 if colindex == 0:
48 return self._pref_data['color_green']52 return self._pref_data['color_low']
49 elif colindex == 1:53 elif colindex == 1:
50 return self._pref_data['color_yellow']54 return self._pref_data['color_normal']
51 elif colindex == 2:55 elif colindex == 2:
52 return self._pref_data['color_red']56 return self._pref_data['color_high']
57 elif colindex == 3:
58 return self._pref_data['color_overdue']
53 else:59 else:
54 return None60 return None
5561
@@ -67,6 +73,8 @@
67 color = 173 color = 1
68 if daysleft <= reddays:74 if daysleft <= reddays:
69 color = 275 color = 2
76 if daysleft < 0:
77 color = 3
70 # This list should be implemented in the settings78 # This list should be implemented in the settings
71 #print "Giving color"79 #print "Giving color"
72 return self._get_color(color)80 return self._get_color(color)
@@ -106,14 +114,17 @@
106 # Spin button114 # Spin button
107 self.spinbutton_reddays = self.builder.get_object('spinbutton_reddays')115 self.spinbutton_reddays = self.builder.get_object('spinbutton_reddays')
108116
109 # Colorbutton - RED117 # Colorbutton - OVERDUE
110 self.colorbutton_red = self.builder.get_object('colorbutton_red')118 self.colorbutton_overdue = self.builder.get_object('colorbutton_overdue')
111119
112 # Colorbutton - YELLOW120 # Colorbutton - HIGH
113 self.colorbutton_yellow = self.builder.get_object('colorbutton_yellow')121 self.colorbutton_high = self.builder.get_object('colorbutton_high')
114122
115 # Colorbutton - GREEN123 # Colorbutton - NORMAL
116 self.colorbutton_green = self.builder.get_object('colorbutton_green')124 self.colorbutton_normal = self.builder.get_object('colorbutton_normal')
125
126 # Colorbutton - LOW
127 self.colorbutton_low = self.builder.get_object('colorbutton_low')
117128
118 # Buttons129 # Buttons
119 self.button_apply = self.builder.get_object('button_apply')130 self.button_apply = self.builder.get_object('button_apply')
@@ -132,27 +143,32 @@
132 self.on_prefs_reset,143 self.on_prefs_reset,
133 'on_prefs_spinbutton_reddays_changed':144 'on_prefs_spinbutton_reddays_changed':
134 self.on_prefs_spinbutton_reddays_changed,145 self.on_prefs_spinbutton_reddays_changed,
135 'on_prefs_colorbutton_red_changed':146 'on_prefs_colorbutton_overdue_changed':
136 self.on_prefs_colorbutton_red_changed,147 self.on_prefs_colorbutton_overdue_changed,
137 'on_prefs_colorbutton_yellow_changed':148 'on_prefs_colorbutton_high_changed':
138 self.on_prefs_colorbutton_yellow_changed,149 self.on_prefs_colorbutton_high_changed,
139 'on_prefs_colorbutton_green_changed':150 'on_prefs_colorbutton_normal_changed':
140 self.on_prefs_colorbutton_green_changed}151 self.on_prefs_colorbutton_normal_changed,
152 'on_prefs_colorbutton_low_changed':
153 self.on_prefs_colorbutton_low_changed}
141 self.builder.connect_signals(SIGNAL_CONNECTIONS_DIC)154 self.builder.connect_signals(SIGNAL_CONNECTIONS_DIC)
142155
143 def prefs_update_widgets(self):156 def prefs_update_widgets(self):
144 """ Synchronizes the widgets with the data in _pref_data """157 """ Synchronizes the widgets with the data in _pref_data """
145 # Spin button158 # Spin button
146 self.spinbutton_reddays.set_value(self._pref_data['reddays'])159 self.spinbutton_reddays.set_value(self._pref_data['reddays'])
147 # Colorbutton - RED160 # Colorbutton - OVERDUE
148 self.colorbutton_red.set_color( \161 self.colorbutton_overdue.set_color( \
149 gtk.gdk.color_parse(self._pref_data['color_red']))162 gtk.gdk.color_parse(self._pref_data['color_overdue']))
150 # Colorbutton - YELLOW163 # Colorbutton - HIGH
151 self.colorbutton_yellow.set_color( \164 self.colorbutton_high.set_color( \
152 gtk.gdk.color_parse(self._pref_data['color_yellow']))165 gtk.gdk.color_parse(self._pref_data['color_high']))
153 # Colorbutton - GREEN166 # Colorbutton - NORMAL
154 self.colorbutton_green.set_color( \167 self.colorbutton_normal.set_color( \
155 gtk.gdk.color_parse(self._pref_data['color_green']))168 gtk.gdk.color_parse(self._pref_data['color_normal']))
169 # Colorbutton - LOW
170 self.colorbutton_low.set_color( \
171 gtk.gdk.color_parse(self._pref_data['color_low']))
156172
157 def on_prefs_cancel(self, widget=None, data=None):173 def on_prefs_cancel(self, widget=None, data=None):
158 self.prefs_update_widgets()174 self.prefs_update_widgets()
@@ -162,6 +178,7 @@
162 def on_prefs_apply(self, widget=None, data=None):178 def on_prefs_apply(self, widget=None, data=None):
163 self._pref_data = self._pref_data_potential179 self._pref_data = self._pref_data_potential
164 self.prefs_store()180 self.prefs_store()
181 self._refresh_task_color()
165 self.prefs_window.hide()182 self.prefs_window.hide()
166183
167 def on_prefs_reset(self, widget=None, data=None):184 def on_prefs_reset(self, widget=None, data=None):
@@ -176,7 +193,21 @@
176 if not data or not isinstance(data, dict):193 if not data or not isinstance(data, dict):
177 self._pref_data = dict(self.DEFAULT_PREFS)194 self._pref_data = dict(self.DEFAULT_PREFS)
178 else:195 else:
179 self._pref_data = data196 # CORRECT NAMES FROM OLD PREFERENCES
197 # This is a dirty fix and thus should be removed in a
198 # distant future, when nobody has "red", "yellow" or "green"
199 # settings
200 namepairs = {'red':'high','yellow':'normal','green':'low'}
201 for key,val in data.iteritems():
202 for oldname,newname in namepairs.iteritems():
203 if key == "color_"+oldname:
204 data['color_'+newname] = data.pop(key)
205 # Add new preferences where not present
206 for setting in self.DEFAULT_PREFS.iterkeys():
207 if setting not in data:
208 data[setting] = self.DEFAULT_PREFS[setting]
209 self._pref_data = dict(data)
210
180211
181 def prefs_store(self):212 def prefs_store(self):
182 self._plugin_api.save_configuration_object( \213 self._plugin_api.save_configuration_object( \
@@ -188,14 +219,18 @@
188 self._pref_data_potential['reddays'] = \219 self._pref_data_potential['reddays'] = \
189 self.spinbutton_reddays.get_value()220 self.spinbutton_reddays.get_value()
190221
191 def on_prefs_colorbutton_red_changed(self, widget=None, data=None):222 def on_prefs_colorbutton_overdue_changed(self, widget=None, data=None):
192 self._pref_data_potential['color_red'] = \223 self._pref_data_potential['color_overdue'] = \
193 self.colorbutton_red.get_color().to_string()224 self.colorbutton_overdue.get_color().to_string()
194225
195 def on_prefs_colorbutton_yellow_changed(self, widget=None, data=None):226 def on_prefs_colorbutton_high_changed(self, widget=None, data=None):
196 self._pref_data_potential['color_yellow'] = \227 self._pref_data_potential['color_high'] = \
197 self.colorbutton_yellow.get_color().to_string()228 self.colorbutton_high.get_color().to_string()
198229
199 def on_prefs_colorbutton_green_changed(self, widget=None, data=None):230 def on_prefs_colorbutton_normal_changed(self, widget=None, data=None):
200 self._pref_data_potential['color_green'] = \231 self._pref_data_potential['color_normal'] = \
201 self.colorbutton_green.get_color().to_string()232 self.colorbutton_normal.get_color().to_string()
233
234 def on_prefs_colorbutton_low_changed(self, widget=None, data=None):
235 self._pref_data_potential['color_low'] = \
236 self.colorbutton_low.get_color().to_string()

Subscribers

People subscribed via source and target branches

to status/vote changes: