Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo User (http://www.linux-archive.org/gentoo-user/)
-   -   cosmetic: move the dir property in dispatch.py with other public methods. (http://www.linux-archive.org/gentoo-user/526809-cosmetic-move-dir-property-dispatch-py-other-public-methods.html)

Ales Kozumplik 05-16-2011 11:47 AM

cosmetic: move the dir property in dispatch.py with other public methods.
 
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 02:30 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.