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.
editor.apply_ui_theme And editor.present_themed
-
@omz, I have tried both these functions in py3 beta. I am just passing the name of the theme as shown in the settings theme editor, I also tried .json ext. I get a errno 2, file or directory not found.
But there is not much documentation, so I assumed there probably didn't need to be.
Any help appreciated
-
Are you trying this with a custom theme? At the moment, this only really works for built-in themes. For custom themes, you'd need to know the theme's filename, which is basically just a long random string for user themes...
-
@omz , I thought about that. If I use Tomorrow also same error
-
@omz , oops. Sorry you are right.
When I used Tomorrow i was still adding the .json , by itself, it's fine -
Nice addition though. I haven't tested it, but I can visualize it 😱
-
@omz @Phuket2 my solution works on custom themes https://github.com/The-Penultimate-Defenestrator/Pythonista-theme-utils
(Constantly competing with @omz over this one 😛)
-
@Webmaster4o, did you write that before editor theme functions were released? I haven't done much work with them, just played with the built in themes. The only problem I had was that the apply theme func does not change the bg_color or title bar. Not sure if that's on purpose because of a limitation or not. Stops being able to switch themes dynamically from a menu for example as you need to re-present the view. Maybe I did something wrong. But thanks, will have a go with custom views. I see you have a function to get the dir. So I can play around. Even through it sounds like the file names are mangled, the time to look through the styles looking for a name should be minamal. Anyway, will give it a go.
But it's been a good progression through. A lot of have been talking about themes for sometime now. The small example I posted yesterday shows me you can get some nice results. So keep challenging him 😱😎 -
@omz, ok I think I see now. The user files are stored in another directory, which I guess the editor theme functions does not even consider even if you know the file name. Hence the reason @Webmaster4o wrote his loader.
It would be nice if the editor theme functions did consider the user directory also.
-
-
Yeah. From
201005
notes:New editor.apply_ui_theme and present_themed functions for styling ui.Views with a theme (thanks to Luke Taylor for the idea).
-
@Webmaster4o , very nice. I understand why omz did the additional user dir and the uuid generated file names. But there could be another function that specially resolves a user theme, by looking inside the file at the name field. Ok, could be more than one, but if you encounter the name, you just take that file. Can't protect from everything. Don't worry, I am sure he loves being challenged as much as you love challenging. Super nice community here.
-
Yeah. I haven't tested my repo on these custom themes specifically, but it worked on the old kind