MCPcopy Create free account
hub / github.com/PaulleDemon/PyUIBuilder / getLayoutCode

Function getLayoutCode

src/frameworks/tkinter/widgets/checkButton.js:174–211  ·  view source on GitHub ↗

* * The index is required for pack as in pack every widget would be packed on top of each other in radio button

({index=0})

Source from the content-addressed store, hash-verified

172 * The index is required for pack as in pack every widget would be packed on top of each other in radio button
173 */
174 getLayoutCode({index=0}){
175 let layoutManager = super.getLayoutCode()
176
177 const {layout: parentLayout, direction, gap, align="start"} = this.getParentLayout()
178 const absolutePositioning = this.getAttrValue("positioning")
179
180
181 if (parentLayout === Layouts.PLACE || absolutePositioning){
182 const config = {}
183
184 const elementRect = this.firstDivRef.current?.getBoundingClientRect()
185
186 config['x'] = Math.trunc(this.state.pos.x)
187 config['y'] = Math.trunc(this.state.pos.y)
188
189 if (elementRect?.height){
190 config['y'] = Math.trunc(config['y'] + (index * elementRect.height)) // the index is the radiobutton index
191 }
192
193 // config["width"] = Math.trunc(this.state.size.width)
194 // config["height"] = Math.trunc(this.state.size.height)
195
196 if (!this.state.fitContent.width){
197 config["width"] = Math.trunc(this.state.size.width)
198 }
199 if (!this.state.fitContent.height){
200 config["height"] = Math.trunc(this.state.size.height)
201 }
202
203 const configStr = convertObjectToKeyValueString(config)
204
205 layoutManager = `place(${configStr})`
206
207 }
208
209 return layoutManager
210
211 }
212
213 generateCode(variableName, parent){
214

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected