File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 134134 return elementBottom > viewportTop && elementTop < viewportBottom ;
135135 } ;
136136
137- window . ltk_widgets = { } ;
137+ window . getWidget = function ( id ) {
138+ return undefined ;
139+ } ;
138140
139141 $ . fn . widget = function ( ) {
140- return window . ltk_widgets [ $ ( this ) . attr ( "ltk_id" ) ] ;
142+ return window . getWidget ( $ ( this ) )
141143 } ;
142144
143145 // change the following to your own development root location
Original file line number Diff line number Diff line change @@ -113,6 +113,10 @@ def get_caller(cls):
113113 frame = frame .f_back
114114
115115
116+ widgets = {}
117+ window .getWidget = proxy (lambda element : widgets [element .attr ("ltk_id" )])
118+
119+
116120class Widget (object ):
117121 """Base class for LTK widgets."""
118122 classes = []
@@ -141,8 +145,9 @@ def __init__(self, *args):
141145 .addClass (" " .join (self .classes ))
142146 .append (* self ._flatten (args ))
143147 )
144- window .ltk_widgets [id (self )] = self
145- self .attr ("ltk_id" , id (self ))
148+ widgets [str (id (self ))] = self
149+ self .attr ("ltk_id" , str (id (self )))
150+ window .console .log ("add widget" , self .element , self .attr ("ltk_id" ))
146151 self ._handle_css (args )
147152 if Widget .INSPECT :
148153 self .on ("mousemove" , proxy (lambda event : self ._on_mousemove (event )))
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66
77[project ]
88name = " pyscript-ltk"
9- version = " 0.2.16 "
9+ version = " 0.2.17 "
1010description = " A little toolkit for writing UIs in PyScript"
1111readme = " README.md"
1212authors = [{ name = " Chris Laffra" , email = " chris@chrislaffra.com" }]
You can’t perform that action at this time.
0 commit comments