FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 05-16-2011, 11:47 AM
Ales Kozumplik
 
Default 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
 

Thread Tools




All times are GMT. The time now is 04:03 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org