diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index 0a69aeb..1831be4 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -91,7 +91,9 @@ class VersionThread(QtCore.QThread): latestVersion = XML.childNodes[0].getElementsByTagName('latest')[0].childNodes[0].toxml() if tuple(map(int, (latestVersion.split(".")))) > tuple(map(int, (__version__.split(".")))): self.emit(QtCore.SIGNAL("addMessage"), '' - 'New version is available!', 'warning') + 'New version is available! ' + '(' + 'Changelog)', 'warning') # noinspection PyBroadException diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 383d94a..2286723 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -537,7 +537,6 @@ def getWorkFolder(afile): raise UserWarning("Path is too long.") if os.path.isdir(afile): workdir = tempfile.mkdtemp('', 'KCC-TMP-') - #workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.join(os.path.splitext(afile)[0], '..')) try: os.rmdir(workdir) # needed for copytree() fails if dst already exists fullPath = os.path.join(workdir, 'OEBPS', 'Images') @@ -557,7 +556,6 @@ def getWorkFolder(afile): raise UserWarning("Failed to extract images.") else: workdir = tempfile.mkdtemp('', 'KCC-TMP-') - #workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.dirname(afile)) cbx = cbxarchive.CBxArchive(afile) if cbx.isCbxFile(): try: @@ -633,10 +631,8 @@ def getDirectorySize(start_path='.'): return total_size -# noinspection PyUnusedLocal -def createNewTome(parentPath): +def createNewTome(): tomePathRoot = tempfile.mkdtemp('', 'KCC-TMP-') - #tomePathRoot = tempfile.mkdtemp('', 'KCC-TMP-', parentPath) tomePath = os.path.join(tomePathRoot, 'OEBPS', 'Images') os.makedirs(tomePath) return tomePath, tomePathRoot @@ -653,7 +649,7 @@ def walkLevel(some_dir, level=1): del dirs[:] -def splitDirectory(path, mode, parentPath): +def splitDirectory(path, mode): output = [] currentSize = 0 currentTarget = path @@ -662,7 +658,7 @@ def splitDirectory(path, mode, parentPath): for name in files: size = os.path.getsize(os.path.join(root, name)) if currentSize + size > 262144000: - currentTarget, pathRoot = createNewTome(parentPath) + currentTarget, pathRoot = createNewTome() output.append(pathRoot) currentSize = size else: @@ -674,7 +670,7 @@ def splitDirectory(path, mode, parentPath): for name in dirs: size = getDirectorySize(os.path.join(root, name)) if currentSize + size > 262144000: - currentTarget, pathRoot = createNewTome(parentPath) + currentTarget, pathRoot = createNewTome() output.append(pathRoot) currentSize = size else: @@ -689,7 +685,7 @@ def splitDirectory(path, mode, parentPath): currentSize = 0 if size > 262144000: if not firstTome: - currentTarget, pathRoot = createNewTome(parentPath) + currentTarget, pathRoot = createNewTome() output.append(pathRoot) else: firstTome = False @@ -697,7 +693,7 @@ def splitDirectory(path, mode, parentPath): for nameInside in dirsInside: size = getDirectorySize(os.path.join(rootInside, nameInside)) if currentSize + size > 262144000: - currentTarget, pathRoot = createNewTome(parentPath) + currentTarget, pathRoot = createNewTome() output.append(pathRoot) currentSize = size else: @@ -706,7 +702,7 @@ def splitDirectory(path, mode, parentPath): move(os.path.join(rootInside, nameInside), os.path.join(currentTarget, nameInside)) else: if not firstTome: - currentTarget, pathRoot = createNewTome(parentPath) + currentTarget, pathRoot = createNewTome() output.append(pathRoot) move(os.path.join(root, name), os.path.join(currentTarget, name)) else: @@ -767,7 +763,7 @@ def preSplitDirectory(path): GUI.emit(QtCore.SIGNAL("addMessage"), '') return [path] # Split directories - split = splitDirectory(os.path.join(path, 'OEBPS', 'Images'), mode, os.path.join(path, '..')) + split = splitDirectory(os.path.join(path, 'OEBPS', 'Images'), mode) path = [path] for tome in split: path.append(tome) diff --git a/kcc/image.py b/kcc/image.py index 7401a78..1c10b68 100755 --- a/kcc/image.py +++ b/kcc/image.py @@ -393,7 +393,6 @@ class ComicPage: while ImageStat.Stat(self.image.crop((0, 0, widthImg, diff))).var[0] < threshold and diff < heightImg: diff += delta diff -= delta - # print "Top crop: %s"%diff self.image = self.image.crop((0, diff, widthImg, heightImg)) widthImg, heightImg = self.image.size diff = delta @@ -401,7 +400,6 @@ class ComicPage: while ImageStat.Stat(self.image.crop((0, 0, diff, heightImg))).var[0] < threshold and diff < widthImg: diff += delta diff -= delta - # print "Left crop: %s"%diff self.image = self.image.crop((diff, 0, widthImg, heightImg)) widthImg, heightImg = self.image.size diff = delta @@ -410,7 +408,6 @@ class ComicPage: and diff < heightImg: diff += delta diff -= delta - # print "Down crop: %s"%diff self.image = self.image.crop((0, 0, widthImg, heightImg - diff)) widthImg, heightImg = self.image.size diff = delta @@ -419,9 +416,7 @@ class ComicPage: and diff < widthImg: diff += delta diff -= delta - # print "Right crop: %s"%diff self.image = self.image.crop((0, 0, widthImg - diff, heightImg)) - # print "New size: %sx%s"%(self.image.size[0],self.image.size[1]) return self.image def getImageHistogram(self, image):