Merge lp:~cr3/checkbox/411526 into lp:checkbox

Proposed by Marc Tardif
Status: Merged
Merged at revision: not available
Proposed branch: lp:~cr3/checkbox/411526
Merge into: lp:checkbox
Diff against target: 88 lines (+39/-3)
3 files modified
checkbox_gtk/gtk_interface.py (+2/-2)
debian/changelog (+1/-0)
gtk/checkbox-gtk.glade (+36/-1)
To merge this branch: bzr merge lp:~cr3/checkbox/411526
Reviewer Review Type Date Requested Status
Javier Collado (community) Approve
Marc Tardif (community) Needs Information
Review via email: mp+14481@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Marc Tardif (cr3) wrote :

This branch was merged by accident. Javier, I would still appreciate your review.

review: Needs Information
Revision history for this message
Javier Collado (javier.collado) wrote :

Hello,

The change looks fine, the only thing that I'd change is the expand property for the upper part of the dialog to false since it takes half the available space otherwise (I don't know why, but it still takes more space than strictly needed).

Regarding the horizontal scrollbar. I tried to use a really long test suite description and it wasn't wrapped to the next line, but it was just partially displayed. In this case I believe it's much better to have a scrollbar that it's displayed only when needed than not having it at all, right?

=== modified file 'gtk/checkbox-gtk.glade'
--- gtk/checkbox-gtk.glade 2009-11-05 16:09:25 +0000
+++ gtk/checkbox-gtk.glade 2009-11-06 08:19:54 +0000
@@ -211,7 +211,7 @@
   </widget>
   <packing>
     <property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
     <property name="fill">True</property>
   </packing>
        </child>
@@ -220,7 +220,7 @@
   <widget class="GtkScrolledWindow" id="scrolledwindow_options_list">
     <property name="visible">True</property>
     <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
     <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
     <property name="shadow_type">GTK_SHADOW_NONE</property>
     <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
Best regards,
    Javier

P.S. I'm still wondering which editor and/or config do you use. I wasn't able to save any change with glade (neither v2 nor v3) without completely changing the whole file.

review: Needs Fixing
Revision history for this message
Javier Collado (javier.collado) wrote :

Hello,

One more comment, I don't really like the way the suite description text is changed by the capitalize string method because some acronyms (USB, LED, CD/DVD) look weird (Usb, Led, Cd/dvd). If the aim is just to uppercase the first letter in the string, then I'd suggest this change:

=== modified file 'checkbox_gtk/gtk_interface.py'
--- checkbox_gtk/gtk_interface.py 2009-11-05 16:09:25 +0000
+++ checkbox_gtk/gtk_interface.py 2009-11-06 08:36:46 +0000
@@ -265,7 +265,7 @@
         option_table = {}
         vbox = self._get_widget("vbox_options_list")
         for option in options:
- label = "_%s" % option.capitalize()
+ label = "_%s" % (option[0].upper()+option[1:])
             radio_button = gtk.CheckButton(label)
             radio_button.show()
             option_table[option] = radio_button

Best regards,
    Javier

Revision history for this message
Marc Tardif (cr3) wrote :

* Javier Collado <email address hidden> [2009-11-06 08:32 -0000]:
> - <property name="expand">True</property>
> + <property name="expand">False</property>

Agreed.

> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>

I still don't agree that checkboxes should require horizontal scrolling.
However, you are absolutely correct that hiding the description is even
worse. So, the solution is quite simple actually:

+ radio_button.get_child().set_line_wrap(True)

The tricky part about this fix is that GtkCheckButton and GtkRadioButton
can only be passed a string as argument, rather than a Label object on
which we could call set_line_wrap. However, the former two classes in
fact generate a Label object internally accessible as a child, hence
the above fix.

> P.S. I'm still wondering which editor and/or config do you use. I
> wasn't able to save any change with glade (neither v2 nor v3) without
> completely changing the whole file.

Vim all the way. Unfortunately, glade doesn't support custom types.
Fortunately, the glade XML syntax is rather simple to grock.

Revision history for this message
Marc Tardif (cr3) wrote :

I have just pushed the following diff to the trunk in response to your review, what do you think?

=== modified file 'checkbox_gtk/gtk_interface.py'
--- checkbox_gtk/gtk_interface.py 2009-11-05 16:09:25 +0000
+++ checkbox_gtk/gtk_interface.py 2009-11-06 16:07:25 +0000
@@ -265,13 +265,14 @@
         option_table = {}
         vbox = self._get_widget("vbox_options_list")
         for option in options:
- label = "_%s" % option.capitalize()
- radio_button = gtk.CheckButton(label)
- radio_button.show()
- option_table[option] = radio_button
- vbox.pack_start(radio_button, False, False, 0)
+ label = "_%s%s" % (option[0].upper(), option[1:])
+ check_button = gtk.CheckButton(label)
+ check_button.get_child().set_line_wrap(True)
+ check_button.show()
+ option_table[option] = check_button
+ vbox.pack_start(check_button, False, False, 0)
             if option in default:
- radio_button.set_active(True)
+ check_button.set_active(True)

         self._set_hyper_text_view("hyper_text_view_options", text)

@@ -296,8 +297,9 @@
         option_table = {}
         vbox = self._get_widget("vbox_options_list")
         for option in options:
- label = "_%s" % option.capitalize()
+ label = "_%s%s" % (option[0].upper(), option[1:])
             radio_button = gtk.RadioButton(option_group, label)
+ radio_button.get_child().set_line_wrap(True)
             radio_button.show()
             option_table[option] = radio_button
             vbox.pack_start(radio_button, False, False, 0)

=== modified file 'gtk/checkbox-gtk.glade'
--- gtk/checkbox-gtk.glade 2009-11-05 16:09:25 +0000
+++ gtk/checkbox-gtk.glade 2009-11-06 16:08:04 +0000
@@ -211,7 +211,7 @@
                </widget>
                <packing>
                  <property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
                  <property name="fill">True</property>
                </packing>
              </child>

Revision history for this message
Javier Collado (javier.collado) wrote :

Hello,

I tested the set_line_wrap method on the child label and the result was positive. Nice trick.

The label doesn't resize itself when the window is resized, but there isn't a real need now to resize the window or have a horizontal scrollbar.

Best regards,
    Javier

review: Approve
Revision history for this message
Javier Collado (javier.collado) wrote :

I agree with the diff. Also the change from radio_button to checkbox_button
makes the code clearer. Thanks.

