diff --git a/kcc.py b/kcc.py
index 618c2cb..a6020d9 100755
--- a/kcc.py
+++ b/kcc.py
@@ -34,24 +34,6 @@ if sys.platform.startswith('darwin'):
else:
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/osx/:' + os.environ['PATH']
elif sys.platform.startswith('win'):
- '''
- import multiprocessing.popen_spawn_win32 as forking
-
- class _Popen(forking.Popen):
- def __init__(self, *args, **kw):
- if hasattr(sys, 'frozen'):
- # noinspection PyUnresolvedReferences,PyProtectedMember
- os.putenv('_MEIPASS2', sys._MEIPASS)
- try:
- super(_Popen, self).__init__(*args, **kw)
- finally:
- if hasattr(sys, 'frozen'):
- if hasattr(os, 'unsetenv'):
- os.unsetenv('_MEIPASS2')
- else:
- os.putenv('_MEIPASS2', '')
- forking.Popen = _Popen
- '''
if getattr(sys, 'frozen', False):
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
else:
@@ -61,7 +43,7 @@ elif sys.platform.startswith('win'):
if getattr(sys, 'frozen', False):
try:
import kindlecomicconverter.sentry
- except:
+ except ImportError:
pass
from multiprocessing import freeze_support
diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py
index a98585a..651026a 100644
--- a/kindlecomicconverter/KCC_gui.py
+++ b/kindlecomicconverter/KCC_gui.py
@@ -156,8 +156,8 @@ class VersionThread(QtCore.QThread):
'('
'Changelog)', 'warning', False)
- def setAnswer(self, dialogAnswer):
- self.answer = dialogAnswer
+ def setAnswer(self, dialoganswer):
+ self.answer = dialoganswer
def getNewVersion(self):
while self.answer is None:
@@ -180,8 +180,8 @@ class VersionThread(QtCore.QThread):
MW.hideProgressBar.emit()
MW.modeConvert.emit(1)
- def getNewVersionTick(self, size, blockSize, totalSize):
- progress = int((size / (totalSize // blockSize)) * 100)
+ def getNewVersionTick(self, size, blocksize, totalsize):
+ progress = int((size / (totalsize // blocksize)) * 100)
if size == 0:
MW.progressBarTick.emit('100')
if progress > self.barProgress:
@@ -667,10 +667,10 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
self.addMessage(''
'List of supported Non-Kindle devices.', 'info')
- def changeFormat(self, outputFormat=None):
+ def changeFormat(self, outputformat=None):
profile = GUI.profiles[str(GUI.deviceBox.currentText())]
- if outputFormat is not None:
- GUI.formatBox.setCurrentIndex(outputFormat)
+ if outputformat is not None:
+ GUI.formatBox.setCurrentIndex(outputformat)
else:
GUI.formatBox.setCurrentIndex(profile['DefaultFormat'])
if not GUI.webtoonBox.isChecked():
@@ -881,10 +881,10 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
else:
self.addMessage('Download it and place executable in /usr/local/bin directory.', 'error')
- def __init__(self, KCCAplication, KCCWindow):
+ def __init__(self, kccapp, kccwindow):
global APP, MW, GUI
- APP = KCCAplication
- MW = KCCWindow
+ APP = kccapp
+ MW = kccwindow
GUI = self
self.setupUi(MW)
self.editor = KCCGUI_MetaEditor()
diff --git a/kindlecomicconverter/cbxarchive.py b/kindlecomicconverter/cbxarchive.py
index 7aba70f..fdb6393 100644
--- a/kindlecomicconverter/cbxarchive.py
+++ b/kindlecomicconverter/cbxarchive.py
@@ -26,13 +26,13 @@ from .shared import check7ZFile as is_7zfile
class CBxArchive:
- def __init__(self, origFileName):
- self.origFileName = origFileName
- if is_zipfile(origFileName):
+ def __init__(self, fname):
+ self.fname = fname
+ if is_zipfile(fname):
self.compressor = 'zip'
- elif rarfile.is_rarfile(origFileName):
+ elif rarfile.is_rarfile(fname):
self.compressor = 'rar'
- elif is_7zfile(origFileName):
+ elif is_7zfile(fname):
self.compressor = '7z'
else:
self.compressor = None
@@ -41,22 +41,19 @@ class CBxArchive:
return self.compressor is not None
def extractCBZ(self, targetdir):
- cbzFile = ZipFile(self.origFileName)
+ cbzFile = ZipFile(self.fname)
filelist = []
for f in cbzFile.namelist():
if f.startswith('__MACOSX') or f.endswith('.DS_Store') or f.endswith('humbs.db'):
pass
elif f.endswith('/'):
- try:
- os.makedirs(os.path.join(targetdir, f))
- except Exception:
- pass
+ os.makedirs(os.path.join(targetdir, f), exist_ok=True)
else:
filelist.append(f)
cbzFile.extractall(targetdir, filelist)
def extractCBR(self, targetdir):
- cbrFile = rarfile.RarFile(self.origFileName)
+ cbrFile = rarfile.RarFile(self.fname)
cbrFile.extractall(targetdir)
for root, _, filenames in os.walk(targetdir):
for filename in filenames:
@@ -64,7 +61,7 @@ class CBxArchive:
os.remove(os.path.join(root, filename))
def extractCB7(self, targetdir):
- output = Popen('7za x "' + self.origFileName + '" -xr!__MACOSX -xr!.DS_Store -xr!thumbs.db -xr!Thumbs.db -o"' +
+ output = Popen('7za x "' + self.fname + '" -xr!__MACOSX -xr!.DS_Store -xr!thumbs.db -xr!Thumbs.db -o"' +
targetdir + '"', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
extracted = False
for line in output.stdout:
diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py
index e27d5e6..1689d8d 100755
--- a/kindlecomicconverter/comic2ebook.py
+++ b/kindlecomicconverter/comic2ebook.py
@@ -198,7 +198,7 @@ def buildHTML(path, imgfile, imgfilepath):
return path, imgfile
-def buildNCX(dstdir, title, chapters, chapterNames):
+def buildNCX(dstdir, title, chapters, chapternames):
ncxfile = os.path.join(dstdir, 'OEBPS', 'toc.ncx')
f = open(ncxfile, "w", encoding='UTF-8')
f.writelines(["\n",
@@ -217,10 +217,10 @@ def buildNCX(dstdir, title, chapters, chapterNames):
filename = getImageFileName(os.path.join(folder, chapter[1]))
navID = folder.replace('/', '_').replace('\\', '_')
if options.chapters:
- title = chapterNames[chapter[1]]
+ title = chapternames[chapter[1]]
navID = filename[0].replace('/', '_').replace('\\', '_')
elif os.path.basename(folder) != "Text":
- title = chapterNames[os.path.basename(folder)]
+ title = chapternames[os.path.basename(folder)]
f.write("