Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Proof of concept HTML Editor
-
see https://omz-forums.appspot.com/pythonista/post/5338101740208128
basically you implement a custom delegate for your webview that lets you pass commands initiated from JavaScript to be executed in Python. in that case, it was logging (but note this gives you access to the window errors and any console.log calls, which can be very useful). but you may find other uses. -
@JonB thank you, this really looks like it could be useful
-
@JonB I am currently in the process of changing the html editor to use CodeMirror as it actually looks like a beter option over ACE. Once I can get git working on my iPad again I will update the repo but so far the focus issue is gone and the use of a webview deligate is considerably better than a thread continuously polling the view. Thanks again
-
Is there a way of dynamically setting the background colour and the text colour of a ui.TableViewCell?
Also is there a faster method to apply the colour settings to the presented view than what is currently being used? -
tableview stuff gets set in the delegate. i believe you can call table reload (or refresh?) to apply the new theme to the existing cells. there are ways to access cell properties through callbacks, but otherwise iirc there is not an easy way to find tableviewcells from the top down.
i dont quite follow what you are doing themewise.... but are you parsing css to set the theme? is that slow, or just the recursive walking of the view tree? if the css parse is the bottleneck, just grab the colors direct from javascript.
one thing that might make things seem faster, would be to call the recursive style set as part of an animation, with a short animation duration (0.1 sec say). that way, the colors will appear to all change at once instead of trickling in.
alternatively, playing with either calling that in the background, or not, might make the ui more responsive.
-
Ok I will look into creating a custom delegate then.
The collection of themes is loaded into a variable (
themes_data
) so i only need to load the css files once, so even if it was slow initially repeated calls after the initial set up only make calls to the preloaded variable. I believe it is the recursive walk of the view tree that is the issue.
Currently the colour changes are performed in the background.
I will look into loading the colours as part of an animation.Thanks
-
the other approach, which may be faster, would be to build a list structure of all themesble objects, one time. then, you dont need to recurse through views, which might be slow due to repeated subviews calls, and the recursive nature, which involves many slow function calls. so, build a list one time (or, if you have a lot of dynamic components, youll have to keep track of them as they are added /deleted)
this would let you use list comprehension or maps to set the attributes, looping one time over the list which you have already prefiltered (eliminating all those other checks for name, etc). since list comprension /maps are optimized in c, it might yield better performance.