123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134 |
- import os
- import datetime
- import json
- import gi
- gi.require_version('Gtk', '3.0')
- from gi.repository import Gtk
- import zipfile
- import re
- from settings import talk
- from studio import checklist
- def get_legacy(project_location):
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- data = {
- "fraction": 0.0,
- "camera" : [0,0],
- "selected": [],
- "active": None,
- "scenes" : {},
- "arrows" : [],
- "links" : [],
- "markers": {},
- "events" : {}
- }
-
-
-
-
-
-
-
-
-
-
- bos = open(project_location+"/pln/main.bos")
- bos = bos.read()
-
- cx, cy = 1, 1
-
- if "</camera>" in bos:
- camera = bos[bos.find("<camera>")+8:]
- camera = camera[:camera.find("</camera>")]
- camera = camera.split(",")
-
- for num, val in enumerate(camera):
- try:
- camera[num] = float(val)
- except:
- camera[num] = 0.0
-
- try:
- cx = float(camera[2])
- cy = float(camera[3])
- except:
- pass
- print (cy, cx)
-
-
-
-
-
-
-
- camera = [camera[0], camera[1]]
-
- data["camera"] = camera
-
-
-
-
-
-
-
-
-
-
-
-
- if "</event>" in bos:
- for event in bos.split("</event>")[:-1]:
- event = event[event.find("<event>")+8:]
-
-
-
-
-
- eventname = event[event.find('"')+1:event.replace('"'," ",1).find('"')]
-
-
-
- c = event[event.find('[')+1:event.find(']')]
- c = c.split(",")
-
- eventpositon = [float(c[0])*cx,float(c[2])*cy]
- eventsize = [float(c[1])*cx,60.0]
-
-
-
-
- eventtext = event[event.find(']')+2:-1]
-
-
-
-
-
-
-
-
- if not "<scene>" in eventtext:
-
- if eventname in data["scenes"]:
- eventname = eventname + "_copy"
-
- data["scenes"][eventname] = {
- "fraction":0.0,
- "position":eventpositon,
- "size":eventsize,
- "parent":"",
- "shots":[[
- "text_block",[["text", eventtext]]
- ]]
- }
-
- else:
-
-
-
-
- aos = eventtext.count("<scene>")
-
- parent = ""
-
- if aos > 1:
- parent = eventname
-
- data["events"][eventname] = {
- "position":eventpositon,
- "size":[0,0]
- }
-
-
-
- for num, scene in enumerate(eventtext.split("</scene>")[:-1]):
-
- scenename = scene[scene.find('"')+1:scene.replace('"'," ",1).find('"')]
- scenename = scenename.replace(" ", "_")
- scenetext = scene[scene.replace('"', " ", 1).find('"')+1:-1]
-
-
- scenesize = [eventsize[0] / aos , eventsize[1]]
- sceneposition = [eventpositon[0] + scenesize[0]*num,
- eventpositon[1]]
-
-
- data["scenes"][scenename] = {
- "fraction":0.0,
- "position":sceneposition,
- "size":scenesize,
- "parent":parent,
- "shots":[[
- "text_block",[["text", scenetext]]
- ]]
- }
-
-
-
- for scenename in data["scenes"]:
-
- scenetext = data["scenes"][scenename]["shots"][0][1][0][1]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- shots = []
-
- sa = scenetext.count("<shot>")
- ts = scenetext
-
- for s in range(sa):
-
-
-
- if not ts.startswith("<shot>"):
- shots.append([
- "text_block", [["text",ts[:ts.find("<shot>")]]]
- ])
-
-
-
- ts = ts[ts.find("<shot>")+6:]
-
-
-
- if ts.count('"') > 1:
- shotname = ts[ts.find('"')+1:ts.replace('"', " ", 1).find('"')]
- ts = ts[ts.replace('"', " ", 1).find('"')+1:]
- else:
- shotname = "Unnamed"
-
-
-
-
-
- shots.append([
- "shot_block", shotname, [["text",ts[:ts.find("</shot>")]]]
- ])
-
-
-
- ts = ts[ts.find("</shot>")+7:]
-
- shots.append([
- "text_block", [["text",ts]]
- ])
-
-
-
-
-
- shotsfractions = []
-
- for shot in shots:
- if shot[0] == "shot_block":
-
-
-
- if os.path.exists(project_location\
- +"/rnd/"+scenename+"/"+shot[1]+"/shot.progress"):
-
- check = checklist.get_list(project_location\
- +"/rnd/"+scenename+"/"+shot[1]+"/shot.progress")
- shotsfractions.append(check["fraction"])
- else:
-
- folder = project_location\
- +"/rnd/"+scenename+"/"+shot[1]
-
- try:
-
- if len(os.listdir(folder+"/rendered")) > 0:
- shotsfractions.append(1.0)
-
- elif len(os.listdir(folder+"/test_rnd")) > 0:
- shotsfractions.append(0.8)
-
- elif len(os.listdir(folder+"/opengl")) > 0:
- shotsfractions.append(0.6)
-
- elif len(os.listdir(folder+"/storyboard")) > 0:
- shotsfractions.append(0.4)
-
- elif len(os.listdir(folder+"/extra")) > 0:
- shotsfractions.append(0.2)
- except:
- shotsfractions.append(0.0)
-
-
-
- data["scenes"][scenename]["shots"] = shots
-
-
-
- try:
- data["scenes"][scenename]["fraction"] = \
- sum(shotsfractions) / len(shotsfractions)
- except:
- data["scenes"][scenename]["fraction"] = 0.0
-
-
-
-
-
- for scenename in data["scenes"]:
- for shotnum, shot in enumerate(data["scenes"][scenename]["shots"]):
-
-
-
-
- if shot[0] == "shot_block":
- text = shot[2][0][1]
- else:
- text = shot[1][0][1]
-
-
-
-
- textblock = []
-
-
-
-
- part = ""
- skip = 0
-
- for num, letter in enumerate(text):
-
- if num >= skip:
-
- if part.endswith("<item>"):
-
-
- if part[skip:].replace("<item>", ""):
- textblock.append([
- "text", part[skip:].replace("<item>", "")
- ])
-
-
- itempart = text[num:text[num:].find("</item>")+num]
- link = itempart[itempart.find('"')+1:
- itempart.replace('"', " ", 1).find('"')]
-
- if link.startswith("/dev"):
- link = link[4:]
-
- itemtext = itempart[itempart.replace('"', " ", 1).find('"')+1:]
-
-
- textblock.append([
- "link", link, itemtext
- ])
-
-
- skip = text[num:].find("</item>")+6
- part = ""
-
-
-
- elif part.endswith("<image>"):
-
-
- if part[skip:].replace("<image>", ""):
- textblock.append([
- "text", part[skip:].replace("<image>", "")
- ])
-
-
- link = text[num:text[num:].find("</image>")+num]
-
- textblock.append([
- "image", link
- ])
-
-
- skip = text[num:].find("</image>")+7
- part = ""
-
-
-
-
- elif part.endswith("[image]"):
-
-
- if part[skip:].replace("[image]", ""):
- textblock.append([
- "text", part[skip:].replace("[image]", "")
- ])
-
-
- link = text[num:text[num:].find("[/image]")+num]
-
- textblock.append([
- "image", link
- ])
-
-
- skip = text[num:].find("[/image]")+7
- part = ""
-
-
-
-
- elif part.endswith(" - ["):
-
-
- if part[skip:].replace(" - [", ""):
- textblock.append([
- "text", part[skip:].replace(" - [", "")
- ])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- character = []
-
-
-
- if textblock[-1][0] == "link":
- character = textblock[-1]
- del textblock[-1]
-
-
-
- elif textblock[-1][0] == "text":
- character = textblock[-1][1]
- character = character[character.rfind("\n")+1:]
-
- if character:
- textblock[-1][1] = textblock[-1][1].replace(character, "")
- character = ["text", character]
-
-
- frase = text[num:text[num:].find("]")+num]
-
-
-
- if character:
- textblock.append([
- "frase", character, frase
- ])
-
-
-
- skip = text[num:].find("]")
- part = ""
-
- else:
- part = part + letter
-
-
- textblock.append([
- "text", part[skip:]
- ])
-
- if shot[0] == "shot_block":
- data["scenes"][scenename]["shots"][shotnum][2] = textblock
- else:
- data["scenes"][scenename]["shots"][shotnum][1] = textblock
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- bos = bos[bos.rfind("</event>"):]
-
-
-
- bos = bos.split("\n")
-
- for line in bos:
-
-
-
- if line.startswith("<arrow>"):
-
- arrow = line[line.find("<")+7:line.rfind("</")].split(" --> ")
- newarrow = []
- for i in arrow:
- i = i.split(",")
- if i[0] != "-1":
- newarrow.append([
- "scene", i[1][1:-1]
- ])
- else:
- newarrow.append(
- i[1][1:-1]
- )
- data["arrows"].append(newarrow)
-
-
-
-
- elif line.startswith("<image>"):
- stuff = line.split(",")
- link = stuff[3][1:-1]
- coordinates = []
- try:
- coordinates.append(float(stuff[0].replace("<image>", ""))*cx)
- except:
- coordinates.append(0.0)
-
- try:
- coordinates.append(float(stuff[1])*cy)
- except:
- coordinates.append(0.0)
-
-
-
-
-
-
-
-
- linktype = "file"
-
- if "/renders/Preview." in link:
- linktype = "asset"
- link = link[:link.rfind("/renders/Preview.")].replace("/dev", "")
-
- data["links"].append([
- linktype, link, coordinates, ""
- ])
-
-
-
-
-
- elif line.startswith("<marker>"):
- marker = line.replace("<marker>", "").replace("</marker>", "").split(",")
-
- try:
- markloc = float(marker[0])
- except:
- markloc = 0.0
-
- markstring = marker[1].replace('"', "")
-
-
-
-
-
-
-
-
-
- data["markers"][markstring] = [markloc, 0.0, ""]
-
-
-
-
-
-
-
-
- fractions = []
- lastarrow = 'start'
-
-
- for i in data["arrows"]:
- if lastarrow == "end":
- break
- for arrow in data["arrows"]:
- if arrow[0] == lastarrow:
- lastarrow = arrow[1]
- if arrow[1] != "end":
- fractions.append(
- data["scenes"][arrow[1][1]]["fraction"]
- )
- else:
- break
-
-
-
- try:
- data["fraction"] = sum(fractions) / len(fractions)
- except:
- data["fraction"] = 0.0
-
-
-
-
- return data
-
- def get_asset_data(win, name, force=False):
-
-
-
- if name not in win.assets or force:
-
- data = {
- "fraction":0.0
- }
-
- try:
-
- if os.path.exists(win.project+"/ast/"+name+".blend"):
- data["fraction"] = 1.0
- else:
- check = checklist.get_list(win.project+"/dev/"+name+"/asset.progress")
- data["fraction"] = check["fraction"]
- except:
- pass
-
- win.assets[name] = data
-
- return win.assets[name]
-
- def save(project, story):
-
-
-
-
- try:
- os.mkdir(project+'/pln/')
- except:
- pass
-
- with open(project+'/pln/story.vcss', 'w') as fp:
- json.dump(story, fp, sort_keys=True, indent=4)
- def load(project):
-
-
- try:
- with open(project+'/pln/story.vcss') as json_file:
- data = json.load(json_file)
- except:
-
-
- data = {
- "fraction": 0.0,
- "camera" : [0,0],
- "selected": [],
- "active": None,
- "scenes" : {},
- "arrows" : [],
- "links" : [],
- "markers": {},
- "events" : {}
- }
-
-
-
-
-
- for scenename in data["scenes"]:
-
- shotsfractions = []
- for shot in data["scenes"][scenename]["shots"]:
- if shot[0] == "shot_block":
-
-
-
- if os.path.exists(project\
- +"/rnd/"+scenename+"/"+shot[1]+"/shot.progress"):
-
- check = checklist.get_list(project\
- +"/rnd/"+scenename+"/"+shot[1]+"/shot.progress")
- shotsfractions.append(check["fraction"])
- else:
-
- folder = project\
- +"/rnd/"+scenename+"/"+shot[1]
-
- try:
-
- if len(os.listdir(folder+"/rendered")) > 0:
- shotsfractions.append(1.0)
-
- elif len(os.listdir(folder+"/test_rnd")) > 0:
- shotsfractions.append(0.8)
-
- elif len(os.listdir(folder+"/opengl")) > 0:
- shotsfractions.append(0.6)
-
- elif len(os.listdir(folder+"/storyboard")) > 0:
- shotsfractions.append(0.4)
-
- elif len(os.listdir(folder+"/extra")) > 0:
- shotsfractions.append(0.2)
- except:
- shotsfractions.append(0.0)
-
- try:
- data["scenes"][scenename]["fraction"] = \
- sum(shotsfractions) / len(shotsfractions)
- except:
- data["scenes"][scenename]["fraction"] = 0.0
-
-
-
-
- fractions = []
- lastarrow = 'start'
-
-
- for i in data["arrows"]:
- if lastarrow == "end":
- break
- for arrow in data["arrows"]:
- if arrow[0] == lastarrow:
- lastarrow = arrow[1]
- if arrow[1] != "end":
- fractions.append(
- data["scenes"][arrow[1][1]]["fraction"]
- )
- else:
- break
-
-
-
- try:
- data["fraction"] = sum(fractions) / len(fractions)
- except:
- data["fraction"] = 0.0
-
-
- return data
-
- def undo_record(win):
-
-
-
-
-
-
-
- try:
- limit = int(win.settings["Undo_Limit"])
-
-
- win.undo_index = min(len(win.undo_history)+1, limit)
-
-
- f = open(win.project+'/pln/story.vcss')
-
- win.undo_history.append(f.read())
-
-
-
- win.undo_history = win.undo_history[0-limit:]
- except:
- pass
- def undo(win):
-
-
-
-
-
- win.undo_index = max(0, win.undo_index-1)
-
-
-
- d = win.undo_history[win.undo_index]
-
-
- f = open(win.project+'/pln/story.vcss', "w")
- f.write(d)
- f.close()
-
-
- win.story = load(win.project)
- def redo(win):
-
-
-
-
-
- win.undo_index = min(len(win.undo_history)-1, win.undo_index+1)
-
-
-
- d = win.undo_history[win.undo_index]
-
-
- f = open(win.project+'/pln/story.vcss', "w")
- f.write(d)
- f.close()
-
-
- win.story = load(win.project)
-
- def export_to_odt(win):
-
-
-
-
-
-
-
-
-
-
- folderchooser = Gtk.FileChooserDialog(talk.text("export_tooltip"),
- None,
- Gtk.FileChooserAction.SAVE,
- (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
- folderchooser.set_default_response(Gtk.ResponseType.OK)
- response = folderchooser.run()
- if response == Gtk.ResponseType.OK:
- savefilename = folderchooser.get_filename()
- else:
- folderchooser.destroy()
- return
- folderchooser.destroy()
-
-
-
-
-
-
- referencefile = "/new_file/reference.odt"
-
-
-
- try:
- os.system("rm -rf /tmp/odt_export")
- except:
- pass
-
-
- os.makedirs("/tmp/odt_export")
-
-
-
- ref = zipfile.ZipFile(os.getcwd()+referencefile, "r")
- ref.extractall("/tmp/odt_export")
- ref.close()
-
-
-
-
-
- try:
- os.remove("/tmp/odt_export/Pictures/1000020100000780000004380D1DEC99F7A147C7.png")
- except:
- pass
-
-
-
-
-
-
-
- save = open("/tmp/odt_export/content.xml", "w")
-
-
-
-
- save.write('''<?xml version="1.0" encoding="UTF-8"?><office:document-content xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" office:version="1.2"><office:scripts/><office:font-face-decls><style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit Devanagari'"/><style:font-face style:name="Mitra Mono" svg:font-family="'Mitra Mono'" style:font-pitch="fixed"/><style:font-face style:name="Nimbus Mono PS" svg:font-family="'Nimbus Mono PS'" style:font-pitch="fixed"/><style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Noto Sans CJK SC" svg:font-family="'Noto Sans CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Footer"><style:text-properties officeooo:paragraph-rsid="0028a095"/></style:style><style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0017b0ac"/></style:style><style:style style:name="frase_name" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/><style:text-properties style:font-name="Nimbus Mono PS" fo:font-weight="bold" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0017b0ac" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="P4" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/><style:text-properties style:font-name="Nimbus Mono PS" fo:font-size="22pt" fo:font-weight="bold" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0017b0ac" style:font-size-asian="19.25pt" style:font-weight-asian="bold" style:font-size-complex="22pt" style:font-weight-complex="bold"/></style:style><style:style style:name="P5" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/><style:text-properties style:font-name="Nimbus Mono PS" fo:font-size="22pt" fo:font-weight="bold" officeooo:rsid="001af4f2" officeooo:paragraph-rsid="001af4f2" style:font-size-asian="19.25pt" style:font-weight-asian="bold" style:font-size-complex="22pt" style:font-weight-complex="bold"/></style:style><style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/><style:text-properties style:font-name="Nimbus Mono PS" fo:font-size="18pt" fo:font-weight="bold" officeooo:rsid="001af4f2" officeooo:paragraph-rsid="001af4f2" style:font-size-asian="15.75pt" style:font-weight-asian="bold" style:font-size-complex="18pt" style:font-weight-complex="bold"/></style:style><style:style style:name="P7" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/><style:text-properties style:font-name="Nimbus Mono PS" fo:font-size="14pt" fo:font-weight="bold" officeooo:rsid="001af4f2" officeooo:paragraph-rsid="001af4f2" style:font-size-asian="12.25pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="bold"/></style:style><style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard"><style:text-properties officeooo:paragraph-rsid="0017b0ac"/></style:style><style:style style:name="P9" style:family="paragraph" style:parent-style-name="Standard"><style:text-properties fo:color="#666666" style:font-name="Nimbus Mono PS" fo:font-size="10.5pt" fo:font-style="italic" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0017b0ac" style:font-size-asian="10.5pt" style:font-style-asian="italic" style:font-size-complex="10.5pt" style:font-style-complex="italic"/></style:style><style:style style:name="frase" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name=""><loext:graphic-properties draw:fill="none"/><style:paragraph-properties fo:margin-left="1in" fo:margin-right="1in" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0in" style:auto-text-indent="false" style:page-number="auto" fo:background-color="transparent"/><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0017b0ac"/></style:style><style:style style:name="P11" style:family="paragraph" style:parent-style-name="Standard"><loext:graphic-properties draw:fill="none"/><style:paragraph-properties fo:margin-left="1in" fo:margin-right="1in" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0in" style:auto-text-indent="false" fo:background-color="transparent"/><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0017b0ac"/></style:style><style:style style:name="scene_name" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:text-align="start" style:justify-single-word="false" fo:break-before="page"/><style:text-properties style:font-name="Nimbus Mono PS" fo:font-weight="bold" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0017b0ac" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="P13" style:family="paragraph" style:parent-style-name="Standard"><loext:graphic-properties draw:fill="none"/><style:paragraph-properties fo:margin-left="0in" fo:margin-right="1in" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0in" style:auto-text-indent="false" fo:background-color="transparent"/><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0024426e"/></style:style><style:style style:name="image_style" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name=""><loext:graphic-properties draw:fill="none"/><style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0in" style:auto-text-indent="false" style:page-number="auto" fo:background-color="transparent"/><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0028a095"/></style:style><style:style style:name="P15" style:family="paragraph" style:parent-style-name="Standard"><loext:graphic-properties draw:fill="none"/><style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0in" style:auto-text-indent="false" fo:background-color="transparent"/><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" officeooo:paragraph-rsid="0028a095"/></style:style><style:style style:name="P16" style:family="paragraph" style:parent-style-name="Standard"><loext:graphic-properties draw:fill="none"/><style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0in" style:auto-text-indent="false" fo:background-color="transparent"/><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0028a095" officeooo:paragraph-rsid="0028a095"/></style:style><style:style style:name="P17" style:family="paragraph" style:parent-style-name="Standard"><loext:graphic-properties draw:fill="none"/><style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" fo:text-align="center" style:justify-single-word="false" fo:text-indent="0in" style:auto-text-indent="false" fo:background-color="transparent"/><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0028a095" officeooo:paragraph-rsid="0028a095" fo:background-color="#808080"/></style:style><style:style style:name="T1" style:family="text"><style:text-properties fo:font-weight="bold" fo:background-color="transparent" loext:char-shading-value="0" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="T2" style:family="text"><style:text-properties fo:font-weight="bold" fo:background-color="#ffffff" loext:char-shading-value="0" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="T3" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac"/></style:style><style:style style:name="T4" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017cba4"/></style:style><style:style style:name="shot_1" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" fo:background-color="#ffb66c" loext:char-shading-value="0"/></style:style><style:style style:name="shot_2" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" fo:background-color="#ffe994" loext:char-shading-value="0"/></style:style><style:style style:name="shot_3" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" fo:background-color="#e0c2cd" loext:char-shading-value="0"/></style:style><style:style style:name="shot_4" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" fo:background-color="#b4c7dc" loext:char-shading-value="0"/></style:style><style:style style:name="shot_5" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0017b0ac" fo:background-color="#afd095" loext:char-shading-value="0"/></style:style><style:style style:name="T10" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" officeooo:rsid="0028a095"/></style:style><style:style style:name="T11" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" fo:font-weight="bold" officeooo:rsid="0028a095" fo:background-color="#ffffff" loext:char-shading-value="0" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="T12" style:family="text"><style:text-properties style:font-name="Nimbus Mono PS" fo:font-weight="normal" officeooo:rsid="0028a095" fo:background-color="#ffffff" loext:char-shading-value="0" style:font-weight-asian="normal" style:font-weight-complex="normal"/></style:style><style:style style:name="T13" style:family="text"><style:text-properties officeooo:rsid="0028a095"/></style:style><style:style style:name="T14" style:family="text"><style:text-properties fo:background-color="transparent" loext:char-shading-value="0"/></style:style><style:style style:name="T15" style:family="text"><style:text-properties fo:background-color="transparent" loext:char-shading-value="0"/></style:style><style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties style:mirror="none" fo:clip="rect(0in, 0in, 0in, 0in)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style></office:automatic-styles><office:body><office:text text:use-soft-page-breaks="true"><office:forms form:automatic-focus="false" form:apply-design-mode="false"/><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/><text:sequence-decl text:display-outline-level="0" text:name="Figure"/></text:sequence-decls><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/><text:p text:style-name="P4"/>''')
-
-
-
- save.write('<text:p text:style-name="P5">'+win.analytics["name"]+'</text:p>')
-
-
-
- save.write('<text:p text:style-name="P6">'+win.analytics["director"]+'</text:p>')
-
-
-
- save.write('<text:p text:style-name="P7">'+win.analytics["status"]+'</text:p>')
-
-
-
-
-
-
- lastarrow = 'start'
- for i in win.story["arrows"]:
- if lastarrow == "end":
- break
- for arrow in win.story["arrows"]:
- if arrow[0] == lastarrow:
- lastarrow = arrow[1]
- if arrow[1] != "end":
-
-
- save.write('<text:p text:style-name="scene_name">'+arrow[1][1]+'</text:p>')
- save.write('<text:p text:style-name="P2"/>')
-
-
-
-
- assets = get_assets(win, arrow[1][1])
-
- for cur in ["chr", "veh", "loc", "obj"]:
- t = talk.text(cur)+": "
- for a in assets:
-
- if cur in a:
- t = t +a[a.rfind("/")+1:]+", "
- t = t[:-2]
-
- if t != talk.text(cur):
- save.write('<text:p text:style-name="P9">'+t+'</text:p>')
-
-
- scene = win.story["scenes"][arrow[1][1]]["shots"]
-
- save.write('<text:p text:style-name="P2"/>')
- save.write('<text:p text:style-name="P8">')
-
- for block in scene:
-
-
-
- if block[0] == "text_block":
- style = "T3"
- else:
-
-
-
- shotis = block[1]
-
- rcolors = [
- "shot_1",
- "shot_2",
- "shot_3",
- "shot_4",
- "shot_5"
- ]
-
-
-
- if "shot_colors" not in win.story:
- win.story["shot_colors"] = {}
-
- surl = "/"+arrow[1][1]+"/"+shotis
-
- if surl not in win.story["shot_colors"]:
-
- win.story["shot_colors"][surl] = rcolors[len(win.story["shot_colors"]) % len(rcolors)]
-
- style = win.story["shot_colors"][surl]
-
-
-
- for text in block[-1]:
-
-
-
- if text[0] == "text" or text[0] == "link":
-
- for line in re.split("(\n)",text[-1]):
-
- if line == "\n":
- save.write('</text:p>')
- save.write('<text:p text:style-name="P8">')
-
- else:
- save.write('<text:span text:style-name="'+style+'">'+line+'</text:span>')
-
-
-
- elif text[0] == "frase":
-
-
- save.write('</text:p>')
-
-
- save.write('<text:p text:style-name="P2"/>')
-
-
- save.write('<text:p text:style-name="frase_name">'+text[1][-1]+'</text:p>')
-
-
- save.write('<text:p text:style-name="frase">')
-
-
-
- for line in re.split("(\n)",text[-1]):
- if line == "\n":
- save.write('</text:p>')
- save.write('<text:p text:style-name="frase">')
-
- else:
- save.write('<text:span text:style-name="'+style+'">'+line+'</text:span>')
-
-
- save.write('</text:p>')
-
-
- save.write('<text:p text:style-name="P8">')
-
-
-
-
-
-
- elif text[0] == "image":
-
-
-
- tmpurl = text[-1].replace("/", "_")
-
- if os.path.exists(win.project+text[-1]):
- f = open(win.project+text[-1], "rb")
- else:
- f = open(text[-1], "rb")
-
- s = open("/tmp/odt_export/Pictures/"+tmpurl, "wb")
- s.write(f.read())
- f.close()
- s.close()
-
-
-
-
- save.write('</text:p>')
- save.write('<text:p text:style-name="P13"/><text:p text:style-name="image_style"><draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="char" svg:width="6.6929in" svg:height="3.7646in" draw:z-index="0">')
- save.write('<draw:image xlink:href="Pictures/'+tmpurl+'" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" loext:mime-type="image/png"/>')
- save.write('</draw:frame></text:p>')
- save.write('<text:p text:style-name="P8">')
-
-
-
-
-
-
-
-
-
-
-
- save.write('</text:p>')
-
-
- save.write('<text:p text:style-name="P2"/>')
- save.write('<text:p text:style-name="P2"/>')
- save.write('<text:p text:style-name="P17"><text:s text:c="66"/></text:p>')
-
-
- else:
- break
-
-
-
-
-
-
-
-
-
-
-
- save.write('</office:text></office:body></office:document-content>')
- save.close()
-
-
-
-
-
- def zip_odt(src, dst):
- zf = zipfile.ZipFile("%s.odt" % (dst), "w", zipfile.ZIP_DEFLATED)
- abs_src = os.path.abspath(src)
- for dirname, subdirs, files in os.walk(src):
- for filename in files:
- absname = os.path.abspath(os.path.join(dirname, filename))
- arcname = absname[len(abs_src) + 1:]
- zf.write(absname, arcname)
- zf.close()
-
- zip_odt("/tmp/odt_export", savefilename)
-
- def get_assets(win, scene):
-
-
-
- assets = []
-
-
-
-
-
- for shot in win.story["scenes"][scene]["shots"]:
-
-
-
- for asset in shot[-1]:
-
- if asset[0] == "text":
- continue
-
-
- if asset[0] == "link" and asset[1] not in assets:
- assets.append(asset[1])
-
-
- if asset[0] == "frase" and asset[1][0] == "link" and asset[1][1] not in assets:
- assets.append(asset[1][1])
-
-
- return assets
|