Possible to share pyui files?
dgelessus last edited by dgelessus
There are a few ways.
pyuifiles are actually just JSON files, so they can technically be shared just like any other text file.
First of all you can use Pythonista's built-in share button to upload an entire folder's contents to https://gist.github.com/, which will include any
pyuifiles. Downloading those files again is not as straightforward, Pythonista has no built-in functionality for that. There is a utility named gistcheck which can be used to download gists.
You can also keep the
pyuifiles in a normal Git(Hub) repo, since they are just text files. The best ways to use Git repos in Pythonista at the moment are StaSh and @JonB's gitview/gitui. (Gists are also Git repos, so you can use those tools to download and manage gists too.)
Then there's also a small utility called PackUI that I wrote a while back, which creates a "self-extracting" Python script containing a
pyuifile. Its functionality is very limited compared to the other options, but it requires no additional tools for the end user.
Webmaster4o last edited by Webmaster4o
For an even easier solution, just rename the file with a .json ending (Not sure if you can do this in 1.5). Alternatively, use
and copy/paste that.
dgelessus last edited by
If you want to copy it directly, you can use the
import clipboard with open("thing.pyui") as f: clipboard.set(f.read())
dgm last edited by
Thank you! The PackUI script is perfect! I will mess around with reading, printing, and copying later.
Is it ok for me to post the results here if anyone wants to check it out? They seem kind of long.
Cethric last edited by
@dgm while posting the code is allowed it is good practice to put it some where more appropriate (GitHub, GitLab, Mecurial, PasteBin, BitBucket, etc) and then post the link to it here, as this also makes it easier for us to play around with your programs. We can simply download it instead of trying to copy and paste the HTML version of the code.
It also means we can provide more constructive feedback.
dgm last edited by dgm
TutorialDoctor last edited by
How would I change the file to a .json ending. adding it directly to the filename only makes it file_name.json.pyui
This method sounds like a good one where you can simple change the json file back to pyui when it is downloaded.
omz last edited by
@TutorialDoctor This is only possible in the beta.
brumm last edited by
Webmaster4o last edited by
@TutorialDoctor I should have said not sure if it will work in 1.5. That was a typo. It won't work unless you're on the beta.
JonB last edited by
You can use os.rename() to rename a file from pyui to json...
dgelessus last edited by
Renaming files and folders using Python's library functions works normally on 1.5, as @JonB said. The file name box in the editor is however very persistent in keeping the current file extension. This has been changed in the beta, now changing a file's extension is much easier.
TutorialDoctor last edited by TutorialDoctor
Last night I figured out a neat way to share pyui files. I created two actions, one that converts pyui files into json, and another to convert json into pyui. This way we can share the .json files and things are well.