Show More
@@ -185,7 +185,7 b' def pathobj_unmangle(s):' | |||
|
185 | 185 | |
|
186 | 186 | |
|
187 | 187 | |
|
188 | class PathObj: | |
|
188 | class PathObj(path): | |
|
189 | 189 | def __init__(self,p): |
|
190 | 190 | self.path = p |
|
191 | 191 | if p != '.': |
@@ -222,10 +222,12 b' class PathObj:' | |||
|
222 | 222 | print "cd:",self.path |
|
223 | 223 | os.chdir(self.path) |
|
224 | 224 | |
|
225 | def complete_pathobj(obj, prev_completions): | |
|
226 | ||
|
225 | def complete_pathobj(obj, prev_completions): | |
|
227 | 226 | if hasattr(obj,'__complete__'): |
|
228 |
re |
|
|
227 | res = obj.__complete__() | |
|
228 | if res: | |
|
229 | return res | |
|
230 | # just return normal attributes of 'path' object if the dir is empty | |
|
229 | 231 | raise IPython.ipapi.TryNext |
|
230 | 232 | |
|
231 | 233 | complete_pathobj = IPython.generics.complete_object.when_type(PathObj)(complete_pathobj) |
@@ -234,9 +236,9 b' def test_pathobj():' | |||
|
234 | 236 | #p = PathObj('c:/prj') |
|
235 | 237 | #p2 = p.cgi |
|
236 | 238 | #print p,p2 |
|
237 |
|
|
|
239 | rootdir = PathObj("/") | |
|
238 | 240 | startmenu = PathObj("d:/Documents and Settings/All Users/Start Menu/Programs") |
|
239 | 241 | cwd = PathObj('.') |
|
240 |
ip.to_user_ns(" |
|
|
242 | ip.to_user_ns("rootdir startmenu cwd") | |
|
241 | 243 | |
|
242 | 244 | #test_pathobj() No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now