Marc Tardif wrote:
> I have just pushed the following diff to the trunk in response to your review, what do you think?
>
> === modified file 'checkbox_gtk/gtk_interface.py'
> --- checkbox_gtk/gtk_interface.py 2009-11-05 16:09:25 +0000
> +++ checkbox_gtk/gtk_interface.py 2009-11-06 16:07:25 +0000
> @@ -265,13 +265,14 @@
> option_table = {}
> vbox = self._get_widget("vbox_options_list")
> for option in options:
> - label = "_%s" % option.capitalize()
> - radio_button = gtk.CheckButton(label)
> - radio_button.show()
> - option_table[option] = radio_button
> - vbox.pack_start(radio_button, False, False, 0)
> + label = "_%s%s" % (option[0].upper(), option[1:])
> + check_button = gtk.CheckButton(label)
> + check_button.get_child().set_line_wrap(True)
> + check_button.show()
> + option_table[option] = check_button
> + vbox.pack_start(check_button, False, False, 0)
> if option in default:
> - radio_button.set_active(True)
> + check_button.set_active(True)
>
> self._set_hyper_text_view("hyper_text_view_options", text)
>
> @@ -296,8 +297,9 @@
> option_table = {}
> vbox = self._get_widget("vbox_options_list")
> for option in options:
> - label = "_%s" % option.capitalize()
> + label = "_%s%s" % (option[0].upper(), option[1:])
> radio_button = gtk.RadioButton(option_group, label)
> + radio_button.get_child().set_line_wrap(True)
> radio_button.show()
> option_table[option] = radio_button
> vbox.pack_start(radio_button, False, False, 0)
>
> === modified file 'gtk/checkbox-gtk.glade'
> --- gtk/checkbox-gtk.glade 2009-11-05 16:09:25 +0000
> +++ gtk/checkbox-gtk.glade 2009-11-06 16:08:04 +0000
> @@ -211,7 +211,7 @@
> </widget>
> <packing>
> <property name="padding">0</property>
> - <property name="expand">True</property>
> + <property name="expand">False</property>
> <property name="fill">True</property>
> </packing>
> </child>
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox_gtk/gtk_interface.py'
2--- checkbox_gtk/gtk_interface.py 2009-10-12 15:46:11 +0000
3+++ checkbox_gtk/gtk_interface.py 2009-11-05 19:40:28 +0000
4@@ -263,7 +263,7 @@
5
6 # Set options
7 option_table = {}
8- vbox = self._get_widget("vbox_options")
9+ vbox = self._get_widget("vbox_options_list")
10 for option in options:
11 label = "_%s" % option.capitalize()
12 radio_button = gtk.CheckButton(label)
13@@ -294,7 +294,7 @@
14 # Set options
15 option_group = None
16 option_table = {}
17- vbox = self._get_widget("vbox_options")
18+ vbox = self._get_widget("vbox_options_list")
19 for option in options:
20 label = "_%s" % option.capitalize()
21 radio_button = gtk.RadioButton(option_group, label)
22
23=== modified file 'debian/changelog'
24--- debian/changelog 2009-11-05 00:40:06 +0000
25+++ debian/changelog 2009-11-05 19:40:28 +0000
26@@ -3,6 +3,7 @@
27 * Fixed strings in fingerprint and modem tests (LP: #457759)
28 * Fixed client side validation of Launchpad form (LP: #438671)
29 * Added support for apport default configuration (LP: #465447)
30+ * Added support for scrolled options list (LP: #411526)
31 * Added support for armv7l processor
32
33 -- Marc Tardif <marc@ubuntu.com> Wed, 04 Nov 2009 19:36:09 -0400
34
35=== modified file 'gtk/checkbox-gtk.glade'
36--- gtk/checkbox-gtk.glade 2009-07-22 18:02:57 +0000
37+++ gtk/checkbox-gtk.glade 2009-11-05 19:40:28 +0000
38@@ -181,7 +181,7 @@
39 <property name="spacing">0</property>
40
41 <child>
42- <widget class="GtkScrolledWindow" id="scrolledwindow_options">
43+ <widget class="GtkScrolledWindow" id="scrolledwindow_options_text">
44 <property name="visible">True</property>
45 <property name="can_focus">True</property>
46 <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
47@@ -215,6 +215,41 @@
48 <property name="fill">True</property>
49 </packing>
50 </child>
51+
52+ <child>
53+ <widget class="GtkScrolledWindow" id="scrolledwindow_options_list">
54+ <property name="visible">True</property>
55+ <property name="can_focus">True</property>
56+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
57+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
58+ <property name="shadow_type">GTK_SHADOW_NONE</property>
59+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
60+
61+ <child>
62+ <widget class="GtkViewport" id="viewport_options_list">
63+ <property name="visible">True</property>
64+ <property name="shadow_type">GTK_SHADOW_IN</property>
65+
66+ <child>
67+ <widget class="GtkVBox" id="vbox_options_list">
68+ <property name="visible">True</property>
69+ <property name="homogeneous">False</property>
70+ <property name="spacing">0</property>
71+
72+ <child>
73+ <placeholder/>
74+ </child>
75+ </widget>
76+ </child>
77+ </widget>
78+ </child>
79+ </widget>
80+ <packing>
81+ <property name="padding">0</property>
82+ <property name="expand">True</property>
83+ <property name="fill">True</property>
84+ </packing>
85+ </child>
86 </widget>
87 <packing>
88 <property name="tab_expand">False</property>

Subscribers

People subscribed via source and target branches