[PATCH] Make a couple UI modifications to the resize slider.

Vratislav Podzimek vpodzime at redhat.com
Thu Apr 18 09:00:08 UTC 2013


On Wed, 2013-04-17 at 16:32 -0400, Chris Lumens wrote:
> (1) Add tick marks at the end and at every 20%.
> 
> (2) Move the current value to the top.
> 
> (3) Add an adjustment to make keyboard navigation possible.
> 
> (4) Completely hide the slider when the shrink button has not been clicked.
> ---
>  pyanaconda/ui/gui/spokes/lib/resize.glade |  7 +++++-
>  pyanaconda/ui/gui/spokes/lib/resize.py    | 40 ++++++++++++++++++++++++-------
>  2 files changed, 37 insertions(+), 10 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade
> index 0c1ce28..ff8943d 100644
> --- a/pyanaconda/ui/gui/spokes/lib/resize.glade
> +++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
> @@ -23,6 +23,11 @@
>        <column type="gchararray"/>
>      </columns>
>    </object>
> +  <object class="GtkAdjustment" id="resizeAdjustment">
> +    <property name="upper">100</property>
> +    <property name="step_increment">1</property>
> +    <property name="page_increment">10</property>
> +  </object>
>    <object class="GtkDialog" id="resizeDialog">
>      <property name="height_request">550</property>
>      <property name="can_focus">False</property>
> @@ -260,9 +265,9 @@
>                      <property name="can_focus">True</property>
>                      <property name="margin_left">12</property>
>                      <property name="margin_right">12</property>
> +                    <property name="adjustment">resizeAdjustment</property>
>                      <property name="round_digits">1</property>
>                      <property name="digits">0</property>
> -                    <property name="value_pos">bottom</property>
>                      <signal name="format-value" handler="resize_slider_format" swapped="no"/>
>                      <signal name="value-changed" handler="on_resize_value_changed" swapped="no"/>
>                    </object>
> diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
> index 7a88d86..eaa7bca 100644
> --- a/pyanaconda/ui/gui/spokes/lib/resize.py
> +++ b/pyanaconda/ui/gui/spokes/lib/resize.py
> @@ -50,7 +50,7 @@ SHRINK = N_("Shrink")
>  DELETE = N_("Delete")
>  
>  class ResizeDialog(GUIObject):
> -    builderObjects = ["actionStore", "diskStore", "resizeDialog"]
> +    builderObjects = ["actionStore", "diskStore", "resizeDialog", "resizeAdjustment"]
>      mainWidgetName = "resizeDialog"
>      uiFile = "spokes/lib/resize.glade"
>  
> @@ -213,6 +213,33 @@ class ResizeDialog(GUIObject):
>              text = _("Total selected space to reclaim: <b>%s</b>") % size_str(selectedReclaimable)
>              self._selected_label.set_markup(text)
>  
> +    def _setup_slider(self, device, value):
> +        # Set up the slider for this device, pulling out any previously
> +        # given shrink value as the default.  Even if the device is not
> +        # resizeable, we want to set up the right numbers here so it doesn't
> +        # look weird.
This could be a docstring. Otherwise this looks good to me, nice
improvement!

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list