Changeset 528
- Timestamp:
- 04/25/03 00:08:31 (5 years ago)
- Files:
-
- trunk/RBFoundation/RBFoundation/BindCallable.py (added)
- trunk/RBFoundation/RBFoundation/ContextApply.py (modified) (4 diffs)
- trunk/RBFoundation/RBFoundation/LazyProperty.py (deleted)
- trunk/RBFoundation/RBFoundation/ObjectifiedXMLParser.py (modified) (3 diffs)
- trunk/RBFoundation/RBFoundation/Objects/Properties.py (added)
- trunk/RBFoundation/RBFoundation/SubObs/LogicRules/BaseCollection.py (modified) (2 diffs)
- trunk/RBFoundation/RBFoundation/Utilities.py (modified) (1 diff)
- trunk/RBFoundation/RBFoundation/WeakBind.py (deleted)
- trunk/RBFoundation/RBFoundation/XMLBuilder.py (modified) (3 diffs)
- trunk/RBFoundation/test/test_doctests.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/JabberConnection.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/JabberObserver.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/JabberSubject.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/SubjectObserver/AssociativeObserver.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/SubjectObserver/CategorySubject.py (modified) (2 diffs)
- trunk/RBJabber/RBJabber/SubjectObserver/Observer.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/SubjectObserver/SchedulerSubject.py (modified) (3 diffs)
- trunk/RBJabber/RBJabber/SubjectObserver/Subject.py (modified) (4 diffs)
- trunk/RBJabber/RBJabber/iqAuthQuery.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/iqQuery.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/iqResponse.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/iqRosterQuery.py (modified) (1 diff)
- trunk/RBRapier/RBRapier/Renderer/Appearance/Blending.py (modified) (4 diffs)
- trunk/RBRapier/RBRapier/Renderer/Appearance/PointRasterization.py (modified) (2 diffs)
- trunk/RBRapier/RBRapier/Renderer/ChangeBaseMgr.py (modified) (2 diffs)
- trunk/RBSkinning/RBSkinning/XMLSkinner.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/wxPythonSkin/bitmap.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/wxPythonSkin/bitmap_button.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/wxTools/wxEvtHandlerBidableCategorySubject.py (deleted)
- trunk/RBSkinning/RBSkinning/wxTools/wxFrameMover.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/wxTools/wxLockingFrame.py (modified) (2 diffs)
- trunk/RBSkinning/RBSkinning/wxTools/wxRolloverEvents.py (modified) (2 diffs)
- trunk/RBSkinning/RBSkinning/wxTools/wxWeakBind.py (deleted)
- trunk/RBSkinning/demo/wxPythonSkin/components/component_example.py (modified) (1 diff)
- trunk/RBSkinning/demo/wxPythonSkin/ctypes/winChangeDisplaySettings.py (modified) (1 diff)
- trunk/RBSkinning/demo/wxPythonSkin/docking/docking_single_and_multiple.py (modified) (1 diff)
- trunk/RBSkinning/demo/wxPythonSkin/grafting/graft_layout.py (modified) (2 diffs)
- trunk/RBSkinning/demo/wxPythonSkin/widgets/htmlwindow.html (modified) (1 diff)
- trunk/RBSkinning/demo/wxPythonSkin/widgets/htmlwindow.py (modified) (1 diff)
- trunk/RBSkinning/demo/wxPythonSkin/widgets/htmlwindow_extended.html (added)
- trunk/RBSkinning/demo/wxPythonSkin/widgets/htmlwindow_extended.py (added)
- trunk/RBSkinning/plans/todo.txt (modified) (1 diff)
- trunk/RBTelepathy/RBTelepathy/SocketConnections.py (modified) (1 diff)
- trunk/RBTelepathy/RBTelepathy/Stream/SocketAdaptor.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBFoundation/RBFoundation/ContextApply.py
r290 r528 20 20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 21 21 22 """Binds calling variables to a callable object, with ordering options. 23 24 >>> def _TestReturnArgsKw(*args, **kw): 25 ... return args, kw 26 ... 27 >>> fn = ContextApply(_TestReturnArgsKw, 2,3,5, seven='11') 28 >>> fn(13,17,19,twenty='3') 29 ((13, 17, 19, 2, 3, 5), {'twenty': '3', 'seven': '11'}) 30 >>> fn = ContextApply_p_s(_TestReturnArgsKw, 2,3,5, seven='11') 31 >>> fn(13,17,19,twenty='3') 32 ((13, 17, 19, 2, 3, 5), {'twenty': '3', 'seven': '11'}) 33 >>> fn = ContextApply_s_p(_TestReturnArgsKw, 2,3,5, seven='11') 34 >>> fn(13,17,19,twenty='3') 35 ((2, 3, 5, 13, 17, 19), {'twenty': '3', 'seven': '11'}) 36 >>> fn = ContextApply_p(_TestReturnArgsKw, 2,3,5, seven='11') 37 >>> fn(13,17,19,twenty='3') 38 ((13, 17, 19), {'twenty': '3'}) 39 >>> fn = ContextApply_s(_TestReturnArgsKw, 2,3,5, seven='11') 40 >>> fn(13,17,19,twenty='3') 41 ((2, 3, 5), {'seven': '11'}) 42 >>> fn = ContextApply_0(_TestReturnArgsKw, 2,3,5, seven='11') 43 >>> fn(13,17,19,twenty='3') 44 ((), {}) 45 """ 22 """Binds calling variables to a callable object, with ordering options.""" 46 23 47 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 49 26 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 50 27 51 import weakref 52 from WeakBind import BindCallable, WeakBoundCallable, StrongBoundCallable 28 from BindCallable import _WeakBoundCallable, _StrongBoundCallable 53 29 54 30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 73 49 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 50 75 class _StrongContextApply(StrongBoundCallable): 76 """Base class for adding positional and keyword based "context" to BoundCallable objects""" 51 class _StrongContextApply(_StrongBoundCallable): 52 """Base class for adding positional and keyword based "context" to StrongBoundCallable objects""" 53 54 __slots__ = () 77 55 78 56 def __init__(self, callback, *args, **kw): 79 StrongBoundCallable.__init__(self, callback)57 _StrongBoundCallable.__init__(self, callback) 80 58 self.SaveContext(args, kw) 81 59 82 60 def SaveContext(self, args, kw): 83 """Saves extra paramters to be passed to the BoundCallable object. Creates the "context" part of ContextApply.""" 61 """Saves extra paramters to be passed to the StrongBoundCallable object. Creates the "context" part of ContextApply.""" 62 raise NotImplementedError 63 64 class _WeakContextApply(_WeakBoundCallable): 65 """Base class for adding positional and keyword based "context" to WeakBoundCallable objects""" 66 67 __slots__ = () 68 69 def __init__(self, callback, *args, **kw): 70 _WeakBoundCallable.__init__(self, callback) 71 self.SaveContext(args, kw) 72 73 def SaveContext(self, args, kw): 74 """Saves extra paramters to be passed to the WeakBoundCallable object. Creates the "context" part of ContextApply.""" 75 raise NotImplementedError 76 77 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 79 class ContextApply_p_s_mixin(object): 80 """BoundCallable object whose parameters will be "constructed" in the following order: 81 - Passed from calling code, 82 - Saved context, 83 """ 84 __slots__ = ('args', 'kw') 85 def SaveContext(self, args, kw): 84 86 self.args = args 85 87 self.kw = kw 86 88 87 class _WeakContextApply(WeakBoundCallable): 88 """Base class for adding positional and keyword based "context" to BoundCallable objects""" 89 90 def __init__(self, callback, *args, **kw): 91 WeakBoundCallable.__init__(self, callback) 92 self.SaveContext(args, kw) 93 94 def SaveContext(self, args, kw): 95 """Saves extra paramters to be passed to the BoundCallable object. Creates the "context" part of ContextApply.""" 89 def __call__(self, *args, **kw): 90 return self._DoCall(*(args + self.args), **_JoinKW(kw, self.kw)) 91 92 class ContextApply_s_p_mixin(object): 93 """BoundCallable object whose parameters will be "constructed" in the following order: 94 - Saved context, 95 - Passed from calling code, 96 """ 97 __slots__ = ('args', 'kw') 98 def SaveContext(self, args, kw): 96 99 self.args = args 97 100 self.kw = kw 98 101 99 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 100 101 class ContextApply_p_s_mixin(object): 102 def __call__(self, *args, **kw): 103 return self._DoCall(*(self.args + args), **_JoinKW(self.kw, kw)) 104 105 class ContextApply_p_mixin(object): 102 106 """BoundCallable object whose parameters will be "constructed" in the following order: 103 107 - Passed from calling code, 108 109 Note: This is the same as calling the BoundCallable directly, but appears here for completeness. 110 """ 111 __slots__ = () 112 def SaveContext(self, args, kw): pass 113 def __call__(self, *args, **kw): 114 return self._DoCall(*args, **kw) 115 116 class ContextApply_s_mixin(object): 117 """BoundCallable object whose parameters will be "constructed" in the following order: 104 118 - Saved context, 105 119 106 107 """108 def __call__(self, *args, **kw):109 return self._DoCall(*(args + self.args), **_JoinKW(kw, self.kw))110 111 class ContextApply_s_p_mixin(object):112 """BoundCallable object whose parameters will be "constructed" in the following order:113 - Saved context,114 - Passed from calling code,115 """116 def __call__(self, *args, **kw):117 return self._DoCall(*(self.args + args), **_JoinKW(self.kw, kw))118 119 class ContextApply_p_mixin(object):120 """BoundCallable object whose parameters will be "constructed" in the following order:121 - Passed from calling code,122 123 Note: This is the same as calling the BoundCallable directly, but appears here for completeness.124 """125 def SaveContext(self, args, kw): pass126 def __call__(self, *args, **kw):127 return self._DoCall(*args, **kw)128 129 class ContextApply_s_mixin(object):130 """BoundCallable object whose parameters will be "constructed" in the following order:131 - Saved context,132 133 120 Note: The parameters from the calling code will be completely ignored. 134 121 """ 122 __slots__ = ('args', 'kw') 123 def SaveContext(self, args, kw): 124 self.args = args 125 self.kw = kw 126 135 127 def __call__(self, *args, **kw): 136 128 return self._DoCall(*self.args, **self.kw) … … 143 135 Note: The parameters from both the calling code and the "context" will be completely ignored. 144 136 """ 137 __slots__ = () 145 138 def SaveContext(self, args, kw): pass 146 139 def __call__(self, *args, **kw): trunk/RBFoundation/RBFoundation/ObjectifiedXMLParser.py
r253 r528 25 25 26 26 from xml.parsers.expat import ParserCreate as _ParserCreate 27 from WeakBind importBindCallable27 from BindCallable import WeakBindCallable as _WeakBindCallable 28 28 29 29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 42 42 parser = _ParserCreate(self._encoding, self._seperator) 43 43 parser.returns_unicode = self._encoding != 'ASCII' and 1 or 0 44 parser.StartElementHandler = BindCallable(self.StartElementHandler)45 parser.EndElementHandler = BindCallable(self.EndElementHandler)46 parser.CharacterDataHandler = BindCallable(self.CharacterDataHandler)47 parser.StartNamespaceDeclHandler = BindCallable(self.StartNamespaceDeclHandler)48 parser.EndNamespaceDeclHandler = BindCallable(self.EndNamespaceDeclHandler)44 parser.StartElementHandler = _WeakBindCallable(self.StartElementHandler) 45 parser.EndElementHandler = _WeakBindCallable(self.EndElementHandler) 46 parser.CharacterDataHandler = _WeakBindCallable(self.CharacterDataHandler) 47 parser.StartNamespaceDeclHandler = _WeakBindCallable(self.StartNamespaceDeclHandler) 48 parser.EndNamespaceDeclHandler = _WeakBindCallable(self.EndNamespaceDeclHandler) 49 49 return parser.Parse(*args, **kw) 50 50 … … 53 53 parser = _ParserCreate(self._encoding, self._seperator) 54 54 parser.returns_unicode = self._encoding != 'ASCII' and 1 or 0 55 parser.StartElementHandler = BindCallable(self.StartElementHandler)56 parser.EndElementHandler = BindCallable(self.EndElementHandler)57 parser.CharacterDataHandler = BindCallable(self.CharacterDataHandler)58 parser.StartNamespaceDeclHandler = BindCallable(self.StartNamespaceDeclHandler)59 parser.EndNamespaceDeclHandler = BindCallable(self.EndNamespaceDeclHandler)55 parser.StartElementHandler = _WeakBindCallable(self.StartElementHandler) 56 parser.EndElementHandler = _WeakBindCallable(self.EndElementHandler) 57 parser.CharacterDataHandler = _WeakBindCallable(self.CharacterDataHandler) 58 parser.StartNamespaceDeclHandler = _WeakBindCallable(self.StartNamespaceDeclHandler) 59 parser.EndNamespaceDeclHandler = _WeakBindCallable(self.EndNamespaceDeclHandler) 60 60 return parser.ParseFile(*args, **kw) 61 61 trunk/RBFoundation/RBFoundation/SubObs/LogicRules/BaseCollection.py
r396 r528 25 25 26 26 import weakref 27 from RBFoundation import WeakBind27 from RBFoundation import BindCallable as _BindCallable 28 28 29 29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 61 61 class WeakWrapCallableMixin(object): 62 62 def _WrapCallable(self, Callable): 63 result = WeakBind.WeakBindCallable(Callable, self.Remove)63 result = _BindCallable.WeakBindCallable(Callable, self.Remove) 64 64 return result 65 65 trunk/RBFoundation/RBFoundation/Utilities.py
r516 r528 61 61 return cleanupstrlst(data.split(splitchar), *args, **kw) 62 62 63 #~ iso formated time information ~~~~~~~~~~~~~~~~~~~~64 65 def fromisoformat(strtime, sectionsep='T', datesep='-', timesep=':'):66 """ISO 8601 format, YYYY-MM-DDTHH:MM:SS67 returns (YYYY, MM, DD, HH, MM, SS, -1, -1, -1)68 compatible with time module's mktime method."""69 datesent, timesent = strtime.split(sectionsep)[:2]70 datesent = map(int, datesent.split(datesep)[:3])71 timesent = map(int, timesent.split(timesep)[:3])72 return tuple(datesent + timesent + (-1,-1,-1))73 74 def fromisoformat_date(strtime, datesep='-'):75 """ISO 8601 format, YYYY-MM-DDTHH:MM:SS76 returns (YYYY, MM, DD)"""77 datesent = map(int, datesent.split(datesep)[:3])78 return tuple(datesent)79 80 def fromisoformat_time(strtime, timesep=':'):81 """ISO 8601 format, YYYY-MM-DDTHH:MM:SS82 returns (HH, MM, SS)"""83 timesent = map(int, timesent.split(timesep)[:3])84 return tuple(datesent)85 86 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~87 88 def UnpackCallTuple(calltuple):89 """Seperates calltuple into (call, args or (), kw or {})90 91 Nasty shorthand that consistently allows for variable length tuples.92 """93 return (calltuple[0], # callable94 (calltuple[1:2] or ((),))[0], # args or ()95 (calltuple[2:3] or ({},))[0]) # kw or ()96 97 def CallTuple(calltuple):98 """Uses CallTupleUnpack to invoke the calltuple"""99 call, args, kw = CallTupleUnpack(calltuple)100 return call(*args, **kw)101 102 63 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 103 64 #~ Testing trunk/RBFoundation/RBFoundation/XMLBuilder.py
r524 r528 38 38 39 39 from xml.parsers.expat import ParserCreate as _ExpatParserCreate 40 from WeakBind import BindCallable as _BindCallable40 from BindCallable import WeakBindCallable, Curry 41 41 from XMLNamespaceMap import XMLNamespaceMap 42 from Utilities import CallTuple43 42 44 43 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 155 154 156 155 if isinstance(build_factory, tuple): 157 newelement = C allTuple(build_factory)156 newelement = Curry.callTuple(build_factory) 158 157 else: 159 158 newelement = build_factory(*args) … … 213 212 parser = _ExpatParserCreate(self._encoding, self._seperator) 214 213 parser.returns_unicode = self._encoding != 'ASCII' and 1 or 0 215 parser.StartElementHandler = _BindCallable(self._start_element)216 parser.EndElementHandler = _BindCallable(self._end_element)217 parser.CharacterDataHandler = _BindCallable(self._char_data)218 parser.StartNamespaceDeclHandler = _BindCallable(self._start_namespace_decl_handler)219 parser.EndNamespaceDeclHandler = _BindCallable(self._end_namespace_decl_handler)214 parser.StartElementHandler = WeakBindCallable(self._start_element) 215 parser.EndElementHandler = WeakBindCallable(self._end_element) 216 parser.CharacterDataHandler = WeakBindCallable(self._char_data) 217 parser.StartNamespaceDeclHandler = WeakBindCallable(self._start_namespace_decl_handler) 218 parser.EndNamespaceDeclHandler = WeakBindCallable(self._end_namespace_decl_handler) 220 219 return parser 221 220 trunk/RBFoundation/test/test_doctests.py
r403 r528 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 from RBFoundation import WeakBind, ContextApply, Utilities, LazyProperty, ChainedDict, AttributedDict, Acquisition, IndexedProperty26 from RBFoundation import ContextApply, Utilities, ChainedDict, AttributedDict, Acquisition, IndexedProperty 27 27 28 28 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBJabber/RBJabber/JabberConnection.py
r397 r528 40 40 from RBFoundation.XMLClassBuilder import XMLClassBuilderMixin 41 41 from RBFoundation import SmartSelect 42 from RBFoundation. WeakBindimport BindCallable42 from RBFoundation.BindCallable import BindCallable 43 43 import JID 44 44 import sys trunk/RBJabber/RBJabber/JabberObserver.py
r400 r528 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 from RBFoundation. WeakBindimport BoundCallable, BindCallable26 from RBFoundation.BindCallable import BoundCallable, BindCallable 27 27 import JID 28 28 trunk/RBJabber/RBJabber/JabberSubject.py
r400 r528 26 26 from SubjectObserver.CategorySubject import CategorySubjectBaseMixin 27 27 from SubjectObserver import ProxyBidableCategorySubjectMixin 28 from RBFoundation. WeakBindimport BoundCallableBase28 from RBFoundation.BindCallable import BoundCallableBase 29 29 import JID 30 30 trunk/RBJabber/RBJabber/SubjectObserver/AssociativeObserver.py
r400 r528 30 30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 31 32 from RBFoundation. WeakBindimport BindCallable32 from RBFoundation.BindCallable import BindCallable 33 33 import ProxyBidableCategorySubjectMixin 34 34 trunk/RBJabber/RBJabber/SubjectObserver/CategorySubject.py
r400 r528 30 30 31 31 from Subject import Subject 32 from RBFoundation import WeakBind32 from RBFoundation import BindCallable 33 33 import bisect 34 34 … … 47 47 48 48 def AddObserver(self, category, observer, priority=0): 49 result = WeakBind.BindCallable(observer)49 result = BindCallable.BindCallable(observer) 50 50 bisect.insort(self._observers.setdefault(category,[]), (-priority, result)) 51 51 return self 52 52 53 53 def RemoveObserver(self, observer): 54 result = WeakBind.BindCallable(observer)54 result = BindCallable.BindCallable(observer) 55 55 for observers in self._observers.itervalues(): 56 56 observers[:] = [x for x in observers if x[-1] != result] trunk/RBJabber/RBJabber/SubjectObserver/Observer.py
r400 r528 30 30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 31 32 from RBFoundation. WeakBindimport BoundCallable, BindCallable32 from RBFoundation.BindCallable import BoundCallable, BindCallable 33 33 34 34 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBJabber/RBJabber/SubjectObserver/SchedulerSubject.py
r400 r528 27 27 28 28 import bisect, time 29 from RBFoundation import WeakBind29 from RBFoundation import BindCallable 30 30 31 31 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 35 35 class SchedulerSubject(object): 36 36 def __init__(self, TimeFn=time.time): 37 self._TimeFn = WeakBind.BindCallable(TimeFn)37 self._TimeFn = BindCallable.BindCallable(TimeFn) 38 38 self._LastTime = 0 39 39 self._events = [] … … 47 47 48 48 def AddEvent(self, Time, observer): 49 result = Time, WeakBind.BindCallable(observer)49 result = Time, BindCallable.BindCallable(observer) 50 50 bisect.insort(self._events, result) 51 51 return self 52 52 53 53 def RemoveEvent(self, observer): 54 result = WeakBind.BindCallable(observer)54 result = BindCallable.BindCallable(observer) 55 55 self._events[:] = [x for x in self._events if x[-1] != result] 56 56 return self trunk/RBJabber/RBJabber/SubjectObserver/Subject.py
r400 r528 25 25 no longer exisits or is explicitly released. 26 26 27 WeakBindmodule is used extensively to prevent reference chains keeping objects in27 BindCallable module is used extensively to prevent reference chains keeping objects in 28 28 memory unnecessarily.""" 29 29 … … 32 32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 33 33 34 from RBFoundation import WeakBind34 from RBFoundation import BindCallable 35 35 import bisect 36 36 … … 56 56 """Adds observer to the internal collection monitoring this subject 57 57 Observer is assumed to be a callable object.""" 58 result = WeakBind.BindCallable(observer)58 result = BindCallable.BindCallable(observer) 59 59 bisect.insort(self._observers, (-priority, result)) 60 60 return self … … 63 63 """Removes observer from the internal collection monitoring this subject. 64 64 Observer should be the same object that was passed to AddObserver.""" 65 result = WeakBind.BindCallable(observer)65 result = BindCallable.BindCallable(observer) 66 66 self._observers[:] = [x for x in self._observers if x[-1] != result] 67 67 return self trunk/RBJabber/RBJabber/iqAuthQuery.py
r397 r528 26 26 import weakref, sha 27 27 from xml.sax.saxutils import escape, quoteattr 28 from RBFoundation. WeakBindimport BindCallable28 from RBFoundation.BindCallable import BindCallable 29 29 from iqQuery import iqQueryBase 30 30 trunk/RBJabber/RBJabber/iqQuery.py
r397 r528 26 26 import weakref 27 27 from xml.sax.saxutils import escape, quoteattr 28 from RBFoundation. WeakBindimport BindCallable28 from RBFoundation.BindCallable import BindCallable 29 29 import JabberObserver as JObs 30 30 import JID trunk/RBJabber/RBJabber/iqResponse.py
r397 r528 28 28 import weakref 29 29 from xml.sax.saxutils import escape, quoteattr 30 from RBFoundation. WeakBindimport BindCallable30 from RBFoundation.BindCallable import BindCallable 31 31 import JabberObserver as JObs 32 32 import JID trunk/RBJabber/RBJabber/iqRosterQuery.py
r400 r528 26 26 import weakref 27 27 from xml.sax.saxutils import escape, quoteattr 28 from RBFoundation. WeakBindimport BindCallable28 from RBFoundation.BindCallable import BindCallable 29 29 from SubjectObserver.CategorySubject import CategorySubject 30 30 from iqQuery import iqQueryBase trunk/RBRapier/RBRapier/Renderer/Appearance/Blending.py
r398 r528 25 25 26 26 from RBRapier.Renderer.AttributeMgr import AttributeChangeElement 27 from RBFoundation. LazyPropertyimport LazyProperty27 from RBFoundation.Objects.Properties import LazyProperty 28 28 from OpenGL import GL 29 29 … … 70 70 from OpenGL.GL.EXT import blend_func_separate 71 71 self.blend_func_separate = blend_func_separate.glInitBlendFuncSeparateEXT() and blend_func_separate or None 72 _extensions = LazyProperty( '_extensions',_Extensions)72 _extensions = LazyProperty(_Extensions) 73 73 74 74 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 106 106 from OpenGL.GL.EXT import blend_color 107 107 self.blend_color = blend_color.glInitBlendColorEXT() and blend_color or None 108 _extensions = LazyProperty( '_extensions',_Extensions)108 _extensions = LazyProperty(_Extensions) 109 109 110 110 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 134 134 from OpenGL.GL.EXT import blend_minmax 135 135 self.blend_minmax = blend_minmax.glInitBlendMinmaxEXT() and blend_minmax or None 136 _extensions = LazyProperty( '_extensions',_Extensions)136 _extensions = LazyProperty(_Extensions) 137 137 138 138 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBRapier/RBRapier/Renderer/Appearance/PointRasterization.py
r398 r528 25 25 26 26 from OpenGL import GL 27 from RBFoundation. LazyPropertyimport LazyProperty27 from RBFoundation.Objects.Properties import LazyProperty 28 28 from RBRapier.Tools import Vector 29 29 from RBRapier.Renderer.AttributeMgr import AttributeChangeElement … … 88 88 from OpenGL.GL.EXT import point_parameters 89 89 self.point_parameters = point_parameters.glInitPointParametersEXT() and point_parameters or None 90 _extensions = LazyProperty( '_extensions',_Extensions)90 _extensions = LazyProperty(_Extensions) 91 91 92 92 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBRapier/RBRapier/Renderer/ChangeBaseMgr.py
r457 r528 25 25 26 26 from RBFoundation.SubObs.Basic import SubjectList 27 from RBFoundation. LazyPropertyimport LazyProperty27 from RBFoundation.Objects.Properties import LazyProperty 28 28 29 29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 35 35 36 36 class DynamicChangeElementBase(ChangeElementBase): 37 Trackers = LazyProperty( 'Tracker',SubjectList)37 Trackers = LazyProperty(SubjectList) 38 38 39 39 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBSkinning/RBSkinning/XMLSkinner.py
r516 r528 25 25 26 26 from RBFoundation.XMLClassBuilder import XMLClassBuilder 27 from RBFoundation. WeakBindimport BindCallable27 from RBFoundation.BindCallable import BindCallable 28 28 import SkinContext 29 29 import SkinObject trunk/RBSkinning/RBSkinning/wxPythonSkin/bitmap.py
r472 r528 45 45 def SetBitmapRollover(self, rollover): 46 46 if not self._rollover_events: 47 from RB Skinning.wxTools.wxWeakBind import wxBindCallable47 from RBFoundation.BindCallable import BindCallable 48 48 from RBSkinning.wxTools.wxRolloverEvents import wxRolloverEvents 49 49 self._rollover_events = wxRolloverEvents() 50 self._rollover_events.OnMouseEnter = wxBindCallable(self._SetRolloverBitmap)51 self._rollover_events.OnMouseLeave = wxBindCallable(self._SetNonRolloverBitmap)50 self._rollover_events.OnMouseEnter = BindCallable(self._SetRolloverBitmap) 51 self._rollover_events.OnMouseLeave = BindCallable(self._SetNonRolloverBitmap) 52 52 self.PushEventHandler(self._rollover_events) 53 53 self._rollover_bitmap = rollover trunk/RBSkinning/RBSkinning/wxPythonSkin/bitmap_button.py
r472 r528 45 45 def SetBitmapRollover(self, rollover): 46 46 if not self._rollover_events: 47 from RB Skinning.wxTools.wxWeakBind import wxBindCallable47 from RBFoundation.BindCallable import BindCallable 48 48 from RBSkinning.wxTools.wxRolloverEvents import wxRolloverEvents 49 49 self._rollover_events = wxRolloverEvents() 50 self._rollover_events.OnMouseEnter = wxBindCallable(self._SetRolloverBitmap)51 self._rollover_events.OnMouseLeave = wxBindCallable(self._SetNonRolloverBitmap)50 self._rollover_events.OnMouseEnter = BindCallable(self._SetRolloverBitmap) 51 self._rollover_events.OnMouseLeave = BindCallable(self._SetNonRolloverBitmap) 52 52 self.PushEventHandler(self._rollover_events) 53 53 self._rollover_bitmap = rollover trunk/RBSkinning/RBSkinning/wxTools/wxFrameMover.py
r488 r528 31 31 import weakref 32 32 from wxPython import wx 33 from RBSkinning.wxTools.wxWeakBind import wxBindCallable34 33 35 34 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBSkinning/RBSkinning/wxTools/wxLockingFrame.py
r502 r528 29 29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30 30 31 from wxWeakBind import wxBindCallable 31 import weakref 32 32 from wxPython import wx 33 import weakref 33 from RBFoundation.BindCallable import BindCallable 34 34 35 35 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 130 130 wx.wxFrame.__init__(self, *args, **kw) 131 131 132 wx.EVT_SIZE(self, wxBindCallable(self._OnSizeFrame))133 wx.EVT_MOVE(self, wxBindCallable(self._OnMoveFrame))132 wx.EVT_SIZE(self, BindCallable(self._OnSizeFrame)) 133 wx.EVT_MOVE(self, BindCallable(self._OnMoveFrame)) 134 134 self.PushEventHandler(wx.wxEvtHandler()) 135 135 trunk/RBSkinning/RBSkinning/wxTools/wxRolloverEvents.py
r395 r528 29 29 30 30 from wxPython import wx 31 from RB Skinning.wxTools.wxWeakBind import wxBindCallable31 from RBFoundation.BindCallable import BindCallable 32 32 33 33 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 49 49 50 50 def _CaptrueEvents(self): 51 wx.EVT_ENTER_WINDOW(self, wxBindCallable(self._OnMouseEnter))52 wx.EVT_LEAVE_WINDOW(self, wxBindCallable(self._OnMouseLeave))51 wx.EVT_ENTER_WINDOW(self, BindCallable(self._OnMouseEnter)) 52 wx.EVT_LEAVE_WINDOW(self, BindCallable(self._OnMouseLeave)) 53 53 54 54 def _OnMouseEnter(self, evt): trunk/RBSkinning/demo/wxPythonSkin/components/component_example.py
r496 r528 74 74 return MyComponentModel(self.context) 75 75 76 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 #~ Main 78 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 79 80 if __name__=='__main__': 81 print "Run component_app.py or component_app_adv.py to use this file" 82 trunk/RBSkinning/demo/wxPythonSkin/ctypes/winChangeDisplaySettings.py
r501 r528 42 42 <layout sizercfg='1, wxEXPAND' > 43 43 <button label='800x600'> 44 < event type='EVT_BUTTON' call='ctx.behaviormodel.Change800x600' />44 <command_event type='EVT_BUTTON' call='ctx.behaviormodel.Change800x600' /> 45 45 </button> 46 46 <button label='1024x768'> 47 < event type='EVT_BUTTON' call='ctx.behaviormodel.Change1024x768' />47 <command_event type='EVT_BUTTON' call='ctx.behaviormodel.Change1024x768' /> 48 48 </button> 49 49 <button label='Change Back'> 50 < event type='EVT_BUTTON' call='ctx.behaviormodel.ChangeBack' />50 <command_event type='EVT_BUTTON' call='ctx.behaviormodel.ChangeBack' /> 51 51 </button> 52 52 </layout> trunk/RBSkinning/demo/wxPythonSkin/docking/docking_single_and_multiple.py
r504 r528 26 26 from wxPython import wx 27 27 from RBSkinning import StandardXMLSkinner 28 from RBFoundation. WeakBindimport BindCallable28 from RBFoundation.BindCallable import BindCallable 29 29 30 30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBSkinning/demo/wxPythonSkin/grafting/graft_layout.py
r504 r528 42 42 <command_event type='EVT_BUTTON' call='ctx.behaviormodel.Add' /> 43 43 </button> 44 <button label='Remove '>45 <command_event type='EVT_BUTTON' call='ctx.behaviormodel.Remove ' />44 <button label='Remove All'> 45 <command_event type='EVT_BUTTON' call='ctx.behaviormodel.RemoveAll' /> 46 46 </button> 47 47 </layout> … … 80 80 self.graftlayout.Layout() 81 81 82 def Remove (self, evt):82 def RemoveAll(self, evt): 83 83 # Remove all the children from the panel 84 84 while self.graftlayout.Remove(0): pass trunk/RBSkinning/demo/wxPythonSkin/widgets/htmlwindow.html
r512 r528 3 3 <h1>This is a test!</h1> 4 4 This is a test of the wxHTML widget<br> 5 <center>6 <wxPythonSkin invoke='wxPythonSkinTagWidgetTest'/>7 </center>8 5 </body> 9 6 </html> trunk/RBSkinning/demo/wxPythonSkin/widgets/htmlwindow.py
r512 r528 46 46 </panel> 47 47 </skin:section> 48 <htmlwindow exsizercfg='1, wxEXPAND' address='htmlwindow.html'/>48 <htmlwindow sizercfg='1, wxEXPAND' address='htmlwindow.html'/> 49 49 </layout> 50 50 </panel> trunk/RBSkinning/plans/todo.txt
r512 r528 4 4 wxScrollWindow 5 5 wxGauge 6 wxImageList:7 Plug image id into appropriate widgets8 Set *shared* image lists9 6 wxMultisash: 10 7 Will be tough... trunk/RBTelepathy/RBTelepathy/SocketConnections.py
r445
