[master 11/15] cosmetic: move the dir property in dispatch.py with other public methods.

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

 



Also use a more modern way of declaring a property.
---
 pyanaconda/dispatch.py |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/pyanaconda/dispatch.py b/pyanaconda/dispatch.py
index 5b4ab9f..3970189 100644
--- a/pyanaconda/dispatch.py
+++ b/pyanaconda/dispatch.py
@@ -193,6 +193,17 @@ class Dispatcher(object):
     def _step_index(self):
         return self.steps.index(self.step)
 
+    @property
+    def dir(self):
+        return self.anaconda.dir
+
+    @dir.setter
+    def dir(self, dir):
+        if dir not in [DISPATCH_BACK, DISPATCH_FORWARD, DISPATCH_DEFAULT]:
+            raise RuntimeError("dispatch: wrong direction code")
+        if dir in [DISPATCH_BACK, DISPATCH_FORWARD]:
+            self.anaconda.dir = dir
+
     def done_steps(self, *steps):
         map(lambda s: self.steps[s].done(), steps)
 
@@ -201,11 +212,11 @@ class Dispatcher(object):
         The caller should make sure can_go_back() is True before calling this
         method.
         """
-        self._setDir(DISPATCH_BACK)
+        self.dir = DISPATCH_BACK
         self.dispatch()
 
     def go_forward(self):
-        self._setDir(DISPATCH_FORWARD)
+        self.dir = DISPATCH_FORWARD
         self.dispatch()
 
     def can_go_back(self):
@@ -290,14 +301,3 @@ class Dispatcher(object):
                      (self.dir, self.step))
             self.done_steps(self.step)
             self._advance_step()
-
-    def _getDir(self):
-        return self.anaconda.dir
-
-    def _setDir(self, dir):
-        if dir not in [DISPATCH_BACK, DISPATCH_FORWARD, DISPATCH_DEFAULT]:
-            raise RuntimeError("dispatch: wrong direction code")
-        if dir in [DISPATCH_BACK, DISPATCH_FORWARD]:
-            self.anaconda.dir = dir
-
-    dir = property(_getDir,_setDir)
-- 
1.7.3.3

_______________________________________________
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