mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-09-21 12:01:55 +12:00
Merge branch 'master' into feature/Exporter
This commit is contained in:
commit
d20a9972c9
4 changed files with 18 additions and 8 deletions
Binary file not shown.
|
@ -139,7 +139,7 @@
|
||||||
<message>
|
<message>
|
||||||
<location filename="../manuskript/ui/mainWindow.ui" line="1377"/>
|
<location filename="../manuskript/ui/mainWindow.ui" line="1377"/>
|
||||||
<source>Full</source>
|
<source>Full</source>
|
||||||
<translation>Lleno</translation>
|
<translation>Completo</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../manuskript/ui/mainWindow.ui" line="420"/>
|
<location filename="../manuskript/ui/mainWindow.ui" line="420"/>
|
||||||
|
|
|
@ -11,6 +11,7 @@ a = Analysis(['bin/manuskript'],
|
||||||
("libs", "libs"),
|
("libs", "libs"),
|
||||||
("resources", "resources"),
|
("resources", "resources"),
|
||||||
("sample-projects", "sample-projects"),
|
("sample-projects", "sample-projects"),
|
||||||
|
("i18n", "i18n"),
|
||||||
],
|
],
|
||||||
hiddenimports=["xml.dom"],
|
hiddenimports=["xml.dom"],
|
||||||
hookspath=[],
|
hookspath=[],
|
||||||
|
|
|
@ -364,9 +364,14 @@ def saveProject(zip=None):
|
||||||
# Check if content is in cache, and write if necessary
|
# Check if content is in cache, and write if necessary
|
||||||
if path not in cache or cache[path] != content:
|
if path not in cache or cache[path] != content:
|
||||||
log("* Writing file {} ({})".format(path, "not in cache" if path not in cache else "different"))
|
log("* Writing file {} ({})".format(path, "not in cache" if path not in cache else "different"))
|
||||||
mode = "w" + ("b" if type(content) == bytes else "")
|
# mode = "w" + ("b" if type(content) == bytes else "")
|
||||||
with open(filename, mode) as f:
|
if type(content) == bytes:
|
||||||
f.write(content)
|
with open(filename, "wb") as f:
|
||||||
|
f.write(content)
|
||||||
|
else:
|
||||||
|
with open(filename, "w", encoding='utf8') as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
cache[path] = content
|
cache[path] = content
|
||||||
|
|
||||||
# Removing phantoms
|
# Removing phantoms
|
||||||
|
@ -395,7 +400,7 @@ def saveProject(zip=None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Write the project file's content
|
# Write the project file's content
|
||||||
with open(project, "w") as f:
|
with open(project, "w", encoding='utf8') as f:
|
||||||
f.write("1") # Format number
|
f.write("1") # Format number
|
||||||
|
|
||||||
|
|
||||||
|
@ -622,9 +627,13 @@ def loadProject(project, zip=None):
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
p = dirpath.replace(path, "")
|
p = dirpath.replace(path, "")
|
||||||
for f in filenames:
|
for f in filenames:
|
||||||
mode = "r" + ("b" if f[-4:] in [".xml", "opml"] else "")
|
# mode = "r" + ("b" if f[-4:] in [".xml", "opml"] else "")
|
||||||
with open(os.path.join(dirpath, f), mode) as fo:
|
if f[-4:] in [".xml", "opml"]:
|
||||||
files[os.path.join(p, f)] = fo.read()
|
with open(os.path.join(dirpath, f), "rb") as fo:
|
||||||
|
files[os.path.join(p, f)] = fo.read()
|
||||||
|
else:
|
||||||
|
with open(os.path.join(dirpath, f), "r", encoding="utf8") as fo:
|
||||||
|
files[os.path.join(p, f)] = fo.read()
|
||||||
|
|
||||||
# Saves to cache (only if we loaded from disk and not zip)
|
# Saves to cache (only if we loaded from disk and not zip)
|
||||||
global cache
|
global cache
|
||||||
|
|
Loading…
Reference in a new issue