"Unsupported File Type"
iisdev last edited by
This is probably a feature request (although I'd be interested if anyone has a work-around via script.) Also, I'm new to iOS so please forgive me if I don't get the terminology correct.
When I tap a file that Pythonista isn't familiar with I receive a message that reads:
Unsupported File Type
This file cannot be opened with Pythonista.
Can we please instead have a screen that looks like this:
so that we can let other apps that have set up handlers open the files in question.
I use python scripts to update and retrieve information as part of my daily workflow. For example - I retrieved a database and a pdf from a client through Python. If I tap the pdf in file view Pythonista's built-in viewer opens it. It's a nice feature but more importantly it allows me (through the sharing widget) to share/export the file with other apps ('Open in:' iBooks, Kindle, Chrome, etc..) When I tap the database all I get is a prompt that reads 'Unsupported File Type' even if I have an app that has registered the file type and can open it.
Can you do it? Pretty please?
omz last edited by
Yes, I plan to improve that. As a workaround, you could write a script that uses the
console.open_in()function to send the file to another app.
iisdev last edited by
Ah, thank you!
One way you could do this is create a scipt that opens the pythonista unreadable file, opens the editor to a tmp.txt of that file. Then make your changes, switch back to console and save it. I do this with the shellista-ssh plugin for using nano on files on the server. I'll make a quick demestration for pythonista.
current_file = editor.get_path()
current_dir = os.path.dirname(current_file)
file_to_open = raw_input('Open which file? ')
TEMP = open(os.path.expanduser('~/Documents/tmp.txt'),'w')
f = open(file_to_open,'r')
raw_input('Press Enter to edit file. When you are finished editing open the console. ')
save = raw_input("Save File? [y/n]")
if save=='y' or save=='Y':
f = open(file_to_open,'w')
print 'File does not exist.'
onionradish last edited by
I'd actually like to add a request to allow opening of text files that have extensions that are common for text files, like "ini" or "cfg". For example, when I use ConfigParser to save configuration or settings, I typically save it as an *.ini file, which then becomes uneditable.
Thanks to briarfox for a workaround.
ui.WebView, to open any type of file.
For instance the ace editor is very full featured, I'm sure there are others. It supports hilihting, etc for hundreds of different languages. Presenting in a
panelmakes this very natural to swap back and forth between console.
WebViewcan open file:// type urls, if os.path.abspath is used. Using a webview delegate would allow custom callbacks, if needed, though one could also create the ui elements in pythonista, which call editor functions through
ccc last edited by
@JonB, This sounds supercool... Would you be willing to create a repo of code?
Here is what I came up with.
This uses editarea. I started with ace, but that seems to have keyboard issues on mobile.
I also tried codemirror... I really like some of the modes. There's a fork with ios support, but it is flaky, again keyboard/selecting.
Then, I used editarea for a while, but it had an annoying ghosting issue. Later figured out opacity of hidden in css was too high, setting it lower mostly works. Sometimes keyboard doesn't work until you change focus, or min keyboard.
It does have tabbed multifile support, which I have turned off... Need to implement js to python callbacks through custom urls. Eventually a shellista plugin.
I'd love to see how you handled orientation changes, etc!
I'm using CKEditor as I want wysiwyg editing of html.
For orientation it's easiest to addEventListener for orientationchange in the html.
There's no simple equivalent for the keyboard show/hide in the html ( though you could load a java package like http://github.com/driftyco/ionic-plugins-keyboard/tree/60b803617af49a10aff831099db90340e5bb654c ).
Here's a little tool to browse files and use 'Open in' on any of them....
The shellista dev-modular branch now includes nano. It will open any file as text to allow editing.
@JonB I've now got all the resizing into the python script evaluating java. Here are the 5 events I'm handling and where:
1 initial size: set in webview_did_finish_load 2 orientation change (keyboard hidden): handled in View layout 3 orientation change (keyboard shown): handled in View keyboard_frame_will_change 4 keyboard shown: handled in View keyboard_frame_will_change 5 keyboard hidden: handled in View keyboard_frame_will_change
Do you have a repo someplace?
@JonB Here's the code... you'd have to adjust the View layout section if you have anything other than orientation changes triggering the layout.
# see code for EditView class
Edit: JonB... note it gives -90 not 270