From 48a94e1b1a6d52dbaae5171c15c94f9e8305d4af Mon Sep 17 00:00:00 2001 From: Marco Biasini <marco.biasini@unibas.ch> Date: Fri, 18 Feb 2011 17:21:42 +0100 Subject: [PATCH] added glob-style access to GfxNodes --- modules/gfx/pymod/__init__.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/gfx/pymod/__init__.py b/modules/gfx/pymod/__init__.py index 509d9c271..4dfc0fd64 100644 --- a/modules/gfx/pymod/__init__.py +++ b/modules/gfx/pymod/__init__.py @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------ # This file is part of the OpenStructure project <www.openstructure.org> # -# Copyright (C) 2008-2011 by the OpenStructure authors +# Copyright (C) 2008-2010 by the OpenStructure authors # # This library is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free @@ -141,7 +141,7 @@ def FitToScreen(gfx_ent, width=None, height=None, margin=0.01): scene.SetRTC(rtc) -class GfxNodeListAttrProxy(object): +class GfxNodeListAttrProxy: def __init__(self, node_list, name): self._node_list=node_list self._name=name @@ -164,11 +164,6 @@ class GfxNodeListProxy(object): return super(GfxNodeListProxy, self).__getattr__(name) return GfxNodeListAttrProxy(self._nodes, name) - def __dir__(self): - if len(self._nodes)==0: - return dir(None) - return dir(self._nodes[0]) - def __setattr__(self, name, value): if name.startswith('_'): super(GfxNodeListProxy, self).__setattr__(name, value) @@ -188,4 +183,4 @@ def _Match(scene, pattern="*"): return matches return GfxNodeListProxy(_Recurse("", Scene().root_node, pattern)) -SceneSingleton.Match=_Match +SceneSingleton.__getitem__=_Match -- GitLab