OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
scene_observer_impl.py
Go to the documentation of this file.
1 #------------------------------------------------------------------------------
2 # This file is part of the OpenStructure project <www.openstructure.org>
3 #
4 # Copyright (C) 2008-2011 by the OpenStructure authors
5 #
6 # This library is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU Lesser General Public License as published by the Free
8 # Software Foundation; either version 3.0 of the License, or (at your option)
9 # any later version.
10 # This library is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this library; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #------------------------------------------------------------------------------
19 # -*- coding: utf-8 -*-
20 
21 import sys
22 from ost import gui
23 from ost import gfx
24 
26  def __init__(self):
27  gfx.SceneObserver.__init__(self)
28  self.obs_ = list()
29 
30  def AttachObserver(self, ob):
31  self.obs_.append(ob)
32 
33  def DettachObserver(self, ob):
34  self.obs_.remove(ob)
35 
36  def NodeAdded(self, node):
37  for ob in self.obs_ :
38  if hasattr(ob, "NodeAdded"):
39  ob.NodeAdded(node)
40 
41  def NodeRemoved(self, node):
42  for ob in self.obs_ :
43  if hasattr(ob, "NodeRemoved"):
44  ob.NodeRemoved(node)
45 
46  def NodeChanged(self, node):
47  for ob in self.obs_ :
48  if hasattr(ob, "NodeChanged"):
49  ob.NodeChanged(node)
50 
51  def SelectionModeChanged(self, sel_mode):
52  for ob in self.obs_ :
53  if hasattr(ob, "SelectionModeChanged"):
54  ob.SelectionModeChanged(node)
55 
56  def SelectionChanged(self, obj, sel):
57  for ob in self.obs_ :
58  if hasattr(ob, "SelectionChanged"):
59  ob.SelectionChanged(node)
60 
61  def NodeTransformed(self, node):
62  for ob in self.obs_ :
63  if hasattr(ob, "NodeTransformed"):
64  ob.NodeTransformed(node)
65 
66  def NodeRemovedDefault(self, node):
67  for ob in self.obs_ :
68  if hasattr(ob, "NodeRemovedDefault"):
69  ob.NodeRemovedDefault(node)
70 
71  def RenderModeChanged(self, node):
72  for ob in self.obs_ :
73  if hasattr(ob, "RenderModeChanged"):
74  ob.RenderModeChanged(node)
Interface for observing graphical objects.