Saving seems to be done

This commit is contained in:
Olivier Keshavjee 2016-03-09 16:02:22 +01:00
parent b29fbebd25
commit fc89207ca8
3 changed files with 13 additions and 25 deletions

View file

@ -3,6 +3,7 @@
# The loadSave file calls the propper functions to load and save file
# trying to detect the proper file format if it comes from an older version
import os
import zipfile
import manuskript.load_save.version_0 as v0
@ -20,10 +21,10 @@ def saveProject(version=None):
def loadProject(project):
# Detect version
# Is it a zip?
isZip = False
version = 0
# Is it a zip?
try:
zf = zipfile.ZipFile(project)
isZip = True
@ -40,8 +41,17 @@ def loadProject(project):
# Not a zip
else:
# FIXME
pass
# Project path
dir = os.path.dirname(project)
# Folder containing file: name of the project file (without .msk extension)
folder = os.path.splitext(os.path.basename(project))[0]
# Reading VERSION file
path = os.path.join(dir, folder, "VERSION")
if os.path.exists(path):
with open(path, "r") as f:
version = int(f.read())
print("Detected file format version:", version)

View file

@ -219,19 +219,6 @@ def saveProject(zip=None):
files.append((cpath, content))
# # List removed characters
# for c in mdl.removed:
# # generate file's path
# cpath = path.format(name="{ID}-{slugName}".format(
# ID=c.ID(),
# slugName=slugify(c.name())
# ))
#
# # Mark for removal
# removes.append(cpath)
mdl.removed.clear()
####################################################################################################################
# Texts
# In an outline folder
@ -244,11 +231,6 @@ def saveProject(zip=None):
moves += m
removes += r
# List removed items
# for item in mdl.removed:
# path = outlineItemPath(item)
# log("* Marking for removal:", path)
####################################################################################################################
# World
# Either in an XML file, or in lots of plain texts?

View file

@ -14,9 +14,6 @@ class characterModel(QAbstractItemModel):
# CharacterItems are stored in this list
self.characters = []
# We keep track of removed character, so that when we save in multiple files, we can remove old character's
# files.
self.removed = []
###############################################################################
# QAbstractItemModel subclassed
@ -174,7 +171,6 @@ class characterModel(QAbstractItemModel):
"""
c = self.getCharacterByID(ID)
self.beginRemoveRows(QModelIndex(), self.characters.index(c), self.characters.index(c))
self.removed.append(c)
self.characters.remove(c)
self.endRemoveRows()