When i do
for x in self.page.getViews():
i get a nice list of component models.
But no matter how i try to get one element out of the array i keep getting ComponentModelScriptWrapper$SafetyWrapper
objects instead and these dont have the funcionality i need am i selecting them wrong or is there no way to get them? judging by the name"safetywrapper" im guessing it gets blocked by design:/
Hm im guessing what ever im trying wont work anyways nvm. i guess i’ll have to make my own component for it
This all begs the question: What are you trying to do where you need access to the children?
im trying to add event listerens to them. it worked fine in vision to do something like this with java swing action handlers.
But i suppose its not possible to add js script handlers in runtime anyways so ill have to think of somethign else xd
What i made in vision was a button that added(and removed) events to all componets. on click these opened a popup with a table containting all their text, tooltips, dataset labels. Super usefull for translating^^
Now for perspective a have a working event listerer that works on selected text, but its hard to use with dropboxes and tooltips. so now im looking to add events on all componets too.
if i make a custom component.
looking through it i think i can find everything i need in window.__client.page.views._data
going a bit deeper i can find the paths,recoruce paths and all the props.
if i can reconstruct the path… and add events on each div that has a [data-component-path] and manage to link those… i suppose i could add events in run time that have all the relevant info that i need, window.__client.page.views._data.value.value.root.childComponents.def.props
but its quite a soup going through all those, especiialy if there are containers and emmebeded views xd
ah no it seems the props there say “bidning” if its a binding instead of showing the value:(
gdamned what now xD
do one of the relevant components have a function to read the active values?
This really seems like you’re trying to solve a specific problem with a specific solution without considering others.
What’s the actual purpose behind this metaprogramming?
Yes… Ive been tasked to build and improve a translation manager inside a client app. So that they can translate keys without having to go into the designer.
We work with a bunch of different countries in EU and USA so we have a lot of different languages that not all our programmers know. So when a client notices a wrong translation they (or their admin) can change it themselves without having to contact us.
At first i made a table similar to the desingers translation manager in both vision and perspective. It works as intended, but its hard to know which keys there are ect.
Then ive added a way to import a bunch of keys reading through the resource files searching for text, tooltiptext and titles. This is rather slow and does not work for views with dynamic labels and such.
Then ive made a custom component in perspective that triggers an event on when text is selected. This opens a popup with the relevant key/translations. We all found it very usefull to have.
Then ive tried making something similar for vision, but text of labels cant be selected there so i went a different route to dynamically add rightclick events on all components ( in the open windows) that trigger a popup for translations to appear. A big advantage here is that i can also open tooltips and even whole comboboxes this way. Which is even more usefull than just the selected text i made in perspective.
So now i want to upgrade my component from perspective to have something similar where i can select a component and read the text tooltips and combox labels.
But im running into a bunch of problems as stated in previous posts xd
(in all the popups and table we also have a button for an auto translator using DeepL)
sry for the long read:p
is their a way to get the component path in a jython script? like the html attr