GTG

Merge lp:~abhiram-ampabathina/gtg/gtg into lp:~gtg/gtg/old-trunk

Proposed by Abhiram
Status: Merged
Merged at revision: 1221
Proposed branch: lp:~abhiram-ampabathina/gtg/gtg
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 244 lines (+101/-26)
4 files modified
GTG/core/__init__.py (+1/-0)
GTG/gtk/editor/editor.py (+7/-3)
GTG/gtk/preferences.glade (+84/-21)
GTG/gtk/preferences.py (+9/-2)
To merge this branch: bzr merge lp:~abhiram-ampabathina/gtg/gtg
Reviewer Review Type Date Requested Status
Izidor Matušov code, running Approve
Review via email: mp+118239@code.launchpad.net

Commit message

Commit for the bug/feature : "Preferences for fonts in editor"

Description of the change

Hello,
         I have tried and fixed the feature "preferences for fonts in editor". I followed the exact same description at the bug description. Review it for merging. Code worked for me fine without crashing.

Thank you

Best,
Abhiram

To post a comment you must log in.
Revision history for this message
Izidor Matušov (izidor) wrote :

Hi Abhiram,

the code works for me! Congratulation. I have some nitpicking to do:

* Please, set the default font to the current one. If users don't want to change the font, they use the same font as until now. Look at the difference: http://i.imgur.com/0jsqR.png

* Put before font selecting widget description, something like "Font: "

* I found a small glitch:
1, Open GTG and set a new font in the preferences
2, Restart GTG
3, Open the preferences dialog -> there is the default font (Sans 12) instead of my font.

* It would be nice to change the name of the font button widget from fontbutton1 into fontbutton

* You added import pygtk twice. I think you can remove it and it should still work.

* Change "config1" into something like "browser_config" ? Maybe even better would be to store that configuration in the editor configuration.

You are doing good work and improving your hacking skills. Keep working and it will be easier :)

review: Needs Fixing (code, running)
lp:~abhiram-ampabathina/gtg/gtg updated
1227. By Abhiram

Changed some nitpicking

1228. By Abhiram

Changed some nitpicking

Revision history for this message
Abhiram (abhiram-ampabathina) wrote :

> Hi Abhiram,
>
> the code works for me! Congratulation. I have some nitpicking to do:
>
> * Please, set the default font to the current one. If users don't want to
> change the font, they use the same font as until now. Look at the difference:
> http://i.imgur.com/0jsqR.png
>
> * Put before font selecting widget description, something like "Font: "
>
> * I found a small glitch:
> 1, Open GTG and set a new font in the preferences
> 2, Restart GTG
> 3, Open the preferences dialog -> there is the default font (Sans 12) instead
> of my font.
>
> * It would be nice to change the name of the font button widget from
> fontbutton1 into fontbutton
>
> * You added import pygtk twice. I think you can remove it and it should still
> work.
>
> * Change "config1" into something like "browser_config" ? Maybe even better
> would be to store that configuration in the editor configuration.
>
> You are doing good work and improving your hacking skills. Keep working and it
> will be easier :)

Hello izidor,
      Thank you. I have made all the changes including the "Retaining of the font selection after restarting". I request you to carry out the review again.

Best,
Abhiram

lp:~abhiram-ampabathina/gtg/gtg updated
1229. By Abhiram

Changed some nitpicking

1230. By Abhiram

Changed some nitpicking

1231. By Abhiram

changed the important code for preferences font

1232. By Abhiram

added the default value to fontbutton

1233. By Abhiram

made code sexier

1234. By Abhiram

made code sexier

1235. By Abhiram

removed some part

1236. By Abhiram

 some changes

1237. By Abhiram

 some changes

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

I merged with few modifications.

review: Approve (code, running)
Revision history for this message
Abhiram (abhiram-ampabathina) wrote :

Hello izidor,
     I see that you have merged the code. What are the modifications that you made? Are they big one? You might have suggested me. I might have tried them too. Any way, thankyou. I am gonna keep hacking.

Best,
Abhiram

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/core/__init__.py'
2--- GTG/core/__init__.py 2012-07-24 17:42:59 +0000
3+++ GTG/core/__init__.py 2012-08-07 16:07:26 +0000
4@@ -65,6 +65,7 @@
5 'y_pos': 10,
6 'tasklist_sort_column': 5,
7 'tasklist_sort_order': 1,
8+ "font_name": ""
9 },
10 'tag_editor': {
11 "custom_colors": [],
12
13=== modified file 'GTG/gtk/editor/editor.py'
14--- GTG/gtk/editor/editor.py 2012-07-20 09:39:42 +0000
15+++ GTG/gtk/editor/editor.py 2012-08-07 16:07:26 +0000
16@@ -24,7 +24,7 @@
17 The rest is the logic of the widget: date changing widgets, buttons, ...
18 """
19 import time
20-
21+import pango
22 import gtk
23
24 from GTG import _, ngettext
25@@ -51,8 +51,9 @@
26 taskconfig is a ConfigObj dic to save infos about tasks
27 thisisnew is True when a new task is created and opened
28 '''
29- self.req = requester
30- self.vmanager = vmanager
31+ self.req = requester
32+ self.browser_config = self.req.get_config('browser')
33+ self.vmanager = vmanager
34 self.config = taskconfig
35 self.time = None
36 self.clipboard = clipboard
37@@ -102,6 +103,9 @@
38 self.textview.set_left_margin(7)
39 self.textview.set_right_margin(5)
40 scrolled.add(self.textview)
41+ conf_font_value = self.browser_config.get("font_name")
42+ if(conf_font_value!= "" ):
43+ self.textview.modify_font(pango.FontDescription(conf_font_value) )
44 #Voila! it's done
45 self.calendar = GTGCalendar(self.builder)
46 self.duedate_widget = self.builder.get_object("duedate_entry")
47
48=== modified file 'GTG/gtk/preferences.glade'
49--- GTG/gtk/preferences.glade 2012-07-13 17:24:28 +0000
50+++ GTG/gtk/preferences.glade 2012-08-07 16:07:26 +0000
51@@ -1,7 +1,6 @@
52 <?xml version="1.0" encoding="UTF-8"?>
53 <interface>
54 <requires lib="gtk+" version="2.16"/>
55- <!-- interface-naming-policy toplevel-contextual -->
56 <object class="GtkDialog" id="PreferencesDialog">
57 <property name="can_focus">False</property>
58 <property name="border_width">3</property>
59@@ -9,7 +8,7 @@
60 <property name="type_hint">dialog</property>
61 <signal name="delete-event" handler="on_PreferencesDialog_delete_event" swapped="no"/>
62 <child internal-child="vbox">
63- <object class="GtkVBox" id="prefs-vbox1">
64+ <object class="GtkBox" id="prefs-vbox1">
65 <property name="visible">True</property>
66 <property name="can_focus">False</property>
67 <child>
68@@ -71,7 +70,7 @@
69 <packing>
70 <property name="expand">False</property>
71 <property name="fill">True</property>
72- <property name="position">1</property>
73+ <property name="position">0</property>
74 </packing>
75 </child>
76 <child>
77@@ -91,6 +90,23 @@
78 <property name="visible">True</property>
79 <property name="can_focus">False</property>
80 <child>
81+ <object class="GtkCheckButton" id="bg_color_enable">
82+ <property name="label" translatable="yes">Enable colored backgrounds in the task list</property>
83+ <property name="visible">True</property>
84+ <property name="can_focus">True</property>
85+ <property name="receives_default">False</property>
86+ <property name="use_action_appearance">False</property>
87+ <property name="draw_indicator">True</property>
88+ <signal name="toggled" handler="on_bg_color_toggled" swapped="no"/>
89+ </object>
90+ <packing>
91+ <property name="expand">False</property>
92+ <property name="fill">True</property>
93+ <property name="padding">3</property>
94+ <property name="position">0</property>
95+ </packing>
96+ </child>
97+ <child>
98 <object class="GtkCheckButton" id="pref_show_preview">
99 <property name="label" translatable="yes">Show description preview in the task list.</property>
100 <property name="visible">True</property>
101@@ -104,23 +120,6 @@
102 <property name="expand">False</property>
103 <property name="fill">True</property>
104 <property name="padding">3</property>
105- <property name="position">0</property>
106- </packing>
107- </child>
108- <child>
109- <object class="GtkCheckButton" id="bg_color_enable">
110- <property name="label" translatable="yes">Enable colored backgrounds in the task list</property>
111- <property name="visible">True</property>
112- <property name="can_focus">True</property>
113- <property name="receives_default">False</property>
114- <property name="use_action_appearance">False</property>
115- <property name="draw_indicator">True</property>
116- <signal name="toggled" handler="on_bg_color_toggled" swapped="no"/>
117- </object>
118- <packing>
119- <property name="expand">False</property>
120- <property name="fill">True</property>
121- <property name="padding">3</property>
122 <property name="position">1</property>
123 </packing>
124 </child>
125@@ -141,6 +140,70 @@
126 <packing>
127 <property name="expand">False</property>
128 <property name="fill">True</property>
129+ <property name="position">1</property>
130+ </packing>
131+ </child>
132+ <child>
133+ <object class="GtkFrame" id="frame1">
134+ <property name="visible">True</property>
135+ <property name="can_focus">False</property>
136+ <property name="label_xalign">0</property>
137+ <property name="shadow_type">none</property>
138+ <child>
139+ <object class="GtkAlignment" id="prefs-alignment1">
140+ <property name="visible">True</property>
141+ <property name="can_focus">False</property>
142+ <property name="yalign">0.50999999046325684</property>
143+ <property name="bottom_padding">15</property>
144+ <property name="left_padding">12</property>
145+ <child>
146+ <object class="GtkHBox" id="prefs-vbox4">
147+ <property name="visible">True</property>
148+ <property name="can_focus">False</property>
149+ <child>
150+ <object class="GtkLabel" id="label5">
151+ <property name="visible">True</property>
152+ <property name="can_focus">False</property>
153+ <property name="label" translatable="yes">Font :</property>
154+ </object>
155+ <packing>
156+ <property name="expand">False</property>
157+ <property name="fill">False</property>
158+ <property name="position">0</property>
159+ </packing>
160+ </child>
161+ <child>
162+ <object class="GtkFontButton" id="fontbutton">
163+ <property name="visible">True</property>
164+ <property name="can_focus">False</property>
165+ <property name="receives_default">False</property>
166+ <property name="use_action_appearance">False</property>
167+ <signal name="font-set" handler="on_fontbutton_font_set" swapped="no"/>
168+ </object>
169+ <packing>
170+ <property name="expand">True</property>
171+ <property name="fill">True</property>
172+ <property name="padding">5</property>
173+ <property name="pack_type">end</property>
174+ <property name="position">1</property>
175+ </packing>
176+ </child>
177+ </object>
178+ </child>
179+ </object>
180+ </child>
181+ <child type="label">
182+ <object class="GtkLabel" id="label1">
183+ <property name="visible">True</property>
184+ <property name="can_focus">False</property>
185+ <property name="label" translatable="yes">&lt;b&gt;Editor&lt;/b&gt;</property>
186+ <property name="use_markup">True</property>
187+ </object>
188+ </child>
189+ </object>
190+ <packing>
191+ <property name="expand">True</property>
192+ <property name="fill">True</property>
193 <property name="position">2</property>
194 </packing>
195 </child>
196@@ -192,7 +255,7 @@
197 </packing>
198 </child>
199 <child internal-child="action_area">
200- <object class="GtkHButtonBox" id="prefs-action_area">
201+ <object class="GtkButtonBox" id="prefs-action_area">
202 <property name="visible">True</property>
203 <property name="can_focus">False</property>
204 <property name="layout_style">end</property>
205
206=== modified file 'GTG/gtk/preferences.py'
207--- GTG/gtk/preferences.py 2012-07-13 17:24:28 +0000
208+++ GTG/gtk/preferences.py 2012-08-07 16:07:26 +0000
209@@ -18,7 +18,6 @@
210 # -----------------------------------------------------------------------------
211
212 """ The Preferences Dialog for configuring GTG """
213-
214 import os
215 import shutil
216
217@@ -81,7 +80,11 @@
218 self.pref_autostart = builder.get_object("pref_autostart")
219 self.pref_show_preview = builder.get_object("pref_show_preview")
220 self.bg_color_enable = builder.get_object("bg_color_enable")
221-
222+ self.fontbutton = builder.get_object("fontbutton")
223+ style = self.dialog.get_style()
224+ check_style = self.config.get("font_name")
225+ if(check_style!=""):
226+ self.fontbutton.set_font_name(check_style)
227 builder.connect_signals({
228 'on_pref_autostart_toggled':
229 self.on_autostart_toggled,
230@@ -95,6 +98,8 @@
231 self.on_close,
232 'on_PreferencesDialog_delete_event':
233 self.on_close,
234+ 'on_fontbutton_font_set':
235+ self.on_font_change,
236 })
237
238 def _refresh_preferences_store(self):
239@@ -149,3 +154,5 @@
240 if curstate != widget.get_active():
241 self.config.set("bg_color_enable", not curstate)
242 self._refresh_task_browser()
243+ def on_font_change(self,widget):
244+ self.config.set("font_name", self.fontbutton.get_font_name())

Subscribers

People subscribed via source and target branches

to status/vote changes: