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.
PackUI - package a .py and .pyui file into one script
-
Since there doesn't yet appear to be any good way to share a UI script and its corresponding .pyui file, I decided to write this small utility: https://github.com/Pythonista-Tools/Pythonista-Tools/blob/master/UI/PackUI.py
Basically it takes both a .py and .pyui file and packages them into a single script, which, when run, will extract both files again.
Originally I planned to make the resulting script be the original program with the .pyui file and an extraction process added, though in the end I decided against it to avoid potential incompatibilities and to allow editing of the .pyui file. It would probably be possible to implement this, so if anyone wants to, feel free to use all of or parts of my code.
-
It is really cool... I made some modifications because all the backslashes were making me go cross eyed. I hope I did not "break the build".
-
Ah thanks, looks fine to me. I never really figured out how to insert variables into strings using .format(), so my code was a little inefficient in that respect.
-
Test case: Does this encode/decode work for a script that contains the following code?
a = "double'quoted string" b = 'single"quoted string' c = """triple-double quoted string with "double'quoted" and 'single"quoted' strings inside""" d = '''triple-single quoted string with "double'quoted" and 'single"quotes' strings inside'''
-
It looks like the triple quotes for PYFILE and PYUIFILE got lost, will fix that. Other than that it seems to work fine.
-
Does this allow for multiple pyui files in the same "packing"?
-
At the moment, no. It would definetely be possible to implement, though it would require a better UI to select multiple files. If you have more than one or two files to distribute it would probably also be better to set up a GitHub repo. That way updating will also be easier, as you only need to update the files that actually changed.