about summary refs log tree commit diff
path: root/kindlecomicconverter/comic2panel.py
diff options
context:
space:
mode:
authorPaweł Jastrzębski <pawelj@iosphe.re>2017-03-12 17:42:08 +0100
committerPaweł Jastrzębski <pawelj@iosphe.re>2017-03-15 18:30:32 +0100
commit2e9b3389e4ff746d339c74cead92cc072b9dd6a9 (patch)
tree5910e7b94f2b8bfb38fd2a4586df0e70ef9866a2 /kindlecomicconverter/comic2panel.py
parentUpdated build environment (diff)
downloadkcc-2e9b3389e4ff746d339c74cead92cc072b9dd6a9.tar.gz
kcc-2e9b3389e4ff746d339c74cead92cc072b9dd6a9.tar.bz2
kcc-2e9b3389e4ff746d339c74cead92cc072b9dd6a9.zip
Code cleanup
Diffstat (limited to 'kindlecomicconverter/comic2panel.py')
-rw-r--r--kindlecomicconverter/comic2panel.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/kindlecomicconverter/comic2panel.py b/kindlecomicconverter/comic2panel.py
index 6ccdcbc..e173575 100644
--- a/kindlecomicconverter/comic2panel.py
+++ b/kindlecomicconverter/comic2panel.py
@@ -24,7 +24,7 @@ from shutil import rmtree, copytree, move
 from optparse import OptionParser, OptionGroup
 from multiprocessing import Pool
 from PIL import Image, ImageStat, ImageOps
-from .shared import getImageFileName, walkLevel, walkSort, saferRemove, sanitizeTrace
+from .shared import getImageFileName, walkLevel, walkSort, sanitizeTrace
 try:
     from PyQt5 import QtCore
 except ImportError:
@@ -48,7 +48,7 @@ def mergeDirectory(work):
         imagesValid = []
         sizes = []
         targetHeight = 0
-        for root, dirs, files in walkLevel(directory, 0):
+        for root, _, files in walkLevel(directory, 0):
             for name in files:
                 if getImageFileName(name) is not None:
                     i = Image.open(os.path.join(root, name))
@@ -73,7 +73,7 @@ def mergeDirectory(work):
                     img = ImageOps.fit(img, (targetWidth, img.size[1]), method=Image.BICUBIC, centering=(0.5, 0.5))
                 result.paste(img, (0, y))
                 y += img.size[1]
-                saferRemove(i)
+                os.remove(i)
             savePath = os.path.split(imagesValid[0])
             result.save(os.path.join(savePath[0], os.path.splitext(savePath[1])[0] + '.png'), 'PNG')
     except Exception:
@@ -199,7 +199,7 @@ def splitImage(work):
                         targetHeight += panels[panel][2]
                     newPage.save(os.path.join(path, fileExpanded[0] + '-' + str(pageNumber) + '.png'), 'PNG')
                     pageNumber += 1
-            saferRemove(filePath)
+            os.remove(filePath)
     except Exception:
         return str(sys.exc_info()[1]), sanitizeTrace(sys.exc_info()[2])
 
@@ -265,13 +265,13 @@ def main(argv=None, qtGUI=None):
                     rmtree(options.targetDir, True)
                     raise RuntimeError("One of workers crashed. Cause: " + mergeWorkerOutput[0][0], mergeWorkerOutput[0][1])
             print("Splitting images...")
-            for root, dirs, files in os.walk(options.targetDir, False):
+            for root, _, files in os.walk(options.targetDir, False):
                 for name in files:
                     if getImageFileName(name) is not None:
                         pagenumber += 1
                         work.append([root, name, options])
                     else:
-                        saferRemove(os.path.join(root, name))
+                        os.remove(os.path.join(root, name))
             if GUI:
                 GUI.progressBarTick.emit('Splitting images')
                 GUI.progressBarTick.emit(str(pagenumber))