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.
Script to storyboard
-
Hi! I want to be able to write video scripts on my iPad, and then be able to press a button to have the script spit out into a page format that I can use to storyboard the animations for each line of the script.
I'd want each paragraph of script to be sectioned, with a box for the storyboarding next to it. Like in this image (the squiggly line would be a paragraph of the script): http://i.imgur.com/1FvO0UH.png
Any way to do this?
-
I'm just putting ideas out here, but split the paragraphs with
str.split('\n')
and then use a tableview with a custom cell to display the text and astoryboard
view. Then tell the scrollview to break on pages. -
@Cethric said:
I'm just putting ideas out here, but split the paragraphs with str.split('\n') and then use a tableview with a custom cell to display the text and a storyboard view. Then tell the scrollview to break on pages.
Is this very difficult to do if I've never worked in Editorial or Python? If so, are there people who might be able to put this together for a few bucks?
-
This is just a really basic concept for it, but add this to a workflow calling this script and see if it does what you want.
import editor import os import webbrowser TEMPLATE = '''<html> <head> </head> <body> <table> {} </table> </body> </html> ''' TEMPLATE_ROW = '''<tr> <td> {} </td> <td> <div style='width: 300px; height: 300px; border: 1px solid black;'> </div> </td> </tr> ''' def createTables(text=None): if text is None: text = editor.get_text() path = os.path.join(os.path.expanduser('~/Documents'), '.tmp.html') with open(path, 'wb') as f: f.write(TEMPLATE.format('\n'.join([ TEMPLATE_ROW.format(x) for x in text.split('\n') if x != '' ]))) webbrowser.open("file://{}".format(path)) createTables()
-
Thanks for your help so far. I bought Editorial, and then I made a new workflow which is just "run python script" with the code you provided. But I get an error message (Line 29: name error: global name os is not defined). What am I doing wrong?
Thanks!
-
Sorry didn't realise I forgot to add that. At the top of the python file add
import os
that should fix it. -
@Cethric said:
Sorry didn't realise I forgot to add that. At the top of the python file add
import os
that should fix it.You're a hero man - this is exactly what I wanted! :)
-
As a bonus, is there a way to set the html file's name? Currently it's temp.html but I'd like it to be set to the Editorial document's name.
I assume I just need to replace "tmp.html" with a variable but I don't know what variable Editorial uses for the document name.
-
Yes
.tmp.html
can simply be changed to any value you want. The following code does this automatically for you:def createTables(text=None, name=None): if text is None: text = editor.get_text() if name is None: name = '{}.html'.format(os.path.basename(editor.get_path())) path = os.path.join(os.path.expanduser('~/Documents'), name) with open(path, 'wb') as f: f.write(TEMPLATE.format('\n'.join([ TEMPLATE_ROW.format(x) for x in text.split('\n') if x != '' ]))) webbrowser.open("file://{}".format(path))
However I would recommend against this on the basis that, if the
.html
was not appended to the name (or even just changing the name in any way shape or form) then it will replace the contents of the file you are working on. While this might be decent when rendered out it is not as easy to read as markdown is asplaintext
. Hence I have used.tmp.html
as only one file can be open at a time and this reduces 'clutter' from your documents folder (instead of dozens ofxyz.md.html
duplicate files there is just one.tmp.html
)..tmp.html
can be deleted whenever you want and will not damage you script file. (Also adding the prefix of.
means the file will be hidden (reducing visual clutter)). Sorry if this has gone to far off on a wild tangent. Hope it answers your question as well...