Re: [master] Do a better job of remembering if 'review and modify partitioning' was checked.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



looks good

On Tue, 2011-10-18 at 15:59 +0200, Ales Kozumplik wrote:
> The scheduling is reverted when going back thus it can not be used to
> remember user's choice that should preserve if reentering a particular
> screen.
> 
> Resolves: rhbz#746703
> ---
>  pyanaconda/dispatch.py                 |    5 +++++
>  pyanaconda/iw/autopart_type.py         |    6 +++++-
>  tests/pyanaconda_test/dispatch_test.py |   12 ++++++++++++
>  3 files changed, 22 insertions(+), 1 deletions(-)
> 
> diff --git a/pyanaconda/dispatch.py b/pyanaconda/dispatch.py
> index 6aeae38..18bfa58 100644
> --- a/pyanaconda/dispatch.py
> +++ b/pyanaconda/dispatch.py
> @@ -86,6 +86,8 @@ class Step(object):
>          self.name = name
>          self.target = target # None for dynamic target (e.g. gui view)
>          self._sched = self.SCHED_UNSCHEDULED
> +        self.client_data = {} # used by the client code, not reset when
> +                              # scheduling is reverted
>  
>      def _reschedule(self, to_sched, current_step):
>          s_from = self.sched
> @@ -334,6 +336,9 @@ class Dispatcher(object):
>              except errors.DispatchError as e:
>                  log.debug("dispatch: %s" % e)
>  
> +    def step_data(self, step):
> +        return self.steps[step].client_data
> +
>      def step_disabled(self, step):
>          """ True if step is not yet scheduled to be run or will never be run
>              (i.e. is skipped).
> diff --git a/pyanaconda/iw/autopart_type.py b/pyanaconda/iw/autopart_type.py
> index 536adcc..512d884 100644
> --- a/pyanaconda/iw/autopart_type.py
> +++ b/pyanaconda/iw/autopart_type.py
> @@ -200,6 +200,7 @@ class PartitionTypeWindow(InstallWindow):
>  
>              self.storage.doAutoPart = True
>  
> +            self.dispatch.step_data("parttype")["review_checked"] = self.reviewButton.get_active()
>              if self.reviewButton.get_active():
>                  self.dispatch.request_steps("partition")
>                  # with kickstart bootloader is already scheduled to be skipped:
> @@ -253,7 +254,10 @@ class PartitionTypeWindow(InstallWindow):
>          self.table = self.xml.get_widget("parttypeTable")
>  
>          self.prevrev = None
> -        self.reviewButton.set_active(self.dispatch.step_enabled("partition"))
> +
> +        step_data = self.dispatch.step_data("parttype")
> +        self.reviewButton.set_active(
> +            step_data.get("review_checked", self.dispatch.step_enabled("partition")))
>          self.encryptButton.set_active(self.storage.encryptedAutoPart)
>          self.lvmButton.set_active(self.storage.lvmAutoPart)
>  
> diff --git a/tests/pyanaconda_test/dispatch_test.py b/tests/pyanaconda_test/dispatch_test.py
> index b9243f6..9f2fac1 100644
> --- a/tests/pyanaconda_test/dispatch_test.py
> +++ b/tests/pyanaconda_test/dispatch_test.py
> @@ -249,3 +249,15 @@ class DispatchTest(mock.TestCase):
>              d.steps["betanag"].changes,
>              {"betanag" : (Step.SCHED_SCHEDULED, Step.SCHED_UNSCHEDULED),
>               "filtertype" : (Step.SCHED_SCHEDULED, Step.SCHED_UNSCHEDULED)})
> +
> +    def step_data_test(self):
> +        from pyanaconda.dispatch import Step
> +        d = self._getDispatcher()
> +        self.assertEqual(d.step_data("filter"), {})
> +        d.step_data("filter")["key"] = 42
> +        # we can retrieve it
> +        self.assertEqual(d.step_data("filter")["key"], 42)
> +        # it persists over scheduling changes
> +        d.schedule_steps("filter")
> +        d._revert_scheduling("filter")
> +        self.assertEqual(d.step_data("filter")["key"], 42)

-- 
Martin Gracik <mgracik@xxxxxxxxxx>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux